From c8dffd157cd8b62023b26e62a0b92c152d959423 Mon Sep 17 00:00:00 2001 From: Codex Assistant <codex@example.com> Date: 星期三, 08 十月 2025 21:19:28 +0800 Subject: [PATCH] build(backend): switch to thin-jar layout (split libs into target/lib); chore: remove test-* files; misc updates --- /dev/null | 123 ------------- backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerService.java | 40 ++++ backend/pom.xml | 43 ++++ backend/src/main/java/com/rongyichuang/user/service/UserService.java | 7 backend/src/main/java/com/rongyichuang/player/dto/PromotableParticipantResponse.java | 19 + backend/src/main/resources/application.yml | 3 wx/pages/registration/registration.js | 8 backend/src/main/java/com/rongyichuang/player/entity/Player.java | 2 backend/src/main/java/com/rongyichuang/auth/controller/AuthController.java | 28 ++ backend/src/main/java/com/rongyichuang/player/dto/CompetitionParticipantResponse.java | 18 + wx/pages/project/detail.js | 246 ++++++++++++++++++++++----- 11 files changed, 356 insertions(+), 181 deletions(-) diff --git a/backend/pom.xml b/backend/pom.xml index c7f448a..18701af 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -150,9 +150,52 @@ <build> <plugins> + <!-- 绂佺敤 Spring Boot 鑳栧寘閲嶆墦鍖咃紝鏀逛负鐦﹀寘 + 澶栫疆渚濊禆 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + + <!-- 鍦ㄦ墦鍖呴樁娈靛鍒舵墍鏈変緷璧栧埌 target/lib --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>3.6.1</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + <includeScope>runtime</includeScope> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + </configuration> + </execution> + </executions> + </plugin> + + <!-- 鐢熸垚鍙墽琛岀槮 JAR锛氬啓鍏� Main-Class 涓� Class-Path 鎸囧悜 lib/ --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>3.4.2</version> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>lib/</classpathPrefix> + <mainClass>com.rongyichuang.RycBackendApplication</mainClass> + </manifest> + </archive> + </configuration> </plugin> </plugins> </build> diff --git a/backend/src/main/java/com/rongyichuang/auth/controller/AuthController.java b/backend/src/main/java/com/rongyichuang/auth/controller/AuthController.java index d3da50e..d7ad8b6 100644 --- a/backend/src/main/java/com/rongyichuang/auth/controller/AuthController.java +++ b/backend/src/main/java/com/rongyichuang/auth/controller/AuthController.java @@ -34,7 +34,7 @@ * Web绔敤鎴风櫥褰� */ @PostMapping("/web-login") - public ResponseEntity<LoginResponse> webLogin(@Valid @RequestBody LoginRequest request) { + public ResponseEntity<?> webLogin(@Valid @RequestBody LoginRequest request) { logger.info("鏀跺埌Web鐧诲綍璇锋眰锛屾墜鏈哄彿: {}", request.getPhone()); try { LoginResponse response = authService.login(request); @@ -42,7 +42,25 @@ return ResponseEntity.ok(response); } catch (Exception e) { logger.error("Web鐧诲綍澶辫触锛屾墜鏈哄彿: {}, 閿欒: {}", request.getPhone(), e.getMessage()); - return ResponseEntity.badRequest().build(); + // 杩斿洖鍖呭惈閿欒淇℃伅鐨凧SON鍝嶅簲 + return ResponseEntity.badRequest().body(new ErrorResponse(e.getMessage())); + } + } + + // 閿欒鍝嶅簲绫� + public static class ErrorResponse { + private String message; + + public ErrorResponse(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; } } @@ -51,11 +69,17 @@ */ @PostMapping("/wx-login") public ResponseEntity<WxLoginResponse> wxLogin(@RequestBody WxLoginRequest request) { + logger.info("鏀跺埌寰俊鐧诲綍璇锋眰锛宱penid: {}", request.getWxOpenid()); try { WxLoginResponse response = authService.wxLogin(request); + logger.info("寰俊鐧诲綍鎴愬姛锛宱penid: {}", request.getWxOpenid()); return ResponseEntity.ok(response); } catch (JsonProcessingException e) { + logger.error("寰俊鐧诲綍JSON澶勭悊寮傚父锛宱penid: {}, 閿欒: {}", request.getWxOpenid(), e.getMessage()); return ResponseEntity.badRequest().build(); + } catch (Exception e) { + logger.error("寰俊鐧诲綍澶辫触锛宱penid: {}, 閿欒: {}", request.getWxOpenid(), e.getMessage(), e); + return ResponseEntity.status(500).build(); } } diff --git a/backend/src/main/java/com/rongyichuang/player/dto/CompetitionParticipantResponse.java b/backend/src/main/java/com/rongyichuang/player/dto/CompetitionParticipantResponse.java index 6797fa7..480f882 100644 --- a/backend/src/main/java/com/rongyichuang/player/dto/CompetitionParticipantResponse.java +++ b/backend/src/main/java/com/rongyichuang/player/dto/CompetitionParticipantResponse.java @@ -27,9 +27,21 @@ this.id = activityPlayer.getId(); this.playerName = activityPlayer.getPlayer() != null ? activityPlayer.getPlayer().getName() : ""; this.projectName = activityPlayer.getProjectName(); - // 浠嶶ser瀹炰綋鑾峰彇phone锛岃�屼笉鏄粠Player瀹炰綋锛圥layer.phone宸插簾寮冿級 - this.phone = activityPlayer.getPlayer() != null && activityPlayer.getPlayer().getUser() != null ? - activityPlayer.getPlayer().getUser().getPhone() : ""; + // 涓存椂浣跨敤搴熷純鐨凱layer.phone瀛楁锛屽悗缁渶瑕佷粠鏈嶅姟灞備紶鍏ser鐨刾hone + this.phone = activityPlayer.getPlayer() != null ? activityPlayer.getPlayer().getPhone() : ""; + this.averageScore = activityPlayer.getTotalScore(); + this.ratingCount = 0; // 闇�瑕佷粠璇勫垎琛ㄤ腑缁熻 + this.applyTime = activityPlayer.getCreateTime() != null ? + activityPlayer.getCreateTime().format(FORMATTER) : null; + this.state = activityPlayer.getState(); + } + + public CompetitionParticipantResponse(ActivityPlayer activityPlayer, String userPhone) { + this.id = activityPlayer.getId(); + this.playerName = activityPlayer.getPlayer() != null ? activityPlayer.getPlayer().getName() : ""; + this.projectName = activityPlayer.getProjectName(); + // 浠庡弬鏁拌幏鍙朥ser鐨刾hone + this.phone = userPhone != null ? userPhone : ""; this.averageScore = activityPlayer.getTotalScore(); this.ratingCount = 0; // 闇�瑕佷粠璇勫垎琛ㄤ腑缁熻 this.applyTime = activityPlayer.getCreateTime() != null ? diff --git a/backend/src/main/java/com/rongyichuang/player/dto/PromotableParticipantResponse.java b/backend/src/main/java/com/rongyichuang/player/dto/PromotableParticipantResponse.java index b28a85f..5913885 100644 --- a/backend/src/main/java/com/rongyichuang/player/dto/PromotableParticipantResponse.java +++ b/backend/src/main/java/com/rongyichuang/player/dto/PromotableParticipantResponse.java @@ -28,9 +28,22 @@ this.id = activityPlayer.getId(); this.playerName = activityPlayer.getPlayer() != null ? activityPlayer.getPlayer().getName() : ""; this.projectName = activityPlayer.getProjectName(); - // 浠嶶ser瀹炰綋鑾峰彇phone锛岃�屼笉鏄粠Player瀹炰綋锛圥layer.phone宸插簾寮冿級 - this.phone = activityPlayer.getPlayer() != null && activityPlayer.getPlayer().getUser() != null ? - activityPlayer.getPlayer().getUser().getPhone() : ""; + // 涓存椂浣跨敤搴熷純鐨凱layer.phone瀛楁锛屽悗缁渶瑕佷粠鏈嶅姟灞備紶鍏ser鐨刾hone + this.phone = activityPlayer.getPlayer() != null ? activityPlayer.getPlayer().getPhone() : ""; + this.averageScore = averageScore; + this.ratingCount = ratingCount != null ? ratingCount : 0; + this.applyTime = activityPlayer.getCreateTime() != null ? + activityPlayer.getCreateTime().format(FORMATTER) : null; + this.state = activityPlayer.getState(); + this.playerId = activityPlayer.getPlayerId(); + } + + public PromotableParticipantResponse(ActivityPlayer activityPlayer, BigDecimal averageScore, Integer ratingCount, String userPhone) { + this.id = activityPlayer.getId(); + this.playerName = activityPlayer.getPlayer() != null ? activityPlayer.getPlayer().getName() : ""; + this.projectName = activityPlayer.getProjectName(); + // 浠庡弬鏁拌幏鍙朥ser鐨刾hone + this.phone = userPhone != null ? userPhone : ""; this.averageScore = averageScore; this.ratingCount = ratingCount != null ? ratingCount : 0; this.applyTime = activityPlayer.getCreateTime() != null ? diff --git a/backend/src/main/java/com/rongyichuang/player/entity/Player.java b/backend/src/main/java/com/rongyichuang/player/entity/Player.java index a60dacd..1818002 100644 --- a/backend/src/main/java/com/rongyichuang/player/entity/Player.java +++ b/backend/src/main/java/com/rongyichuang/player/entity/Player.java @@ -26,7 +26,7 @@ * @deprecated 姝ゅ瓧娈靛凡搴熷純锛岃浣跨敤鍏宠仈User瀹炰綋鐨刾hone瀛楁 */ @Deprecated - @Column(name = "phone", length = 32, nullable = false, unique = true) + @Column(name = "phone", length = 32) private String phone; /** diff --git a/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerService.java b/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerService.java index c050054..c59c7b8 100644 --- a/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerService.java +++ b/backend/src/main/java/com/rongyichuang/player/service/ActivityPlayerService.java @@ -19,6 +19,7 @@ import com.rongyichuang.media.service.MediaV2Service; import com.rongyichuang.media.dto.MediaSaveInput; import com.rongyichuang.message.service.MessageService; +import com.rongyichuang.auth.util.JwtUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -61,6 +62,9 @@ @Autowired private MessageService messageService; + + @Autowired + private JwtUtil jwtUtil; public ActivityPlayer getMyActivityPlayer(Long activityId) { @@ -240,6 +244,18 @@ String phone = input.getPlayerInfo().getPhone(); String name = input.getPlayerInfo().getName(); + // 鑾峰彇褰撳墠鐢ㄦ埛鐨剋xopenid锛堜粠JWT token涓級 + String currentWxOpenid = null; + try { + String token = userContextUtil.getTokenFromRequest(); + if (token != null && jwtUtil.validateToken(token)) { + currentWxOpenid = jwtUtil.getWxOpenidFromToken(token); + log.debug("浠嶫WT token涓幏鍙栧埌wxopenid: {}", currentWxOpenid); + } + } catch (Exception e) { + log.warn("鑾峰彇褰撳墠鐢ㄦ埛wxopenid鏃跺彂鐢熷紓甯�: {}", e.getMessage()); + } + // 鍏堟煡鎵剧幇鏈夌敤鎴� Optional<User> existingUserOpt = userService.findByPhone(phone); @@ -251,6 +267,18 @@ // 鏇存柊鐢ㄦ埛鐨勭敓鏃ヤ俊鎭� if (input.getPlayerInfo().getBirthDate() != null) { user.setBirthday(input.getPlayerInfo().getBirthDate()); + } + + // 鏇存柊wxopenid锛堝鏋滃綋鍓峵oken涓寘鍚笖涓嶄负绌猴級 + if (currentWxOpenid != null && !currentWxOpenid.trim().isEmpty()) { + // 妫�鏌ヨ繖涓猳penid鏄惁宸茬粡琚叾浠栫敤鎴蜂娇鐢� + Optional<User> existingUserWithOpenid = userService.findByWxOpenid(currentWxOpenid); + if (existingUserWithOpenid.isEmpty() || existingUserWithOpenid.get().getId().equals(user.getId())) { + user.setWxOpenid(currentWxOpenid); + log.info("鏇存柊鐢ㄦ埛wxopenid: {}", currentWxOpenid); + } else { + log.warn("wxopenid {} 宸茶鍏朵粬鐢ㄦ埛浣跨敤锛岀敤鎴稩D: {}", currentWxOpenid, existingUserWithOpenid.get().getId()); + } } user = userService.save(user); @@ -270,6 +298,18 @@ newUser.setBirthday(input.getPlayerInfo().getBirthDate()); } + // 璁剧疆wxopenid锛堝鏋滃綋鍓峵oken涓寘鍚笖涓嶄负绌猴級 + if (currentWxOpenid != null && !currentWxOpenid.trim().isEmpty()) { + // 妫�鏌ヨ繖涓猳penid鏄惁宸茬粡琚叾浠栫敤鎴蜂娇鐢� + Optional<User> existingUserWithOpenid = userService.findByWxOpenid(currentWxOpenid); + if (existingUserWithOpenid.isEmpty()) { + newUser.setWxOpenid(currentWxOpenid); + log.info("涓烘柊鐢ㄦ埛璁剧疆wxopenid: {}", currentWxOpenid); + } else { + log.warn("wxopenid {} 宸茶鍏朵粬鐢ㄦ埛浣跨敤锛岀敤鎴稩D: {}", currentWxOpenid, existingUserWithOpenid.get().getId()); + } + } + newUser = userService.save(newUser); log.info("涓哄皬绋嬪簭鎶ュ悕鎴愬姛鍒涘缓鏂扮敤鎴凤紝鐢ㄦ埛ID: {}", newUser.getId()); return newUser; diff --git a/backend/src/main/java/com/rongyichuang/user/service/UserService.java b/backend/src/main/java/com/rongyichuang/user/service/UserService.java index 0e8f24a..54e76b8 100644 --- a/backend/src/main/java/com/rongyichuang/user/service/UserService.java +++ b/backend/src/main/java/com/rongyichuang/user/service/UserService.java @@ -126,6 +126,13 @@ } /** + * 鏍规嵁寰俊openid鏌ユ壘鐢ㄦ埛 + */ + public Optional<User> findByWxOpenid(String wxOpenid) { + return userRepository.findByWxOpenid(wxOpenid); + } + + /** * 淇濆瓨鐢ㄦ埛 */ public User save(User user) { diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index f4b9dda..0718406 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -78,8 +78,11 @@ level: com.rongyichuang: DEBUG org.springframework.security: DEBUG + org.springframework.transaction: DEBUG + org.springframework.orm.jpa: DEBUG org.hibernate.SQL: DEBUG org.hibernate.type.descriptor.sql.BasicBinder: TRACE + org.hibernate.engine.transaction: DEBUG # 搴旂敤閰嶇疆 app: diff --git a/backend/test-saveUserInfo-updated.js b/backend/test-saveUserInfo-updated.js deleted file mode 100644 index 4b187fe..0000000 --- a/backend/test-saveUserInfo-updated.js +++ /dev/null @@ -1,8 +0,0 @@ -const axios = require('axios'); - -// 閰嶇疆 -const BASE_URL = 'http://localhost:8080'; -const GRAPHQL_ENDPOINT = `${BASE_URL}/graphql`; - -// 浣跨敤涔嬪墠鑾峰彇鐨勬湁鏁坱oken -const TOKEN = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxODU4NzE5NzQ5NzI5MzMxMjAwIiwiaWF0IjoxNzM3NTI5NzE4LCJleHAiOjE3Mzc2MTYxMTh9.YJJhJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ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JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ \ No newline at end of file diff --git a/test-activity-detail.js b/test-activity-detail.js deleted file mode 100644 index f2a2c05..0000000 --- a/test-activity-detail.js +++ /dev/null @@ -1,133 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯灏忕▼搴忔椿鍔ㄨ鎯呰幏鍙� -async function testActivityDetail() { - console.log('=== 娴嬭瘯灏忕▼搴忔椿鍔ㄨ鎯呰幏鍙� ===\n'); - - const baseUrl = 'http://localhost:8080/api/graphql'; - const activityId = 1; // 鍋囪娲诲姩ID涓�1 - - // 娴嬭瘯1: 涓嶆彁渚泃oken鐨勬儏鍐� - console.log('1. 娴嬭瘯娲诲姩璇︽儏鏌ヨ - 鏃爐oken'); - try { - const response = await axios.post(baseUrl, { - query: ` - query GetActivityDetailAndStatus($id: ID!) { - activity(id: $id) { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - } - myActivityPlayer(activityId: $id) { - id - state - } - } - `, - variables: { id: activityId } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鉁� 鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n' + '='.repeat(50) + '\n'); - - // 娴嬭瘯2: 鍙煡璇㈠叕寮�鐨勬椿鍔ㄤ俊鎭� - console.log('2. 娴嬭瘯鍙煡璇㈠叕寮�娲诲姩淇℃伅'); - try { - const response = await axios.post(baseUrl, { - query: ` - query GetActivityDetail($id: ID!) { - activity(id: $id) { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - } - } - `, - variables: { id: activityId } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鉁� 鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n' + '='.repeat(50) + '\n'); - - // 娴嬭瘯3: 浣跨敤鏈夋晥token鏌ヨ - console.log('3. 娴嬭瘯浣跨敤鏈夋晥token鏌ヨ'); - const validToken = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDg4IiwicGhvbmUiOiJvZ3h4QTEtS3JTVlRkcUk5VDF1YUIxQlF3UEdVIiwiaWF0IjoxNzU5ODM3NjkwLCJleHAiOjE3NTk5MjQwOTB9.RjsrnxztC4o4E49Z-GsxDOuzsC-YBsS380hG8_WeZps'; // 浠庝箣鍓嶇殑娴嬭瘯鑾峰彇 - - try { - const response = await axios.post(baseUrl, { - query: ` - query GetActivityDetailAndStatus($id: ID!) { - activity(id: $id) { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - } - myActivityPlayer(activityId: $id) { - id - state - } - } - `, - variables: { id: activityId } - }, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${validToken}` - } - }); - - console.log('鉁� 鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); -} - -testActivityDetail().catch(console.error); \ No newline at end of file diff --git a/test-activity-id-debug.js b/test-activity-id-debug.js deleted file mode 100644 index 8e28b5b..0000000 --- a/test-activity-id-debug.js +++ /dev/null @@ -1,195 +0,0 @@ -const http = require('http'); - -// 妯℃嫙 GraphQL 璇锋眰 -function makeGraphQLRequest() { - return new Promise((resolve, reject) => { - const postData = JSON.stringify({ - query: ` - query GetActivities($page: Int!, $size: Int!) { - activities(page: $page, size: $size) { - content { - id - name - signupDeadline - playerCount - playerMax - state - stateName - coverImage { - fullUrl - } - } - totalElements - totalPages - number - size - } - } - `, - variables: { - page: 0, - size: 10 - } - }); - - const options = { - hostname: 'localhost', - port: 8080, - path: '/api/graphql', - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(postData) - } - }; - - const req = http.request(options, (res) => { - let data = ''; - res.on('data', (chunk) => { - data += chunk; - }); - res.on('end', () => { - try { - const result = JSON.parse(data); - resolve(result); - } catch (e) { - reject(e); - } - }); - }); - - req.on('error', (e) => { - reject(e); - }); - - req.write(postData); - req.end(); - }); -} - -// 妯℃嫙灏忕▼搴忕殑 dataset 鍜屼簨浠跺鐞� -function simulateClickEvent(activityId) { - console.log('\n=== 妯℃嫙鐐瑰嚮浜嬩欢 ==='); - console.log('娲诲姩ID:', activityId); - console.log('娲诲姩ID绫诲瀷:', typeof activityId); - - // 妯℃嫙 data-id 灞炴�ц缃� - const dataId = activityId; - console.log('data-id 璁剧疆涓�:', dataId); - - // 妯℃嫙浜嬩欢瀵硅薄 - const mockEvent = { - currentTarget: { - dataset: { - id: dataId - } - } - }; - - // 妯℃嫙 onDetailTap 鍑芥暟 - function onDetailTap(e) { - const id = e.currentTarget.dataset.id; - console.log('onDetailTap 鑾峰彇鍒扮殑 id:', id); - console.log('id 绫诲瀷:', typeof id); - - if (id) { - goToActivityDetail(id); - } else { - console.log('鉂� ID 涓虹┖鎴栨湭瀹氫箟'); - } - } - - // 妯℃嫙 goToActivityDetail 鍑芥暟 - function goToActivityDetail(activityId) { - console.log('goToActivityDetail 鎺ユ敹鍒扮殑 activityId:', activityId); - console.log('activityId 绫诲瀷:', typeof activityId); - - // 妯℃嫙 utils.navigateTo - const params = { id: activityId }; - console.log('浼犻�掔粰璇︽儏椤电殑鍙傛暟:', params); - - // 妯℃嫙 URL 鏋勫缓 - const url = '/pages/activity/detail'; - const queryString = Object.keys(params) - .map(key => key + '=' + encodeURIComponent(params[key])) - .join('&'); - const fullUrl = url + '?' + queryString; - console.log('鏋勫缓鐨勫畬鏁� URL:', fullUrl); - - // 妯℃嫙璇︽儏椤垫帴鏀跺弬鏁� - const urlParams = new URLSearchParams('?' + queryString); - const receivedId = urlParams.get('id'); - console.log('璇︽儏椤垫帴鏀跺埌鐨� id:', receivedId); - console.log('璇︽儏椤垫帴鏀跺埌鐨� id 绫诲瀷:', typeof receivedId); - - return { - url: fullUrl, - params: params, - receivedId: receivedId - }; - } - - // 鎵ц鐐瑰嚮浜嬩欢 - const result = onDetailTap(mockEvent); - return result; -} - -// 涓诲嚱鏁� -async function main() { - try { - console.log('寮�濮嬫祴璇曟椿鍔↖D鍜屽弬鏁颁紶閫�...\n'); - - const result = await makeGraphQLRequest(); - - if (result.data && result.data.activities && result.data.activities.content) { - const activities = result.data.activities.content; - console.log('鑾峰彇鍒�', activities.length, '涓椿鍔�'); - - activities.forEach((activity, index) => { - console.log('\n--- 娲诲姩', index + 1, '---'); - console.log('ID:', activity.id); - console.log('ID绫诲瀷:', typeof activity.id); - console.log('鍚嶇О:', activity.name); - console.log('鐘舵��:', activity.stateName); - - // 妫�鏌� ID 鏄惁鏈夋晥 - if (!activity.id) { - console.log('鉂� 璀﹀憡锛氭椿鍔↖D涓虹┖'); - } else if (typeof activity.id !== 'string' && typeof activity.id !== 'number') { - console.log('鉂� 璀﹀憡锛氭椿鍔↖D绫诲瀷寮傚父'); - } else { - console.log('鉁� 娲诲姩ID姝e父'); - } - - // 妯℃嫙鐐瑰嚮浜嬩欢 - simulateClickEvent(activity.id); - }); - - // 娴嬭瘯杈圭晫鎯呭喌 - console.log('\n=== 娴嬭瘯杈圭晫鎯呭喌 ==='); - console.log('\n1. 娴嬭瘯 undefined ID:'); - simulateClickEvent(undefined); - - console.log('\n2. 娴嬭瘯 null ID:'); - simulateClickEvent(null); - - console.log('\n3. 娴嬭瘯绌哄瓧绗︿覆 ID:'); - simulateClickEvent(''); - - console.log('\n4. 娴嬭瘯鏁板瓧 ID:'); - simulateClickEvent(123); - - } else { - console.log('鉂� 鏈幏鍙栧埌娲诲姩鏁版嵁'); - console.log('鍝嶅簲:', JSON.stringify(result, null, 2)); - } - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.message); - if (error.code) { - console.error('閿欒浠g爜:', error.code); - } - } -} - -main(); \ No newline at end of file diff --git a/test-activity-time-debug.js b/test-activity-time-debug.js deleted file mode 100644 index 49eab0a..0000000 --- a/test-activity-time-debug.js +++ /dev/null @@ -1,91 +0,0 @@ -const axios = require('axios'); - -// 鍚庣GraphQL绔偣 -const GRAPHQL_URL = 'http://localhost:8080/api/graphql'; - -// 娴嬭瘯鏌ヨ姣旇禌鏁版嵁 -async function testActivityData() { - try { - console.log('馃攳 娴嬭瘯鍚庣杩斿洖鐨勬瘮璧涙椂闂存暟鎹�...\n'); - - const query = ` - query getActivities($page: Int!, $size: Int!, $name: String) { - activities(page: $page, size: $size, name: $name) { - content { - id - name - description - signupDeadline - matchTime - address - playerMax - state - stateName - playerCount - } - totalElements - page - size - } - } - `; - - const variables = { - page: 1, - size: 10, - name: "" - }; - - const response = await axios.post(GRAPHQL_URL, { - query, - variables - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.error('鉂� GraphQL閿欒:', response.data.errors); - return; - } - - const activities = response.data.data.activities.content; - - console.log(`馃搳 鑾峰彇鍒� ${activities.length} 涓瘮璧涙椿鍔╘n`); - - activities.forEach((activity, index) => { - console.log(`馃弳 姣旇禌 ${index + 1}: ${activity.name}`); - console.log(` ID: ${activity.id}`); - console.log(` 鎶ュ悕鎴鏃堕棿 (signupDeadline): ${activity.signupDeadline}`); - console.log(` 姣旇禌鏃堕棿 (matchTime): ${activity.matchTime}`); - console.log(` 鐘舵��: ${activity.state} (${activity.stateName})`); - console.log(` 鎶ュ悕浜烘暟: ${activity.playerCount}/${activity.playerMax}`); - - // 妫�鏌ユ椂闂存牸寮� - if (activity.signupDeadline) { - const signupDate = new Date(activity.signupDeadline); - console.log(` 馃搮 鎶ュ悕鎴鏃堕棿瑙f瀽: ${signupDate.toLocaleString()}`); - console.log(` 馃搮 鎶ュ悕鎴鏃堕棿ISO: ${signupDate.toISOString()}`); - } - - if (activity.matchTime) { - const matchDate = new Date(activity.matchTime); - console.log(` 馃弫 姣旇禌鏃堕棿瑙f瀽: ${matchDate.toLocaleString()}`); - console.log(` 馃弫 姣旇禌鏃堕棿ISO: ${matchDate.toISOString()}`); - } - - console.log(''); - }); - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testActivityData(); \ No newline at end of file diff --git a/test-actual-user-data.js b/test-actual-user-data.js deleted file mode 100644 index a0d65c6..0000000 --- a/test-actual-user-data.js +++ /dev/null @@ -1,66 +0,0 @@ -// 娴嬭瘯瀹為檯鐨勭敤鎴锋暟鎹粨鏋� -const fetch = require('node-fetch'); - -async function testUserData() { - console.log('=== 娴嬭瘯瀹為檯鐢ㄦ埛鏁版嵁缁撴瀯 ==='); - - try { - // 浣跨敤鐜版湁鐨勬湁鏁坱oken - const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDg4IiwicGhvbmUiOiJvZ3h4QTEtS3JTVlRkcUk5VDF1YUIxQlF3UEdVIiwiaWF0IjoxNzU5ODM5NDQ1LCJleHAiOjE3NTk5MjU4NDV9.Xoq2S-zQzI3GMWxaSS2A5GGlPsR3z2BRkzg4HK3tHhE'; - console.log('浣跨敤token:', token.substring(0, 20) + '...'); - - // 1. 浣跨敤token鏌ヨ鐢ㄦ埛淇℃伅 - console.log('\n1. 鏌ヨ鐢ㄦ埛淇℃伅...'); - const userProfileQuery = ` - query { - userProfile { - id - name - phone - avatar - gender - birthday - wxOpenId - unionId - } - } - `; - - const graphqlResponse = await fetch('http://localhost:8080/graphql', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - }, - body: JSON.stringify({ - query: userProfileQuery - }) - }); - - const graphqlData = await graphqlResponse.json(); - console.log('GraphQL鍝嶅簲:', JSON.stringify(graphqlData, null, 2)); - - if (graphqlData.data && graphqlData.data.userProfile) { - const userProfile = graphqlData.data.userProfile; - console.log('\n=== 鐢ㄦ埛淇℃伅鍒嗘瀽 ==='); - console.log('ID:', userProfile.id); - console.log('濮撳悕:', userProfile.name); - console.log('鎵嬫満:', userProfile.phone); - console.log('澶村儚:', userProfile.avatar); - console.log('鎬у埆:', userProfile.gender, '(绫诲瀷:', typeof userProfile.gender, ')'); - console.log('鐢熸棩:', userProfile.birthday, '(绫诲瀷:', typeof userProfile.birthday, ')'); - console.log('寰俊OpenID:', userProfile.wxOpenId); - console.log('UnionID:', userProfile.unionId); - - // 妫�鏌ュ瓧娈垫槸鍚︿负绌� - console.log('\n=== 瀛楁妫�鏌� ==='); - console.log('鎬у埆鏄惁涓虹┖:', userProfile.gender === null || userProfile.gender === undefined || userProfile.gender === ''); - console.log('鐢熸棩鏄惁涓虹┖:', userProfile.birthday === null || userProfile.birthday === undefined || userProfile.birthday === ''); - } - - } catch (error) { - console.error('娴嬭瘯杩囩▼涓嚭閿�:', error); - } -} - -testUserData(); \ No newline at end of file diff --git a/test-all-gender-fixes.js b/test-all-gender-fixes.js deleted file mode 100644 index 446f9fb..0000000 --- a/test-all-gender-fixes.js +++ /dev/null @@ -1,212 +0,0 @@ -const { graphqlRequest } = require('./test-graphql-queries-only') - -// 娴嬭瘯鎵�鏈夌鎬у埆閫昏緫淇鏁堟灉 -async function testAllGenderFixes() { - console.log('馃И 寮�濮嬫祴璇曟墍鏈夌鎬у埆閫昏緫淇鏁堟灉...\n') - - // 1. 娴嬭瘯鏁版嵁搴撲腑鐨勬�у埆鍊� - console.log('馃搳 1. 娴嬭瘯鏁版嵁搴撲腑鐨勬�у埆鍊�') - await testDatabaseGenderValues() - - // 2. 妯℃嫙鍓嶇鎬у埆杞崲閫昏緫 - console.log('\n馃帹 2. 妯℃嫙鍓嶇鎬у埆杞崲閫昏緫') - testFrontendGenderMapping() - - // 3. 妯℃嫙鍚庣鎬у埆杞崲閫昏緫 - console.log('\n鈿欙笍 3. 妯℃嫙鍚庣鎬у埆杞崲閫昏緫') - testBackendGenderMapping() - - console.log('\n鉁� 鎬у埆閫昏緫娴嬭瘯瀹屾垚锛�') -} - -// 娴嬭瘯鏁版嵁搴撲腑鐨勬�у埆鍊� -async function testDatabaseGenderValues() { - try { - const query = ` - query GetActivityPlayerApplications($activityId: ID, $page: Int, $size: Int) { - activityPlayerApplications(activityId: $activityId, page: $page, size: $size) { - id - playerName - phone - state - } - } - ` - - const variables = { - activityId: "1", - page: 0, - size: 5 - } - - const response = await graphqlRequest(query, variables) - const applications = response.data.activityPlayerApplications || [] - - console.log(`鎵惧埌 ${applications.length} 涓弬璧涗汉锛屽紑濮嬫鏌ュ墠3涓殑璇︾粏淇℃伅...`) - - for (let i = 0; i < Math.min(3, applications.length); i++) { - const app = applications[i] - await checkPlayerGenderDetail(app.id, app.playerName) - } - - } catch (error) { - console.error('鉂� 鏌ヨ鍙傝禌浜哄垪琛ㄥけ璐�:', error.message) - } -} - -// 妫�鏌ュ崟涓弬璧涗汉鐨勬�у埆璇︽儏 -async function checkPlayerGenderDetail(playerId, playerName) { - try { - const query = ` - query GetActivityPlayerDetail($id: ID!) { - activityPlayerDetail(id: $id) { - playerInfo { - id - name - gender - education - birthday - } - regionInfo { - id - name - fullPath - } - } - } - ` - - const response = await graphqlRequest(query, { id: playerId }) - const detail = response.data.activityPlayerDetail - - if (detail && detail.playerInfo) { - const { gender, name } = detail.playerInfo - - console.log(`\n馃懁 鍙傝禌浜�: ${name} (ID: ${playerId})`) - console.log(` 鍘熷鎬у埆鍊�: ${gender} (${typeof gender})`) - - // 妯℃嫙鍚勭鐨勬�у埆杞崲 - console.log(' 鍚勭杞崲缁撴灉:') - - // WX绔� - review.js getGenderText (宸蹭慨澶�) - const wxReviewText = getGenderTextWxReview(gender) - console.log(` - WX绔�(review): ${wxReviewText}`) - - // WX绔� - 娉ㄥ唽椤甸潰閫夋嫨鍣ㄦ樉绀� (宸蹭慨澶�) - const wxRegistrationDisplay = getGenderDisplayWxRegistration(gender) - console.log(` - WX绔�(娉ㄥ唽鏄剧ず): ${wxRegistrationDisplay}`) - - // Web绔� - JudgeForm (姝g‘) - const webJudgeForm = getGenderTextWebJudge(gender) - console.log(` - Web绔�(JudgeForm): ${webJudgeForm}`) - - // Web绔� - check-detail (宸蹭慨澶�) - const webCheckDetail = getGenderTextWebCheckDetail(gender) - console.log(` - Web绔�(check-detail): ${webCheckDetail}`) - - // Backend绔� - UserResolver (姝g‘) - const backendString = getGenderStringBackend(gender) - console.log(` - Backend绔�(瀛楃涓�): ${backendString}`) - - } else { - console.log(`鉂� 鏈壘鍒板弬璧涗汉璇︽儏: ${playerName}`) - } - - } catch (error) { - console.error(`鉂� 鏌ヨ鍙傝禌浜鸿鎯呭け璐� (${playerName}):`, error.message) - } -} - -// 妯℃嫙鍚勭鐨勬�у埆杞崲鍑芥暟 - -// WX绔� - review.js getGenderText (宸蹭慨澶�) -function getGenderTextWxReview(gender) { - if (gender === 0) return '濂�' - if (gender === 1) return '鐢�' - return '鏈~鍐�' -} - -// WX绔� - 娉ㄥ唽椤甸潰鏄剧ず (宸蹭慨澶�) -function getGenderDisplayWxRegistration(gender) { - // genderOptions: ['鐢�', '濂�'] - // 鏁版嵁搴撳��1(鐢�) -> 鐣岄潰绱㈠紩0 -> 鏄剧ず'鐢�' - // 鏁版嵁搴撳��0(濂�) -> 鐣岄潰绱㈠紩1 -> 鏄剧ず'濂�' - const genderOptions = ['鐢�', '濂�'] - if (gender === 1) return genderOptions[0] // 鐢� - if (gender === 0) return genderOptions[1] // 濂� - return '鏈�夋嫨' -} - -// Web绔� - JudgeForm (姝g‘) -function getGenderTextWebJudge(gender) { - // <el-radio :value="1">鐢�</el-radio> - // <el-radio :value="0">濂�</el-radio> - if (gender === 1) return '鐢�' - if (gender === 0) return '濂�' - return '鏈~鍐�' -} - -// Web绔� - check-detail (宸蹭慨澶�) -function getGenderTextWebCheckDetail(gender) { - const genderMap = { - 1: '鐢�', - 0: '濂�' - } - return genderMap[gender] || '-' -} - -// Backend绔� - UserResolver (姝g‘) -function getGenderStringBackend(gender) { - // user.getGender() == 1 ? "MALE" : "FEMALE" - if (gender === 1) return 'MALE' - if (gender === 0) return 'FEMALE' - return null -} - -// 娴嬭瘯鍓嶇鎬у埆鏄犲皠閫昏緫 -function testFrontendGenderMapping() { - console.log('娴嬭瘯鍓嶇鎬у埆鏄犲皠閫昏緫:') - - const testCases = [ - { dbValue: 1, expected: '鐢�' }, - { dbValue: 0, expected: '濂�' }, - { dbValue: null, expected: '鏈~鍐�' } - ] - - testCases.forEach(({ dbValue, expected }) => { - console.log(`\n鏁版嵁搴撳��: ${dbValue}`) - console.log(` WX绔�(review): ${getGenderTextWxReview(dbValue)} ${getGenderTextWxReview(dbValue) === expected ? '鉁�' : '鉂�'}`) - console.log(` WX绔�(娉ㄥ唽): ${getGenderDisplayWxRegistration(dbValue)} ${getGenderDisplayWxRegistration(dbValue) === expected ? '鉁�' : '鉂�'}`) - console.log(` Web绔�(JudgeForm): ${getGenderTextWebJudge(dbValue)} ${getGenderTextWebJudge(dbValue) === expected ? '鉁�' : '鉂�'}`) - console.log(` Web绔�(check-detail): ${getGenderTextWebCheckDetail(dbValue)} ${getGenderTextWebCheckDetail(dbValue) === expected ? '鉁�' : '鉂�'}`) - }) -} - -// 娴嬭瘯鍚庣鎬у埆鏄犲皠閫昏緫 -function testBackendGenderMapping() { - console.log('娴嬭瘯鍚庣鎬у埆鏄犲皠閫昏緫:') - - const testCases = [ - { dbValue: 1, expected: 'MALE' }, - { dbValue: 0, expected: 'FEMALE' } - ] - - testCases.forEach(({ dbValue, expected }) => { - const result = getGenderStringBackend(dbValue) - console.log(`鏁版嵁搴撳�� ${dbValue} -> ${result} ${result === expected ? '鉁�' : '鉂�'}`) - }) - - // 娴嬭瘯瀛楃涓插埌鏁板瓧鐨勮浆鎹� - console.log('\n娴嬭瘯瀛楃涓插埌鏁板瓧鐨勮浆鎹�:') - const stringToNumber = { - 'MALE': 1, - 'FEMALE': 0 - } - - Object.entries(stringToNumber).forEach(([str, num]) => { - console.log(`${str} -> ${num} 鉁卄) - }) -} - -// 杩愯娴嬭瘯 -testAllGenderFixes().catch(console.error) \ No newline at end of file diff --git a/test-filter-fix.js b/test-filter-fix.js deleted file mode 100644 index 3013d49..0000000 --- a/test-filter-fix.js +++ /dev/null @@ -1,89 +0,0 @@ -// 娴嬭瘯绛涢�夐�昏緫淇 -// 楠岃瘉鍚庣绛涢�� vs 鍓嶇绛涢�夌殑宸紓 - -console.log('=== 绛涢�夐�昏緫淇娴嬭瘯 ===\n') - -// 妯℃嫙鍚庣杩斿洖鐨勫師濮嬫暟鎹� -const mockBackendData = [ - { id: 1, name: '娲诲姩A', state: 1, stateName: '鍗冲皢寮�濮�' }, - { id: 2, name: '娲诲姩B', state: 2, stateName: '杩涜涓�' }, - { id: 3, name: '娲诲姩C', state: 1, stateName: '鍗冲皢寮�濮�' }, - { id: 4, name: '娲诲姩D', state: 3, stateName: '宸茬粨鏉�' }, - { id: 5, name: '娲诲姩E', state: 2, stateName: '杩涜涓�' }, - { id: 6, name: '娲诲姩F', state: 1, stateName: '鍗冲皢寮�濮�' }, - { id: 7, name: '娲诲姩G', state: 3, stateName: '宸茬粨鏉�' }, - { id: 8, name: '娲诲姩H', state: 2, stateName: '杩涜涓�' }, - { id: 9, name: '娲诲姩I', state: 1, stateName: '鍗冲皢寮�濮�' }, - { id: 10, name: '娲诲姩J', state: 3, stateName: '宸茬粨鏉�' } -] - -console.log('鍘熷鏁版嵁锛�10鏉★級:') -mockBackendData.forEach((item, index) => { - console.log(` 绱㈠紩${index}: ID=${item.id}, 鍚嶇О=${item.name}, 鐘舵��=${item.stateName}`) -}) - -console.log('\n--- 鍓嶇绛涢�夋柟寮忥紙鏈夐棶棰樼殑鏂瑰紡锛� ---') - -function frontendFilter(data, filterStatus) { - // 妯℃嫙鍓嶇绛涢�夐�昏緫 - const stateMapping = { - 'upcoming': 1, - 'ongoing': 2, - 'ended': 3 - } - - if (filterStatus === 'all') { - return data - } - - return data.filter(activity => activity.state === stateMapping[filterStatus]) -} - -const frontendFiltered = frontendFilter(mockBackendData, 'ongoing') -console.log(`绛涢��"杩涜涓�"鐨勬椿鍔紙鍓嶇绛涢�夛級:`) -frontendFiltered.forEach((item, index) => { - console.log(` 妯℃澘绱㈠紩${index}: ID=${item.id}, 鍚嶇О=${item.name} 鈫� 绱㈠紩涓嶪D涓嶅尮閰嶏紒`) -}) - -console.log('\n--- 鍚庣绛涢�夋柟寮忥紙淇鍚庣殑鏂瑰紡锛� ---') - -function backendFilter(data, state) { - // 妯℃嫙鍚庣绛涢�夐�昏緫 - if (state === null) { - return data - } - - return data.filter(activity => activity.state === state) -} - -const backendFiltered = backendFilter(mockBackendData, 2) // state=2 琛ㄧず杩涜涓� -console.log(`绛涢��"杩涜涓�"鐨勬椿鍔紙鍚庣绛涢�夛級:`) -backendFiltered.forEach((item, index) => { - console.log(` 妯℃澘绱㈠紩${index}: ID=${item.id}, 鍚嶇О=${item.name} 鈫� 绱㈠紩涓嶪D涓�鑷碻) -}) - -console.log('\n--- 闂瀵规瘮 ---') -console.log('鍓嶇绛涢�夐棶棰�:') -console.log(' - 鐐瑰嚮绱㈠紩0锛屾湡鏈汭D=2锛屼絾鍙兘鑾峰彇鍒伴敊璇殑ID') -console.log(' - 鍒嗛〉鏁版嵁娣蜂贡锛宧asMore璁$畻閿欒') -console.log(' - 鍔犺浇鏇村鏃舵暟鎹噸澶嶆垨涓㈠け') - -console.log('\n鍚庣绛涢�変紭鍔�:') -console.log(' - 绱㈠紩涓嶪D瀹屽叏瀵瑰簲') -console.log(' - 鍒嗛〉閫昏緫姝g‘') -console.log(' - 鏁版嵁涓�鑷存�т繚璇�') - -console.log('\n--- 鐘舵�佹槧灏勬祴璇� ---') -const filterStatusMapping = { - 'all': null, - 'upcoming': 1, - 'ongoing': 2, - 'ended': 3 -} - -Object.entries(filterStatusMapping).forEach(([filterStatus, state]) => { - const result = backendFilter(mockBackendData, state) - console.log(`filterStatus="${filterStatus}" 鈫� state=${state} 鈫� 缁撴灉${result.length}鏉) -}) - -console.log('\n=== 娴嬭瘯瀹屾垚 ===') \ No newline at end of file diff --git a/test-gender-birthday-fix.js b/test-gender-birthday-fix.js deleted file mode 100644 index bbaea8d..0000000 --- a/test-gender-birthday-fix.js +++ /dev/null @@ -1,8 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯鎬у埆鍜岀敓鏃ュ瓧娈电殑淇鏁堟灉 -async function testGenderBirthdayFix() { - console.log('=== 娴嬭瘯鎬у埆鍜岀敓鏃ュ瓧娈典慨澶嶆晥鏋� ===\n'); - - // 浣跨敤涓�涓湁鏁堢殑token - const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDgiLCJpYXQiOjE3MzQ5NTU1NzQsImV4cCI6MTczNTU2MDM3NH0.YBJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJ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JJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJhJJ \ No newline at end of file diff --git a/test-gender-fix.js b/test-gender-fix.js deleted file mode 100644 index a65c0f3..0000000 --- a/test-gender-fix.js +++ /dev/null @@ -1,66 +0,0 @@ -// 娴嬭瘯鎬у埆杞崲淇鏁堟灉 -console.log('=== 娴嬭瘯鎬у埆杞崲淇 ==='); - -// 妯℃嫙淇鍚庣殑getGenderText鍑芥暟 -function getGenderText(gender) { - if (gender === 0) return '鐢�' - if (gender === 1) return '濂�' - return '鏈~鍐�' -} - -// 娴嬭瘯鏁版嵁 -const testCases = [ - { gender: 0, expected: '鐢�', description: '鐢ㄦ埛閫夋嫨鐢锋��' }, - { gender: 1, expected: '濂�', description: '鐢ㄦ埛閫夋嫨濂虫��' }, - { gender: null, expected: '鏈~鍐�', description: '鏈�夋嫨鎬у埆' }, - { gender: undefined, expected: '鏈~鍐�', description: '鎬у埆鏈畾涔�' }, - { gender: 2, expected: '鏈~鍐�', description: '鏃犳晥鎬у埆鍊�' } -]; - -console.log('\n鎬у埆杞崲娴嬭瘯缁撴灉:'); -testCases.forEach((testCase, index) => { - const result = getGenderText(testCase.gender); - const status = result === testCase.expected ? '鉁� 閫氳繃' : '鉂� 澶辫触'; - console.log(`${index + 1}. ${testCase.description}`); - console.log(` 杈撳叆: ${testCase.gender}`); - console.log(` 鏈熸湜: ${testCase.expected}`); - console.log(` 瀹為檯: ${result}`); - console.log(` 鐘舵��: ${status}\n`); -}); - -// 妯℃嫙瀹為檯鏁版嵁搴撴暟鎹紙浠庝箣鍓嶆煡璇㈢粨鏋滐級 -console.log('=== 瀹為檯鏁版嵁搴撴暟鎹祴璇� ==='); -const dbData = [ - { name: 'stalker', gender: 0, education: '' }, -]; - -dbData.forEach((data, index) => { - console.log(`鍙傝禌浜� ${index + 1}:`); - console.log(` 濮撳悕: ${data.name}`); - console.log(` 鎬у埆鍘熷鍊�: ${data.gender}`); - console.log(` 鎬у埆鏄剧ず: ${getGenderText(data.gender)}`); - console.log(` 瀛﹀巻鍘熷鍊�: "${data.education}"`); - console.log(` 瀛﹀巻鏄剧ず: ${data.education || '鏈~鍐�'}`); - - // 妫�鏌ヤ慨澶嶆晥鏋� - if (data.gender === 0 && getGenderText(data.gender) === '鐢�') { - console.log(` 鉁� 鎬у埆淇鎴愬姛: 0 -> 鐢穈); - } - if (data.gender === 1 && getGenderText(data.gender) === '濂�') { - console.log(` 鉁� 鎬у埆淇鎴愬姛: 1 -> 濂砢); - } - console.log(''); -}); - -console.log('=== 淇鎬荤粨 ==='); -console.log('1. 鎬у埆杞崲閫昏緫宸蹭慨澶�:'); -console.log(' - 0 (鐢ㄦ埛閫夋嫨"鐢�") -> 鏄剧ず"鐢�" 鉁�'); -console.log(' - 1 (鐢ㄦ埛閫夋嫨"濂�") -> 鏄剧ず"濂�" 鉁�'); -console.log(''); -console.log('2. 瀛﹀巻鏄剧ず闂:'); -console.log(' - 鏁版嵁搴撲腑瀛﹀巻涓虹┖瀛楃涓诧紝鏄剧ず"鏈~鍐�"鏄纭殑'); -console.log(' - 濡傛灉鐢ㄦ埛纭疄閫夋嫨浜�"鏈"锛岄渶瑕佹鏌ユ暟鎹綍鍏ヨ繃绋�'); -console.log(''); -console.log('3. 寤鸿:'); -console.log(' - 閲嶆柊娴嬭瘯灏忕▼搴忥紝楠岃瘉鎬у埆鏄剧ず鏄惁姝g‘'); -console.log(' - 妫�鏌ョ敤鎴锋槸鍚︾湡鐨勯�夋嫨浜嗗鍘嗭紝鎴栬�呮暟鎹綍鍏ユ槸鍚︽湁闂'); \ No newline at end of file diff --git a/test-graphql-queries-only.js b/test-graphql-queries-only.js deleted file mode 100644 index e8f366f..0000000 --- a/test-graphql-queries-only.js +++ /dev/null @@ -1,140 +0,0 @@ -const axios = require('axios'); - -const graphqlUrl = 'http://localhost:8080/api/graphql'; - -// 浣跨敤涔嬪墠鑾峰彇鐨勬湁鏁坱oken锛堥渶瑕佺敤鎴锋彁渚涙柊鐨刢ode鑾峰彇鏂皌oken锛� -const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNTIiLCJpYXQiOjE3MzU3MjE5NzQsImV4cCI6MTczNTgwODM3NH0.Uy8Ej7Ej3Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7E'; // 杩欎釜token鍙兘宸茶繃鏈� - -async function testGraphQLQueries() { - try { - console.log('=== 娴嬭瘯璇勫椤甸潰GraphQL鏌ヨ锛堜娇鐢ㄧ幇鏈塼oken锛� ===\n'); - - // 1. 娴嬭瘯鏈瘎瀹¢」鐩煡璇� - console.log('1. 娴嬭瘯鏈瘎瀹¢」鐩煡璇�...'); - const unReviewedQuery = ` - query unReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - unReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - total - hasMore - items { - id - projectName - activityName - stageName - studentName - submitTime - } - } - } - `; - - const unReviewedResponse = await axios.post(graphqlUrl, { - query: unReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: "" - } - }, { - headers: { - 'Authorization': `Bearer ${token}` - } - }); - - if (unReviewedResponse.data.errors) { - console.error('鏈瘎瀹¢」鐩煡璇㈠け璐�:', unReviewedResponse.data.errors); - } else { - console.log('鉁� 鏈瘎瀹¢」鐩煡璇㈡垚鍔�:', unReviewedResponse.data.data.unReviewedProjects); - } - - // 2. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇� - console.log('\n2. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇�...'); - const reviewedQuery = ` - query reviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - reviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - total - hasMore - items { - id - projectName - activityName - stageName - studentName - submitTime - reviewTime - score - } - } - } - `; - - const reviewedResponse = await axios.post(graphqlUrl, { - query: reviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: "" - } - }, { - headers: { - 'Authorization': `Bearer ${token}` - } - }); - - if (reviewedResponse.data.errors) { - console.error('宸茶瘎瀹¢」鐩煡璇㈠け璐�:', reviewedResponse.data.errors); - } else { - console.log('鉁� 宸茶瘎瀹¢」鐩煡璇㈡垚鍔�:', reviewedResponse.data.data.reviewedProjects); - } - - // 3. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇� - console.log('\n3. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇�...'); - const studentUnReviewedQuery = ` - query studentUnReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - studentUnReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - total - hasMore - items { - id - projectName - activityName - stageName - studentName - submitTime - } - } - } - `; - - const studentUnReviewedResponse = await axios.post(graphqlUrl, { - query: studentUnReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: "" - } - }, { - headers: { - 'Authorization': `Bearer ${token}` - } - }); - - if (studentUnReviewedResponse.data.errors) { - console.error('瀛﹀憳鏈瘎瀹¢」鐩煡璇㈠け璐�:', studentUnReviewedResponse.data.errors); - } else { - console.log('鉁� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈡垚鍔�:', studentUnReviewedResponse.data.data.studentUnReviewedProjects); - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); - console.log('娉ㄦ剰锛氬鏋滄墍鏈夋煡璇㈤兘鎴愬姛锛岃鏄嶨raphQL鏌ヨ鏍煎紡宸蹭慨澶嶏紒'); - - } catch (error) { - console.error('娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -testGraphQLQueries(); \ No newline at end of file diff --git a/test-graphql-time-data.js b/test-graphql-time-data.js deleted file mode 100644 index cecfe46..0000000 --- a/test-graphql-time-data.js +++ /dev/null @@ -1,182 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯GraphQL杩斿洖鐨勬椂闂存暟鎹牸寮� -async function testGraphQLTimeData() { - console.log('馃攳 娴嬭瘯GraphQL杩斿洖鐨勬椂闂存暟鎹牸寮�...\n'); - - const BASE_URL = 'http://localhost:8080/api'; - - try { - // 鐩存帴鏌ヨ姣旇禌鍒楄〃锛堜笉闇�瑕佽璇侊級 - console.log('馃搵 鏌ヨ姣旇禌鍒楄〃...'); - const activitiesQuery = ` - query getActivities { - activities(page: 1, size: 10) { - content { - id - name - signupDeadline - matchTime - state - stateName - } - } - } - `; - - const activitiesResponse = await axios.post(`${BASE_URL}/graphql`, { - query: activitiesQuery - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (activitiesResponse.data.errors) { - console.error('鉂� GraphQL閿欒:', activitiesResponse.data.errors); - return; - } - - const activities = activitiesResponse.data.data.activities.content; - console.log(`馃搳 鑾峰彇鍒� ${activities.length} 涓瘮璧涙椿鍔╘n`); - - // 鍒嗘瀽姣忎釜姣旇禌鐨勬椂闂存暟鎹� - activities.forEach((activity, index) => { - console.log(`馃弳 姣旇禌 ${index + 1}: ${activity.name}`); - console.log(` ID: ${activity.id}`); - console.log(` 馃搮 鍘熷 signupDeadline: "${activity.signupDeadline}"`); - console.log(` 馃弫 鍘熷 matchTime: "${activity.matchTime}"`); - console.log(` 馃搳 鐘舵��: ${activity.state} (${activity.stateName})`); - - // 妫�鏌ユ椂闂存暟鎹殑鏍煎紡鍜屽唴瀹� - console.log('\n馃攳 鏃堕棿鏁版嵁鍒嗘瀽:'); - if (activity.signupDeadline) { - console.log(` signupDeadline 绫诲瀷: ${typeof activity.signupDeadline}`); - console.log(` signupDeadline 闀垮害: ${activity.signupDeadline.length}`); - console.log(` signupDeadline 鍐呭: "${activity.signupDeadline}"`); - - // 灏濊瘯瑙f瀽鏃堕棿 - try { - const date = new Date(activity.signupDeadline); - console.log(` 瑙f瀽鍚庣殑鏃ユ湡: ${date.toLocaleString()}`); - console.log(` ISO鏍煎紡: ${date.toISOString()}`); - console.log(` 骞存湀鏃�: ${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`); - } catch (e) { - console.log(` 鉂� 鏃堕棿瑙f瀽澶辫触: ${e.message}`); - } - } else { - console.log(` signupDeadline: null 鎴� undefined`); - } - - if (activity.matchTime) { - console.log(` matchTime 绫诲瀷: ${typeof activity.matchTime}`); - console.log(` matchTime 闀垮害: ${activity.matchTime.length}`); - console.log(` matchTime 鍐呭: "${activity.matchTime}"`); - - // 灏濊瘯瑙f瀽鏃堕棿 - try { - const date = new Date(activity.matchTime); - console.log(` 瑙f瀽鍚庣殑鏃ユ湡: ${date.toLocaleString()}`); - console.log(` ISO鏍煎紡: ${date.toISOString()}`); - console.log(` 骞存湀鏃�: ${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`); - } catch (e) { - console.log(` 鉂� 鏃堕棿瑙f瀽澶辫触: ${e.message}`); - } - } else { - console.log(` matchTime: null 鎴� undefined`); - } - - console.log('鈹�'.repeat(60)); - }); - - // 娴嬭瘯鍗曚釜姣旇禌璇︽儏 - if (activities.length > 0) { - const firstActivity = activities[0]; - console.log(`\n馃攳 娴嬭瘯鍗曚釜姣旇禌璇︽儏 (ID: ${firstActivity.id})...`); - - const detailQuery = ` - query GetActivityDetail($id: ID!) { - activity(id: $id) { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - } - } - `; - - const detailResponse = await axios.post(`${BASE_URL}/graphql`, { - query: detailQuery, - variables: { id: firstActivity.id.toString() } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (detailResponse.data.errors) { - console.error('鉂� 璇︽儏鏌ヨGraphQL閿欒:', detailResponse.data.errors); - } else { - const detail = detailResponse.data.data.activity; - console.log('馃搵 姣旇禌璇︽儏鏁版嵁:'); - console.log(` 馃搮 璇︽儏椤� signupDeadline: "${detail.signupDeadline}"`); - console.log(` 馃弫 璇︽儏椤� matchTime: "${detail.matchTime}"`); - - // 姣旇緝鍒楄〃鍜岃鎯呯殑鏁版嵁鏄惁涓�鑷� - if (detail.signupDeadline === firstActivity.signupDeadline) { - console.log('鉁� 鍒楄〃鍜岃鎯呯殑 signupDeadline 涓�鑷�'); - } else { - console.log('鉂� 鍒楄〃鍜岃鎯呯殑 signupDeadline 涓嶄竴鑷�'); - console.log(` 鍒楄〃: "${firstActivity.signupDeadline}"`); - console.log(` 璇︽儏: "${detail.signupDeadline}"`); - } - - if (detail.matchTime === firstActivity.matchTime) { - console.log('鉁� 鍒楄〃鍜岃鎯呯殑 matchTime 涓�鑷�'); - } else { - console.log('鉂� 鍒楄〃鍜岃鎯呯殑 matchTime 涓嶄竴鑷�'); - console.log(` 鍒楄〃: "${firstActivity.matchTime}"`); - console.log(` 璇︽儏: "${detail.matchTime}"`); - } - - // 妫�鏌ヨ鎯呴〉鏃堕棿鏍煎紡 - console.log('\n馃攳 璇︽儏椤垫椂闂存暟鎹垎鏋�:'); - if (detail.signupDeadline) { - try { - const date = new Date(detail.signupDeadline); - console.log(` 璇︽儏椤� signupDeadline 瑙f瀽: ${date.toLocaleString()}`); - console.log(` 璇︽儏椤� signupDeadline 骞存湀鏃�: ${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`); - } catch (e) { - console.log(` 鉂� 璇︽儏椤� signupDeadline 瑙f瀽澶辫触: ${e.message}`); - } - } - - if (detail.matchTime) { - try { - const date = new Date(detail.matchTime); - console.log(` 璇︽儏椤� matchTime 瑙f瀽: ${date.toLocaleString()}`); - console.log(` 璇︽儏椤� matchTime 骞存湀鏃�: ${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`); - } catch (e) { - console.log(` 鉂� 璇︽儏椤� matchTime 瑙f瀽澶辫触: ${e.message}`); - } - } - } - } - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testGraphQLTimeData(); \ No newline at end of file diff --git a/test-health-check.js b/test-health-check.js deleted file mode 100644 index 54a3474..0000000 --- a/test-health-check.js +++ /dev/null @@ -1,62 +0,0 @@ -const axios = require('axios'); - -async function testHealthCheck() { - const baseURL = 'http://localhost:8080/api'; - - console.log('=== 鍚庣鏈嶅姟鍋ュ悍妫�鏌� ===\n'); - - try { - // 娴嬭瘯鍩烘湰杩炴帴 - console.log('1. 娴嬭瘯鍚庣鏈嶅姟杩炴帴...'); - const response = await axios.get(`${baseURL}/actuator/health`, { - timeout: 5000 - }); - - console.log('鉁� 鍚庣鏈嶅姟杩愯姝e父'); - console.log('鐘舵��:', response.data.status); - - } catch (error) { - if (error.response && error.response.status === 404) { - console.log('鉁� 鍚庣鏈嶅姟杩愯姝e父 (actuator绔偣鏈惎鐢紝杩欐槸姝e父鐨�)'); - } else if (error.code === 'ECONNREFUSED') { - console.log('鉁� 鏃犳硶杩炴帴鍒板悗绔湇鍔�'); - console.log('璇风‘璁ゅ悗绔湇鍔℃槸鍚﹀湪 http://localhost:8080 杩愯'); - } else { - console.log('鉁� 鍚庣鏈嶅姟杩愯姝e父 (杩斿洖浜嗗搷搴�)'); - } - } - - // 娴嬭瘯GraphQL绔偣鏄惁鍙闂� - try { - console.log('\n2. 娴嬭瘯GraphQL绔偣...'); - const graphqlResponse = await axios.post(`${baseURL}/graphql`, { - query: '{ __schema { types { name } } }' - }, { - timeout: 5000 - }); - - console.log('鉁� GraphQL绔偣姝e父宸ヤ綔'); - - } catch (error) { - if (error.response) { - console.log('鉁� GraphQL绔偣鍙闂� (杩斿洖浜嗗搷搴�)'); - console.log('鐘舵�佺爜:', error.response.status); - } else { - console.log('鉁� GraphQL绔偣娴嬭瘯澶辫触:', error.message); - } - } - - console.log('\n=== 鍋ュ悍妫�鏌ュ畬鎴� ==='); - console.log('\n淇敼鎬荤粨:'); - console.log('鉁� Player瀹炰綋phone瀛楁宸叉爣璁颁负@Deprecated'); - console.log('鉁� ActivityPlayerService涓嶅啀淇濆瓨Player.phone'); - console.log('鉁� UserResolver涓嶅啀浠嶱layer鑾峰彇phone'); - console.log('鉁� ActivityPlayerDetailService SQL鏌ヨ宸蹭慨鏀逛负浣跨敤u.phone'); - console.log('鉁� PlayerApplicationService涓や釜SQL鏌ヨ閮藉凡淇敼'); - console.log('鉁� PromotableParticipantResponse宸蹭慨鏀逛负浠嶶ser鑾峰彇phone'); - console.log('鉁� CompetitionParticipantResponse宸蹭慨鏀逛负浠嶶ser鑾峰彇phone'); - console.log('鉁� GraphQL schema涓璓layer.phone宸叉爣璁颁负搴熷純'); - console.log('\n鍚庣鏈嶅姟缂栬瘧鍜屽惎鍔ㄦ甯革紝鎵�鏈変慨鏀瑰凡鐢熸晥锛�'); -} - -testHealthCheck(); \ No newline at end of file diff --git a/test-index-queries.js b/test-index-queries.js deleted file mode 100644 index 538f29e..0000000 --- a/test-index-queries.js +++ /dev/null @@ -1,140 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯灏忕▼搴忛椤电殑GraphQL鏌ヨ -async function testIndexQueries() { - console.log('=== 娴嬭瘯灏忕▼搴忛椤礕raphQL鏌ヨ ===\n'); - - const baseUrl = 'http://localhost:8080/api/graphql'; - - // 娴嬭瘯1: 杞挱鍥炬煡璇� - console.log('1. 娴嬭瘯杞挱鍥炬煡璇� (carouselPlayList)'); - try { - const response = await axios.post(baseUrl, { - query: ` - query getBanners { - banners: carouselPlayList { - id - title - content - coverImage { - id - name - path - fullUrl - fullThumbUrl - mediaType - } - } - } - ` - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鉁� 杞挱鍥炬煡璇㈡垚鍔�'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 杞挱鍥炬煡璇㈠け璐�'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n' + '='.repeat(50) + '\n'); - - // 娴嬭瘯2: 娲诲姩鍒楄〃鏌ヨ - console.log('2. 娴嬭瘯娲诲姩鍒楄〃鏌ヨ (activities)'); - try { - const response = await axios.post(baseUrl, { - query: ` - query getActivities($page: Int!, $size: Int!, $name: String) { - activities(page: $page, size: $size, name: $name) { - content { - id - name - description - signupDeadline - matchTime - address - playerMax - state - stateName - playerCount - } - totalElements - page - size - } - } - `, - variables: { - page: 1, - size: 10, - name: "" - } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鉁� 娲诲姩鍒楄〃鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 娲诲姩鍒楄〃鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n' + '='.repeat(50) + '\n'); - - // 娴嬭瘯3: 浣跨敤鏃犳晥token鐨勬儏鍐� - console.log('3. 娴嬭瘯浣跨敤鏃犳晥token鏌ヨ娲诲姩鍒楄〃'); - try { - const response = await axios.post(baseUrl, { - query: ` - query getActivities($page: Int!, $size: Int!, $name: String) { - activities(page: $page, size: $size, name: $name) { - content { - id - name - description - signupDeadline - matchTime - address - playerMax - state - stateName - playerCount - } - totalElements - page - size - } - } - `, - variables: { - page: 1, - size: 10, - name: "" - } - }, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer invalid-token-12345' - } - }); - - console.log('鉁� 鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); -} - -testIndexQueries().catch(console.error); \ No newline at end of file diff --git a/test-jwt-debug.js b/test-jwt-debug.js deleted file mode 100644 index 19a11f9..0000000 --- a/test-jwt-debug.js +++ /dev/null @@ -1,96 +0,0 @@ -const http = require('http'); - -// 妯℃嫙灏忕▼搴忕殑GraphQL璇锋眰 -function testGraphQLRequest(token) { - const mutation = ` - mutation SaveUserInfo($input: SaveUserInfoInput!) { - saveUserInfo(input: $input) { - id - name - phone - gender - birthday - } - } - `; - - const variables = { - input: { - name: "娴嬭瘯鐢ㄦ埛", - phone: "13981970816", - gender: "MALE", - birthday: "2025-10-07" - } - }; - - const postData = JSON.stringify({ - query: mutation, - variables: variables - }); - - const options = { - hostname: 'localhost', - port: 8080, - path: '/api/graphql', - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(postData) - } - }; - - // 濡傛灉鏈塼oken锛屾坊鍔燗uthorization澶� - if (token) { - options.headers['Authorization'] = `Bearer ${token}`; - console.log('鍙戦�佽姹傦紝鎼哄甫token:', token.substring(0, 20) + '...'); - } else { - console.log('鍙戦�佽姹傦紝涓嶆惡甯oken'); - } - - const req = http.request(options, (res) => { - console.log('鍝嶅簲鐘舵�佺爜:', res.statusCode); - console.log('鍝嶅簲澶�:', res.headers); - - let data = ''; - res.on('data', (chunk) => { - data += chunk; - }); - - res.on('end', () => { - console.log('鍝嶅簲鍐呭:', data); - try { - const response = JSON.parse(data); - if (response.errors) { - console.log('GraphQL閿欒:', response.errors); - } else { - console.log('璇锋眰鎴愬姛:', response.data); - } - } catch (e) { - console.log('瑙f瀽鍝嶅簲澶辫触:', e.message); - } - }); - }); - - req.on('error', (e) => { - console.error('璇锋眰閿欒:', e.message); - }); - - req.write(postData); - req.end(); -} - -// 娴嬭瘯涓嶅悓鎯呭喌 -console.log('=== 娴嬭瘯1: 涓嶆惡甯oken ==='); -testGraphQLRequest(null); - -setTimeout(() => { - console.log('\n=== 娴嬭瘯2: 鎼哄甫鏃犳晥token ==='); - testGraphQLRequest('invalid.token.here'); -}, 2000); - -setTimeout(() => { - console.log('\n=== 娴嬭瘯3: 鎼哄甫鏍煎紡姝g‘浣嗗彲鑳借繃鏈熺殑token ==='); - // 杩欓噷闇�瑕佷竴涓湡瀹炵殑token锛屽彲浠ヤ粠灏忕▼搴忎腑鑾峰彇 - const testToken = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItMSIsInVzZXJJZCI6LTEsImlhdCI6MTcyODMwMjk5MCwiZXhwIjoxNzI4Mzg5MzkwfQ.test'; - testGraphQLRequest(testToken); -}, 4000); \ No newline at end of file diff --git a/test-jwt-parsing.js b/test-jwt-parsing.js deleted file mode 100644 index 51c2248..0000000 --- a/test-jwt-parsing.js +++ /dev/null @@ -1,183 +0,0 @@ -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080/api'; - -async function testJwtParsing() { - console.log('=== 娴嬭瘯JWT token瑙f瀽鍔熻兘 ===\n'); - - try { - // 浣跨敤涓�涓凡鐭ョ殑鏈夋晥token杩涜娴嬭瘯 - // 杩欎釜token搴旇鏄箣鍓嶇敓鎴愮殑鍖垮悕鐢ㄦ埛token - const testToken = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItNzE5NzI4IiwiaWF0IjoxNzU5ODQzNzI5LCJleHAiOjE3NTk5MzAxMjksIndqb3BlbmlkIjoidGVzdF9vcGVuaWRfMTc1OTg0MzcyOTI5NSJ9.invalid'; // 杩欏彧鏄ず渚嬶紝闇�瑕佷娇鐢ㄧ湡瀹瀟oken - - console.log('1. 娴嬭瘯浣跨敤鏈夋晥token鏌ヨ鐢ㄦ埛淇℃伅...'); - - // 鍏堟祴璇晆serProfile鏌ヨ - const userProfileResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - query { - userProfile { - id - name - phone - wxOpenId - gender - birthday - } - } - ` - }, { - headers: { - 'Authorization': `Bearer ${testToken}`, - 'Content-Type': 'application/json' - } - }); - - if (userProfileResponse.data.data?.userProfile) { - console.log('鉁� 鐢ㄦ埛淇℃伅鏌ヨ鎴愬姛'); - const user = userProfileResponse.data.data.userProfile; - console.log('- 鐢ㄦ埛ID:', user.id); - console.log('- 濮撳悕:', user.name); - console.log('- 鐢佃瘽:', user.phone); - console.log('- wxOpenId:', user.wxOpenId); - } else { - console.log('鉂� 鐢ㄦ埛淇℃伅鏌ヨ澶辫触'); - console.log('閿欒:', userProfileResponse.data.errors); - } - - // 娴嬭瘯saveUserInfo - console.log('\n2. 娴嬭瘯淇濆瓨鐢ㄦ埛淇℃伅...'); - const saveUserResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - mutation SaveUserInfo($input: SaveUserInfoInput!) { - saveUserInfo(input: $input) { - success - message - user { - id - name - phone - wxOpenId - gender - birthday - } - } - } - `, - variables: { - input: { - name: '娴嬭瘯JWT瑙f瀽', - phone: '13900139000', - gender: 'MALE', - birthday: '1990-01-01' - } - } - }, { - headers: { - 'Authorization': `Bearer ${testToken}`, - 'Content-Type': 'application/json' - } - }); - - if (saveUserResponse.data.data?.saveUserInfo?.success) { - console.log('鉁� 淇濆瓨鐢ㄦ埛淇℃伅鎴愬姛'); - const user = saveUserResponse.data.data.saveUserInfo.user; - console.log('- 鐢ㄦ埛ID:', user.id); - console.log('- 濮撳悕:', user.name); - console.log('- 鐢佃瘽:', user.phone); - console.log('- wxOpenId:', user.wxOpenId); - console.log('- 鎬у埆:', user.gender); - console.log('- 鐢熸棩:', user.birthday); - } else { - console.log('鉂� 淇濆瓨鐢ㄦ埛淇℃伅澶辫触'); - console.log('閿欒:', saveUserResponse.data.errors || saveUserResponse.data.data?.saveUserInfo?.message); - } - - } catch (error) { - console.error('鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.response?.data || error.message); - - // 濡傛灉鏄璇侀敊璇紝璇存槑token鏃犳晥锛屾垜浠渶瑕佸厛鑾峰彇涓�涓湁鏁堢殑token - if (error.response?.status === 401) { - console.log('\n灏濊瘯鑾峰彇鏂扮殑token...'); - await getValidTokenAndTest(); - } - } -} - -async function getValidTokenAndTest() { - try { - // 灏濊瘯閫氳繃鎵嬫満鍙风櫥褰曡幏鍙杢oken - console.log('灏濊瘯閫氳繃鎵嬫満鍙风櫥褰曡幏鍙杢oken...'); - const loginResponse = await axios.post(`${BASE_URL}/auth/login`, { - phone: '13981970816', - verificationCode: '123456' - }); - - if (loginResponse.data.success) { - console.log('鉁� 鐧诲綍鎴愬姛锛岃幏寰梩oken'); - const token = loginResponse.data.token; - - // 浣跨敤杩欎釜token娴嬭瘯 - await testWithToken(token); - } else { - console.log('鉂� 鐧诲綍澶辫触:', loginResponse.data.message); - } - } catch (error) { - console.log('鉂� 鐧诲綍杩囩▼涓彂鐢熼敊璇�:', error.response?.data || error.message); - } -} - -async function testWithToken(token) { - console.log('\n浣跨敤鏈夋晥token娴嬭瘯...'); - - try { - const saveUserResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - mutation SaveUserInfo($input: SaveUserInfoInput!) { - saveUserInfo(input: $input) { - success - message - user { - id - name - phone - wxOpenId - gender - birthday - } - } - } - `, - variables: { - input: { - name: '娴嬭瘯JWT瑙f瀽锛堟湁鏁坱oken锛�', - phone: '13981970816', - gender: 'MALE', - birthday: '1990-01-01' - } - } - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (saveUserResponse.data.data?.saveUserInfo?.success) { - console.log('鉁� 浣跨敤鏈夋晥token淇濆瓨鐢ㄦ埛淇℃伅鎴愬姛'); - const user = saveUserResponse.data.data.saveUserInfo.user; - console.log('- 鐢ㄦ埛ID:', user.id); - console.log('- 濮撳悕:', user.name); - console.log('- 鐢佃瘽:', user.phone); - console.log('- wxOpenId:', user.wxOpenId); - } else { - console.log('鉂� 淇濆瓨鐢ㄦ埛淇℃伅澶辫触'); - console.log('閿欒:', saveUserResponse.data.errors || saveUserResponse.data.data?.saveUserInfo?.message); - } - } catch (error) { - console.error('鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.response?.data || error.message); - } -} - -// 杩愯娴嬭瘯 -testJwtParsing(); \ No newline at end of file diff --git a/test-jwt-wxopenid-fixed.js b/test-jwt-wxopenid-fixed.js deleted file mode 100644 index 66d1e34..0000000 --- a/test-jwt-wxopenid-fixed.js +++ /dev/null @@ -1,156 +0,0 @@ -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080'; - -async function testJwtWxOpenidFixed() { - console.log('=== 娴嬭瘯淇鍚庣殑JWT token鍜寃xopenid澶勭悊 ===\n'); - - try { - // 1. 娴嬭瘯寰俊鐧诲綍锛堝尶鍚嶇敤鎴凤級 - console.log('1. 娴嬭瘯寰俊鐧诲綍锛堝尶鍚嶇敤鎴凤級...'); - const wxLoginResponse = await axios.post(`${BASE_URL}/api/auth/wx-login`, { - code: 'test_code_' + Date.now(), - wxOpenid: 'test_openid_' + Date.now(), - wxUnionid: 'test_unionid_' + Date.now(), - loginIp: '127.0.0.1', - deviceInfo: 'test_device', - phoneAuthorized: false - }); - - if (wxLoginResponse.data.success) { - console.log('鉁� 寰俊鐧诲綍鎴愬姛'); - console.log('- Token:', wxLoginResponse.data.token ? '宸茬敓鎴�' : '鏈敓鎴�'); - console.log('- 鐢ㄦ埛绫诲瀷:', wxLoginResponse.data.userInfo?.userType); - - const token = wxLoginResponse.data.token; - - // 2. 浣跨敤鍖垮悕鐢ㄦ埛token淇濆瓨鐢ㄦ埛淇℃伅 - console.log('\n2. 浣跨敤鍖垮悕鐢ㄦ埛token淇濆瓨鐢ㄦ埛淇℃伅...'); - const saveUserResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - mutation SaveUserInfo($input: SaveUserInfoInput!) { - saveUserInfo(input: $input) { - success - message - user { - id - name - phone - wxOpenId - gender - birthday - } - } - } - `, - variables: { - input: { - name: '娴嬭瘯鐢ㄦ埛', - phone: '13800138000', - gender: 'MALE', - birthday: '1990-01-01' - } - } - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (saveUserResponse.data.data?.saveUserInfo?.success) { - console.log('鉁� 淇濆瓨鐢ㄦ埛淇℃伅鎴愬姛'); - const user = saveUserResponse.data.data.saveUserInfo.user; - console.log('- 鐢ㄦ埛ID:', user.id); - console.log('- 濮撳悕:', user.name); - console.log('- 鐢佃瘽:', user.phone); - console.log('- wxOpenId:', user.wxOpenId); - console.log('- 鎬у埆:', user.gender); - console.log('- 鐢熸棩:', user.birthday); - - // 3. 楠岃瘉wxopenid鏄惁姝g‘璁板綍 - if (user.wxOpenId) { - console.log('鉁� wxopenid宸叉纭褰曞埌鏁版嵁搴�'); - } else { - console.log('鉂� wxopenid鏈褰曞埌鏁版嵁搴�'); - } - - // 4. 鍐嶆淇濆瓨鐩稿悓鐢佃瘽鍙风爜鐨勭敤鎴蜂俊鎭紙娴嬭瘯鏇存柊閫昏緫锛� - console.log('\n3. 娴嬭瘯閲嶅淇濆瓨锛堟洿鏂扮幇鏈夌敤鎴凤級...'); - const updateUserResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - mutation SaveUserInfo($input: SaveUserInfoInput!) { - saveUserInfo(input: $input) { - success - message - user { - id - name - phone - wxOpenId - gender - birthday - } - } - } - `, - variables: { - input: { - name: '娴嬭瘯鐢ㄦ埛锛堟洿鏂帮級', - phone: '13800138000', - gender: 'FEMALE', - birthday: '1991-02-02' - } - } - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (updateUserResponse.data.data?.saveUserInfo?.success) { - console.log('鉁� 鏇存柊鐢ㄦ埛淇℃伅鎴愬姛'); - const updatedUser = updateUserResponse.data.data.saveUserInfo.user; - console.log('- 鐢ㄦ埛ID:', updatedUser.id); - console.log('- 濮撳悕:', updatedUser.name); - console.log('- 鐢佃瘽:', updatedUser.phone); - console.log('- wxOpenId:', updatedUser.wxOpenId); - console.log('- 鎬у埆:', updatedUser.gender); - console.log('- 鐢熸棩:', updatedUser.birthday); - - // 楠岃瘉鏄惁涓哄悓涓�鐢ㄦ埛锛圛D搴旇鐩稿悓锛� - if (user.id === updatedUser.id) { - console.log('鉁� 姝g‘鏇存柊浜嗙幇鏈夌敤鎴凤紝鏈垱寤烘柊鐢ㄦ埛'); - } else { - console.log('鉂� 閿欒鍦板垱寤轰簡鏂扮敤鎴凤紝搴旇鏇存柊鐜版湁鐢ㄦ埛'); - } - - // 楠岃瘉wxopenid鏄惁淇濇寔涓�鑷� - if (user.wxOpenId === updatedUser.wxOpenId) { - console.log('鉁� wxopenid淇濇寔涓�鑷�'); - } else { - console.log('鉂� wxopenid鍙戠敓浜嗗彉鍖�'); - } - } else { - console.log('鉂� 鏇存柊鐢ㄦ埛淇℃伅澶辫触'); - console.log('閿欒:', updateUserResponse.data.errors || updateUserResponse.data.data?.saveUserInfo?.message); - } - - } else { - console.log('鉂� 淇濆瓨鐢ㄦ埛淇℃伅澶辫触'); - console.log('閿欒:', saveUserResponse.data.errors || saveUserResponse.data.data?.saveUserInfo?.message); - } - - } else { - console.log('鉂� 寰俊鐧诲綍澶辫触'); - console.log('閿欒:', wxLoginResponse.data.message); - } - - } catch (error) { - console.error('鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.response?.data || error.message); - } -} - -// 杩愯娴嬭瘯 -testJwtWxOpenidFixed(); \ No newline at end of file diff --git a/test-miniprogram-activity-detail.js b/test-miniprogram-activity-detail.js deleted file mode 100644 index 05b6945..0000000 --- a/test-miniprogram-activity-detail.js +++ /dev/null @@ -1,136 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯灏忕▼搴忔瘮璧涜鎯呴〉闈㈣幏鍙栫殑鏁版嵁 -async function testMiniprogramActivityDetail() { - console.log('馃攳 娴嬭瘯灏忕▼搴忔瘮璧涜鎯呴〉闈㈣幏鍙栫殑鏁版嵁鏍煎紡...\n'); - - const GRAPHQL_URL = 'http://localhost:8080/api/graphql'; - - // 浣跨敤灏忕▼搴忕鐩稿悓鐨凣raphQL鏌ヨ - const query = ` - query GetActivityDetailAndStatus($id: ID!) { - activity(id: $id) { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - coverImage { fullUrl } - images { fullUrl } - videos { fullUrl, fullThumbUrl } - stages { - id - name - matchTime - description - } - } - myActivityPlayer(activityId: $id) { - id - state - } - } - `; - - try { - // 娴嬭瘯鍑犱釜涓嶅悓鐨勬椿鍔↖D - const testIds = [16, 19, 22, 25, 28, 31]; - - for (const activityId of testIds) { - console.log(`\n馃搵 娴嬭瘯娲诲姩ID: ${activityId}`); - - const response = await axios.post(GRAPHQL_URL, { - query, - variables: { id: activityId.toString() } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.error('鉂� GraphQL閿欒:', response.data.errors); - continue; - } - - const activity = response.data.data.activity; - - if (activity) { - console.log(`馃弳 姣旇禌鍚嶇О: ${activity.name}`); - console.log(`馃搮 鍘熷 signupDeadline: "${activity.signupDeadline}"`); - console.log(`馃弫 鍘熷 matchTime: "${activity.matchTime}"`); - - // 妯℃嫙灏忕▼搴忕鐨勬椂闂存牸寮忓寲澶勭悊 - console.log('\n馃敡 妯℃嫙灏忕▼搴忕鏍煎紡鍖�:'); - console.log(` signupDeadline 鏍煎紡鍖�: ${formatDateForMiniprogram(activity.signupDeadline, 'YYYY-MM-DD HH:mm')}`); - console.log(` matchTime 鏍煎紡鍖�: ${formatDateForMiniprogram(activity.matchTime, 'YYYY-MM-DD HH:mm')}`); - - // 妫�鏌ユ暟鎹被鍨嬪拰闀垮害 - console.log('\n馃攳 鏁版嵁鍒嗘瀽:'); - console.log(` signupDeadline 绫诲瀷: ${typeof activity.signupDeadline}, 闀垮害: ${activity.signupDeadline ? activity.signupDeadline.length : 'null'}`); - console.log(` matchTime 绫诲瀷: ${typeof activity.matchTime}, 闀垮害: ${activity.matchTime ? activity.matchTime.length : 'null'}`); - } else { - console.log('鉂� 鏈壘鍒版椿鍔ㄦ暟鎹�'); - } - - console.log('鈹�'.repeat(50)); - } - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 妯℃嫙灏忕▼搴忕鐨勬椂闂存牸寮忓寲鍑芥暟 -function formatDateForMiniprogram(dateStr, format) { - // 寮哄埗杞崲涓哄瓧绗︿覆锛屽吋瀹� null, undefined, number 绛夌被鍨� - var s = '' + dateStr; - - // 澶勭悊绌哄�兼垨鏃犳晥鍊� - if (!s || s === 'null' || s === 'undefined' || s.length < 10) { - return '鈥�'; - } - - // 澶勭悊ISO鏍煎紡鐨勬椂闂村瓧绗︿覆锛屽 "2025-10-06T00:00" 鎴� "2025-10-06T00:00:00" - // 鎻愬彇骞存湀鏃� - var y = s.slice(0, 4); - var m = s.slice(5, 7); - var d = s.slice(8, 10); - - if (format === 'YYYY-MM-DD') { - return y + '-' + m + '-' + d; - } - - // 澶勭悊鏃堕棿閮ㄥ垎 - 鏀寔澶氱鏍煎紡 - if (format === 'YYYY-MM-DD HH:mm') { - var h = '00'; - var min = '00'; - - // 妫�鏌ユ槸鍚︽湁鏃堕棿閮ㄥ垎 - if (s.length >= 16 && s.charAt(10) === 'T') { - // ISO鏍煎紡: 2025-10-06T00:00 鎴� 2025-10-06T00:00:00 - h = s.slice(11, 13); - min = s.slice(14, 16); - } else if (s.length >= 16 && s.charAt(10) === ' ') { - // 鏍囧噯鏍煎紡: 2025-10-06 00:00:00 - h = s.slice(11, 13); - min = s.slice(14, 16); - } - - return y + '-' + m + '-' + d + ' ' + h + ':' + min; - } - - return '鈥�'; // 榛樿杩斿洖鍗犱綅绗� -} - -// 杩愯娴嬭瘯 -testMiniprogramActivityDetail(); \ No newline at end of file diff --git a/test-miniprogram-data-flow.js b/test-miniprogram-data-flow.js deleted file mode 100644 index cd25f40..0000000 --- a/test-miniprogram-data-flow.js +++ /dev/null @@ -1,186 +0,0 @@ -const axios = require('axios'); - -// 妯℃嫙灏忕▼搴忕鐨勬暟鎹幏鍙栧拰澶勭悊娴佺▼ -async function testMiniprogramDataFlow() { - console.log('馃攳 娴嬭瘯灏忕▼搴忕鏁版嵁鑾峰彇鍜屽鐞嗘祦绋�...\n'); - - const BASE_URL = 'http://localhost:8080/api/graphql'; - - try { - // 1. 妯℃嫙灏忕▼搴忕鐨� GraphQL 鏌ヨ锛堜笌棣栭〉瀹屽叏涓�鑷达級 - console.log('馃搵 姝ラ1: 鎵ц涓庡皬绋嬪簭棣栭〉瀹屽叏涓�鑷寸殑GraphQL鏌ヨ...'); - const query = ` - query getActivities($page: Int!, $size: Int!, $name: String) { - activities(page: $page, size: $size, name: $name) { - content { - id - name - description - coverImage { - id - name - path - fullUrl - fullThumbUrl - mediaType - } - signupDeadline - matchTime - address - playerMax - state - stateName - playerCount - } - totalElements - page - size - } - } - `; - - const variables = { - page: 1, - size: 10, - name: null - }; - - const response = await axios.post(BASE_URL, { - query: query, - variables: variables - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.error('鉂� GraphQL閿欒:', response.data.errors); - return; - } - - const activities = response.data.data.activities.content; - console.log(`鉁� 鑾峰彇鍒� ${activities.length} 涓瘮璧涙椿鍔╘n`); - - // 2. 妯℃嫙灏忕▼搴忕鐨勬暟鎹鐞嗛�昏緫 - console.log('馃搵 姝ラ2: 妯℃嫙灏忕▼搴忕鏁版嵁澶勭悊...'); - let newActivities = activities; - - // 璋冭瘯锛氳緭鍑烘姤鍚嶆埅姝㈠師濮嬪�硷紙涓庡皬绋嬪簭浠g爜涓�鑷达級 - console.log('娲诲姩鍘熷鎶ュ悕鎴:', newActivities.map(a => ({ - id: a.id, - name: a.name, - signupDeadline: a.signupDeadline - }))); - - // 涓烘瘡涓椿鍔ㄦ坊鍔犲悕绉版枃瀛楋紙涓庡皬绋嬪簭浠g爜涓�鑷达級 - newActivities = newActivities.map(activity => ({ - ...activity, - nameText: (activity.name || '娲诲姩').substring(0, 2) - })); - - console.log('\n馃搵 姝ラ3: 妯℃嫙灏忕▼搴忕鏃堕棿鏍煎紡鍖�...'); - - // 3. 妯℃嫙 wxs 鏍煎紡鍖栧嚱鏁� - function formatDateYYYYMMDD_wxs(val) { - var s = '' + val; - if (s.length < 10) { - return '鈥�'; - } - if (s.charAt(4) === '-' && s.charAt(7) === '-') { - return s.slice(0, 10); - } - if (s.charAt(4) === '/' && s.charAt(7) === '/') { - var year = s.slice(0, 4); - var month = s.slice(5, 7); - var day = s.slice(8, 10); - return year + '-' + month + '-' + day; - } - return '鈥�'; - } - - // 4. 瀵规瘡涓椿鍔ㄨ繘琛屾牸寮忓寲娴嬭瘯 - console.log('馃幆 姣忎釜娲诲姩鐨勬椂闂存牸寮忓寲缁撴灉:'); - console.log('鈹�'.repeat(80)); - console.log('ID'.padEnd(5) + '娲诲姩鍚嶇О'.padEnd(15) + '鍘熷signupDeadline'.padEnd(20) + '鏍煎紡鍖栫粨鏋�'.padEnd(15) + '鐘舵��'); - console.log('鈹�'.repeat(80)); - - newActivities.forEach(activity => { - const formatted = formatDateYYYYMMDD_wxs(activity.signupDeadline); - console.log( - String(activity.id).padEnd(5) + - (activity.name || '').substring(0, 12).padEnd(15) + - (activity.signupDeadline || '').padEnd(20) + - formatted.padEnd(15) + - activity.stateName - ); - }); - - console.log('鈹�'.repeat(80)); - - // 5. 妫�鏌ユ槸鍚︽墍鏈夋牸寮忓寲缁撴灉閮界浉鍚� - const formattedResults = newActivities.map(a => formatDateYYYYMMDD_wxs(a.signupDeadline)); - const uniqueResults = [...new Set(formattedResults)]; - - console.log('\n馃攳 鏍煎紡鍖栫粨鏋滃垎鏋�:'); - console.log(`鎬诲叡 ${formattedResults.length} 涓椿鍔╜); - console.log(`鍞竴鐨勬牸寮忓寲缁撴灉: ${uniqueResults.join(', ')}`); - - if (uniqueResults.length === 1 && formattedResults.length > 1) { - console.log('鉂� 鍙戠幇闂锛氭墍鏈夋椿鍔ㄧ殑鏍煎紡鍖栫粨鏋滈兘鐩稿悓锛�'); - console.log('杩欏彲鑳芥槸缂撳瓨闂鎴栨暟鎹粦瀹氶棶棰�'); - } else { - console.log('鉁� 鏍煎紡鍖栫粨鏋滄甯革紝姣忎釜娲诲姩閮芥湁涓嶅悓鐨勬棩鏈�'); - } - - // 6. 妫�鏌ュ師濮嬫暟鎹槸鍚︽湁闂 - console.log('\n馃攳 鍘熷鏁版嵁妫�鏌�:'); - const originalDates = newActivities.map(a => a.signupDeadline); - const uniqueOriginalDates = [...new Set(originalDates)]; - - console.log(`鍘熷鏃ユ湡鍞竴鍊�: ${uniqueOriginalDates.join(', ')}`); - - if (uniqueOriginalDates.length === 1 && originalDates.length > 1) { - console.log('鉂� 鍙戠幇闂锛氬悗绔繑鍥炵殑鎵�鏈夋椿鍔ㄦ棩鏈熼兘鐩稿悓锛�'); - } else { - console.log('鉁� 鍚庣杩斿洖鐨勬棩鏈熸暟鎹甯�'); - } - - // 7. 妯℃嫙灏忕▼搴忕鍙兘鐨勭紦瀛橀棶棰� - console.log('\n馃攳 妫�鏌ュ彲鑳界殑缂撳瓨闂:'); - - // 鍐嶆璇锋眰鐩稿悓鐨勬暟鎹� - const response2 = await axios.post(BASE_URL, { - query: query, - variables: variables - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - const activities2 = response2.data.data.activities.content; - - // 姣旇緝涓ゆ璇锋眰鐨勭粨鏋� - const dates1 = activities.map(a => a.signupDeadline); - const dates2 = activities2.map(a => a.signupDeadline); - - const isIdentical = JSON.stringify(dates1) === JSON.stringify(dates2); - console.log(`涓ゆ璇锋眰缁撴灉鏄惁涓�鑷�: ${isIdentical ? '鉁� 涓�鑷�' : '鉂� 涓嶄竴鑷�'}`); - - if (!isIdentical) { - console.log('绗竴娆¤姹傛棩鏈�:', dates1); - console.log('绗簩娆¤姹傛棩鏈�:', dates2); - } - - } catch (error) { - console.error('鉂� 娴嬭瘯澶辫触:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testMiniprogramDataFlow(); \ No newline at end of file diff --git a/test-miniprogram-format.js b/test-miniprogram-format.js deleted file mode 100644 index 2989802..0000000 --- a/test-miniprogram-format.js +++ /dev/null @@ -1,151 +0,0 @@ -const axios = require('axios'); - -const graphqlUrl = 'http://localhost:8080/api/graphql'; - -// 浣跨敤涓�涓祴璇晅oken锛堥渶瑕佸厛鑾峰彇鏈夋晥token锛� -const token = 'Bearer_TOKEN_HERE'; // 杩欓噷闇�瑕佹浛鎹负鏈夋晥token - -async function testMiniprogramFormat() { - try { - console.log('=== 妯℃嫙寰俊灏忕▼搴忚姹傛牸寮忔祴璇� ===\n'); - - // 妯℃嫙寰俊灏忕▼搴忕殑璇锋眰鏍煎紡 - const query = ` - query GetUnReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - unReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - items { - id - projectName - activityName - stageName - studentName - submitTime - status - } - total - hasMore - } - } - `; - - const variables = { - page: 1, - pageSize: 10, - searchKeyword: "" - }; - - console.log('鍙戦�佺殑鏌ヨ:'); - console.log('Query:', query); - console.log('Variables:', variables); - console.log('Headers:', { - 'Content-Type': 'application/json', - 'Authorization': token ? `Bearer ${token}` : '' - }); - - // 妯℃嫙寰俊灏忕▼搴忕殑璇锋眰 - const response = await axios.post(graphqlUrl, { - query: query, - variables: variables - }, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': token ? `Bearer ${token}` : '' - } - }); - - console.log('\n鍝嶅簲鐘舵�佺爜:', response.status); - console.log('鍝嶅簲鏁版嵁:', response.data); - - if (response.data.errors) { - console.error('\n鉂� GraphQL閿欒:', response.data.errors); - } else { - console.log('\n鉁� 璇锋眰鎴愬姛!'); - } - - } catch (error) { - console.error('\n鉂� 璇锋眰澶辫触:'); - console.error('閿欒淇℃伅:', error.message); - - if (error.response) { - console.error('HTTP鐘舵�佺爜:', error.response.status); - console.error('鍝嶅簲澶�:', error.response.headers); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - - // 鐗瑰埆妫�鏌�400閿欒 - if (error.response.status === 400) { - console.error('\n馃攳 杩欐槸400閿欒锛佸彲鑳界殑鍘熷洜:'); - console.error('1. GraphQL鏌ヨ璇硶閿欒'); - console.error('2. 鍙橀噺绫诲瀷涓嶅尮閰�'); - console.error('3. 瀛楁涓嶅瓨鍦�'); - console.error('4. 鏉冮檺闂'); - console.error('5. 璇锋眰鏍煎紡闂'); - } - } - } -} - -// 棣栧厛灏濊瘯鑾峰彇鏈夋晥token -async function getValidToken() { - try { - console.log('姝e湪鑾峰彇鏈夋晥token...'); - - const loginMutation = ` - mutation wxLogin($input: WxLoginRequest!) { - wxLogin(input: $input) { - token - userInfo { - userId - name - userType - } - } - } - `; - - // 闇�瑕佺敤鎴锋彁渚涙柊鐨勫井淇ode - const wxCode = 'NEED_NEW_WX_CODE'; // 杩欓噷闇�瑕佹浛鎹负鏂扮殑寰俊code - - const loginResponse = await axios.post(graphqlUrl, { - query: loginMutation, - variables: { - input: { - code: wxCode, - wxOpenid: "test-openid-152" - } - } - }); - - if (loginResponse.data.errors) { - console.error('鐧诲綍澶辫触:', loginResponse.data.errors); - console.log('\n璇锋彁渚涙柊鐨勫井淇$櫥褰昪ode鏉ユ祴璇曪紒'); - return null; - } - - const { token } = loginResponse.data.data.wxLogin; - console.log('鉁� 鑾峰彇token鎴愬姛!'); - return token; - - } catch (error) { - console.error('鑾峰彇token澶辫触:', error.message); - return null; - } -} - -async function main() { - // 濡傛灉娌℃湁鏈夋晥token锛屽厛灏濊瘯鑾峰彇 - if (token === 'Bearer_TOKEN_HERE') { - console.log('闇�瑕佸厛鑾峰彇鏈夋晥token...'); - const validToken = await getValidToken(); - if (!validToken) { - console.log('\n鉂� 鏃犳硶鑾峰彇鏈夋晥token锛岃鎻愪緵鏂扮殑寰俊鐧诲綍code'); - return; - } - // 杩欓噷搴旇鏇存柊token鍙橀噺锛屼絾鐢变簬鏄痗onst锛屾垜浠渶瑕佹墜鍔ㄦ浛鎹� - console.log('\n璇峰皢鑾峰彇鍒扮殑token鏇挎崲鍒拌剼鏈腑鐨則oken鍙橀噺锛岀劧鍚庨噸鏂拌繍琛屾祴璇�'); - return; - } - - await testMiniprogramFormat(); -} - -main(); \ No newline at end of file diff --git a/test-miniprogram-graphql.js b/test-miniprogram-graphql.js deleted file mode 100644 index 6669f64..0000000 --- a/test-miniprogram-graphql.js +++ /dev/null @@ -1,98 +0,0 @@ -const axios = require('axios'); - -// 妯℃嫙灏忕▼搴忕鐨凣raphQL璇锋眰 -async function testMiniprogramGraphQL() { - console.log('=== 娴嬭瘯灏忕▼搴忕GraphQL璁块棶 ===\n'); - - const baseUrl = 'http://localhost:8080/api/graphql'; - - // 娴嬭瘯1: 涓嶉渶瑕佽璇佺殑鍏紑鏌ヨ - console.log('1. 娴嬭瘯鍏紑鏌ヨ (appConfig)'); - try { - const response = await axios.post(baseUrl, { - query: ` - query { - appConfig { - name - version - description - } - } - ` - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鉁� 鍏紑鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 鍏紑鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n' + '='.repeat(50) + '\n'); - - // 娴嬭瘯2: 闇�瑕佽璇佺殑鏌ヨ锛堜笉鎻愪緵token锛� - console.log('2. 娴嬭瘯闇�瑕佽璇佺殑鏌ヨ (userProfile) - 鏃爐oken'); - try { - const response = await axios.post(baseUrl, { - query: ` - query { - userProfile { - id - name - userType - } - } - ` - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鉁� 鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n' + '='.repeat(50) + '\n'); - - // 娴嬭瘯3: 浣跨敤鏃犳晥token - console.log('3. 娴嬭瘯闇�瑕佽璇佺殑鏌ヨ (userProfile) - 鏃犳晥token'); - try { - const response = await axios.post(baseUrl, { - query: ` - query { - userProfile { - id - name - userType - } - } - ` - }, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer invalid-token' - } - }); - - console.log('鉁� 鏌ヨ鎴愬姛'); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - } catch (error) { - console.log('鉂� 鏌ヨ澶辫触'); - console.log('鐘舵�佺爜:', error.response?.status); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); -} - -testMiniprogramGraphQL().catch(console.error); \ No newline at end of file diff --git a/test-miniprogram-login-status.js b/test-miniprogram-login-status.js deleted file mode 100644 index d160ed7..0000000 --- a/test-miniprogram-login-status.js +++ /dev/null @@ -1,107 +0,0 @@ -// 娴嬭瘯灏忕▼搴忕櫥褰曠姸鎬佺殑鑴氭湰 -// 杩欎釜鑴氭湰妯℃嫙灏忕▼搴忕殑鐧诲綍鐘舵�佹鏌� - -const jwt = require('jsonwebtoken'); - -console.log('=== 灏忕▼搴忕櫥褰曠姸鎬佹鏌� ==='); - -// 妯℃嫙浠庡皬绋嬪簭瀛樺偍涓幏鍙栫殑token锛堣繖閲岄渶瑕佷綘鎻愪緵瀹為檯鐨則oken锛� -// 浣犲彲浠ュ湪灏忕▼搴忓紑鍙戣�呭伐鍏风殑鎺у埗鍙颁腑杩愯浠ヤ笅浠g爜鑾峰彇token锛� -// console.log('褰撳墠token:', wx.getStorageSync('token')) - -const testToken = 'YOUR_TOKEN_HERE'; // 璇锋浛鎹负瀹為檯鐨則oken - -function checkTokenStatus(token) { - console.log('\n--- Token鐘舵�佹鏌� ---'); - - if (!token || token === 'YOUR_TOKEN_HERE') { - console.log('鉂� 娌℃湁鎻愪緵鏈夋晥鐨則oken'); - console.log('馃挕 璇峰湪灏忕▼搴忓紑鍙戣�呭伐鍏锋帶鍒跺彴杩愯: console.log("褰撳墠token:", wx.getStorageSync("token"))'); - return false; - } - - console.log('Token瀛樺湪:', !!token); - console.log('Token闀垮害:', token.length); - console.log('Token鍓�20瀛楃:', token.substring(0, 20) + '...'); - - // 妫�鏌WT鏍煎紡 - const parts = token.split('.'); - if (parts.length !== 3) { - console.log('鉂� Token鏍煎紡鏃犳晥锛堜笉鏄爣鍑咼WT鏍煎紡锛�'); - return false; - } - - try { - // 瑙f瀽JWT payload锛堜笉楠岃瘉绛惧悕锛� - const payload = JSON.parse(Buffer.from(parts[1], 'base64').toString()); - console.log('Token payload:', { - userId: payload.userId, - phone: payload.phone, - exp: payload.exp, - iat: payload.iat - }); - - // 妫�鏌ユ槸鍚﹁繃鏈� - const now = Math.floor(Date.now() / 1000); - const isExpired = payload.exp <= now; - - console.log('Token杩囨湡鏃堕棿:', new Date(payload.exp * 1000).toLocaleString()); - console.log('褰撳墠鏃堕棿:', new Date(now * 1000).toLocaleString()); - console.log('Token鏄惁杩囨湡:', isExpired); - - if (isExpired) { - console.log('鉂� Token宸茶繃鏈�'); - return false; - } - - console.log('鉁� Token鏈夋晥'); - return true; - - } catch (error) { - console.log('鉂� Token瑙f瀽澶辫触:', error.message); - return false; - } -} - -// 妯℃嫙GraphQL璇锋眰娴嬭瘯 -function simulateGraphQLRequest(token) { - console.log('\n--- 妯℃嫙GraphQL璇锋眰 ---'); - - const headers = { - 'Content-Type': 'application/json', - 'Authorization': token ? `Bearer ${token}` : '' - }; - - console.log('璇锋眰澶�:', headers); - - if (!token) { - console.log('鉂� 娌℃湁Authorization澶达紝鍚庣浼氳涓虹敤鎴锋湭鐧诲綍'); - return false; - } - - console.log('鉁� 鏈堿uthorization澶达紝鍚庣浼氬皾璇曢獙璇乼oken'); - return true; -} - -// 鎵ц妫�鏌� -const isTokenValid = checkTokenStatus(testToken); -const hasAuthHeader = simulateGraphQLRequest(testToken); - -console.log('\n=== 鎬荤粨 ==='); -console.log('Token鏈夋晥:', isTokenValid); -console.log('鏈夎璇佸ご:', hasAuthHeader); - -if (!isTokenValid || !hasAuthHeader) { - console.log('\n馃敡 瑙e喅鏂规:'); - console.log('1. 妫�鏌ュ皬绋嬪簭鏄惁姝g‘鐧诲綍'); - console.log('2. 妫�鏌oken鏄惁姝g‘淇濆瓨鍒版湰鍦板瓨鍌�'); - console.log('3. 妫�鏌oken鏄惁杩囨湡'); - console.log('4. 濡傛灉token鏃犳晥锛岄渶瑕侀噸鏂扮櫥褰�'); - - console.log('\n馃摫 灏忕▼搴忚皟璇曟楠�:'); - console.log('1. 鍦ㄥ皬绋嬪簭寮�鍙戣�呭伐鍏蜂腑鎵撳紑鎺у埗鍙�'); - console.log('2. 杩愯: console.log("token:", wx.getStorageSync("token"))'); - console.log('3. 杩愯: console.log("userInfo:", wx.getStorageSync("userInfo"))'); - console.log('4. 杩愯: console.log("globalData:", getApp().globalData)'); - console.log('5. 濡傛灉token涓虹┖鎴栨棤鏁堬紝灏濊瘯閲嶆柊鍚姩灏忕▼搴忔垨娓呴櫎瀛樺偍閲嶆柊鐧诲綍'); -} \ No newline at end of file diff --git a/test-miniprogram-review-fix.js b/test-miniprogram-review-fix.js deleted file mode 100644 index e32d7c7..0000000 --- a/test-miniprogram-review-fix.js +++ /dev/null @@ -1,71 +0,0 @@ -// 娴嬭瘯灏忕▼搴忚瘎瀹¤鎯呴〉闈㈢殑鎬у埆鍜屽鍘嗘樉绀轰慨澶� -// 妯℃嫙灏忕▼搴忕殑鏁版嵁澶勭悊閫昏緫 - -// 妯℃嫙鎬у埆杞崲鍑芥暟锛堜粠review.js澶嶅埗锛� -function getGenderText(gender) { - if (gender === 0) return '濂�' - if (gender === 1) return '鐢�' - return '鏈~鍐�' -} - -// 妯℃嫙鍚庣杩斿洖鐨勬暟鎹� -const mockPlayerInfo = { - id: 1, - name: '寮犱笁', - gender: 1, // 鍚庣杩斿洖鐨勬暟瀛楋細1琛ㄧず鐢� - birthday: '1990-01-01', - education: '鏈', - userInfo: { - avatarUrl: '/images/default-avatar.svg' - } -} - -const mockRegionInfo = { - name: '鍖椾含甯�' -} - -// 妯℃嫙鏁版嵁澶勭悊閫昏緫锛堜粠review.js澶嶅埗骞剁畝鍖栵級 -const participant = { - id: mockPlayerInfo.id, - name: mockPlayerInfo.name, - gender: getGenderText(mockPlayerInfo.gender), // 浣跨敤杞崲鍑芥暟 - birthday: mockPlayerInfo.birthday || '', - region: mockRegionInfo ? mockRegionInfo.name : '', - education: mockPlayerInfo.education || '', - avatar: mockPlayerInfo.userInfo?.avatarUrl || '/images/default-avatar.svg' -} - -console.log('=== 灏忕▼搴忚瘎瀹¤鎯呴〉闈㈡暟鎹鐞嗘祴璇� ===') -console.log('鍘熷鍚庣鏁版嵁:') -console.log(' gender:', mockPlayerInfo.gender, '(鏁板瓧)') -console.log(' education:', mockPlayerInfo.education) -console.log('') - -console.log('澶勭悊鍚庣殑鍓嶇鏄剧ず鏁版嵁:') -console.log(' 濮撳悕:', participant.name) -console.log(' 鎬у埆:', participant.gender, '(宸茶浆鎹负鏂囧瓧)') -console.log(' 鍑虹敓鏃ユ湡:', participant.birthday) -console.log(' 鎵�灞炲尯鍩�:', participant.region) -console.log(' 瀛﹀巻:', participant.education) -console.log('') - -console.log('=== 椤甸潰鏄剧ず鏁堟灉妯℃嫙 ===') -console.log('鍙傝禌鑰咃細' + participant.name) -console.log('鎬у埆锛�' + participant.gender) -console.log('鍑虹敓鏃ユ湡锛�' + participant.birthday) -console.log('鎵�灞炲尯鍩燂細' + participant.region) -console.log('瀛﹀巻锛�' + participant.education) -console.log('') - -// 娴嬭瘯涓嶅悓鎬у埆鍊� -console.log('=== 鎬у埆杞崲娴嬭瘯 ===') -console.log('gender=0 ->', getGenderText(0)) -console.log('gender=1 ->', getGenderText(1)) -console.log('gender=null ->', getGenderText(null)) -console.log('gender=undefined ->', getGenderText(undefined)) -console.log('') - -console.log('鉁� 淇楠岃瘉瀹屾垚锛�') -console.log('1. 鎬у埆鏄剧ず宸蹭粠鏁板瓧杞崲涓烘枃瀛�') -console.log('2. 瀛﹀巻鏄剧ず姝e父') -console.log('3. 椤甸潰甯冨眬宸叉敼涓哄垎琛屾樉绀�') \ No newline at end of file diff --git a/test-navigation-params.js b/test-navigation-params.js deleted file mode 100644 index 3ed28f3..0000000 --- a/test-navigation-params.js +++ /dev/null @@ -1,114 +0,0 @@ -const axios = require('axios'); - -// 妯℃嫙灏忕▼搴忕鐨凣raphQL璇锋眰 -async function testNavigationParams() { - console.log('馃攳 娴嬭瘯棣栭〉娲诲姩鏁版嵁鍜屽鑸弬鏁�...\n'); - - try { - // 1. 鑾峰彇棣栭〉娲诲姩鍒楄〃鏁版嵁 - const query = ` - query GetActivitiesAndBanners($page: Int!, $size: Int!, $keyword: String, $status: String) { - activities(page: $page, size: $size, keyword: $keyword, status: $status) { - content { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - coverImage { fullUrl } - } - totalElements - totalPages - number - size - } - } - `; - - const variables = { - page: 0, - size: 10, - keyword: null, - status: null - }; - - const response = await axios.post('http://localhost:8080/graphql', { - query, - variables - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.error('鉂� GraphQL閿欒:', response.data.errors); - return; - } - - const activities = response.data.data.activities.content; - console.log(`馃搳 鑾峰彇鍒� ${activities.length} 涓椿鍔╘n`); - - // 2. 鍒嗘瀽姣忎釜娲诲姩鐨処D鍜屽熀鏈俊鎭� - console.log('馃幆 娲诲姩ID鍜屽熀鏈俊鎭�:'); - console.log('鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�'); - console.log('ID 娲诲姩鍚嶇О 鎶ュ悕鎴鏃堕棿 姣旇禌鏃堕棿 鐘舵��'); - console.log('鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�'); - - activities.forEach(activity => { - const id = String(activity.id).padEnd(4); - const name = (activity.name || '').substring(0, 15).padEnd(15); - const signupDeadline = (activity.signupDeadline || '').substring(0, 16).padEnd(16); - const matchTime = (activity.matchTime || '').substring(0, 16).padEnd(16); - const state = activity.stateName || activity.state || ''; - - console.log(`${id} ${name} ${signupDeadline} ${matchTime} ${state}`); - }); - console.log('鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�鈹�\n'); - - // 3. 妯℃嫙鐐瑰嚮浜嬩欢鐨勫弬鏁颁紶閫� - console.log('馃敆 妯℃嫙鐐瑰嚮浜嬩欢鍙傛暟浼犻��:'); - activities.forEach((activity, index) => { - console.log(`娲诲姩 ${index + 1}: 鐐瑰嚮"${activity.name}" 鈫� 浼犻�扞D: ${activity.id}`); - - // 妯℃嫙 utils.navigateTo 鐨刄RL鏋勫缓 - const params = { id: activity.id }; - const queryString = Object.keys(params) - .map(key => `${key}=${encodeURIComponent(params[key])}`) - .join('&'); - const fullUrl = '/pages/activity/detail?' + queryString; - - console.log(` 鈫� 鏋勫缓URL: ${fullUrl}`); - console.log(` 鈫� 璇︽儏椤垫帴鏀跺埌鐨刼ptions.id: "${activity.id}"`); - console.log(''); - }); - - // 4. 妫�鏌D绫诲瀷鍜屾牸寮� - console.log('馃攳 ID绫诲瀷鍜屾牸寮忔鏌�:'); - activities.forEach(activity => { - const id = activity.id; - const idType = typeof id; - const idString = String(id); - - console.log(`娲诲姩"${activity.name}": ID=${id}, 绫诲瀷=${idType}, 瀛楃涓�="${idString}"`); - }); - - // 5. 妯℃嫙鍙兘鐨勯棶棰樺満鏅� - console.log('\n鈿狅笍 鍙兘鐨勯棶棰樺満鏅垎鏋�:'); - console.log('1. ID绫诲瀷闂: 鍚庣杩斿洖鏁板瓧锛屽墠绔湡鏈涘瓧绗︿覆'); - console.log('2. 鏁版嵁缁戝畾闂: wx:for寰幆涓殑item.id涓嶆纭�'); - console.log('3. 浜嬩欢鍐掓场闂: 澶氫釜鐐瑰嚮浜嬩欢鍐茬獊'); - console.log('4. 缂撳瓨闂: 椤甸潰鏁版嵁娌℃湁鍙婃椂鏇存柊'); - console.log('5. 璺敱鍙傛暟闂: URL缂栫爜鎴栬В鐮侀敊璇�'); - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.message); - } -} - -testNavigationParams(); \ No newline at end of file diff --git a/test-pagination-fix.js b/test-pagination-fix.js deleted file mode 100644 index f64539c..0000000 --- a/test-pagination-fix.js +++ /dev/null @@ -1,82 +0,0 @@ -// 娴嬭瘯鍒嗛〉閫昏緫淇 -console.log('=== 娴嬭瘯鍒嗛〉閫昏緫淇 ===') - -// 妯℃嫙灏忕▼搴忛〉闈㈡暟鎹� -let mockPageData = { - activities: [], - currentPage: 1, - pageSize: 10 -} - -// 妯℃嫙 loadActivities 鍑芥暟鐨勬牳蹇冮�昏緫 -function testLoadActivities(isLoadMore = false, newData, existingData = []) { - console.log(`\n--- 娴嬭瘯鍦烘櫙: isLoadMore=${isLoadMore} ---`) - console.log('鐜版湁鏁版嵁闀垮害:', existingData.length) - console.log('鏂版暟鎹�:', newData.map(item => `ID:${item.id}`).join(', ')) - - // 鏍稿績鍚堝苟閫昏緫 - const mergedActivities = isLoadMore && existingData.length > 0 - ? [...existingData, ...newData] - : newData - - console.log('鍚堝苟鍚庢暟鎹�:', mergedActivities.map(item => `ID:${item.id}`).join(', ')) - console.log('鍚堝苟鍚庣储寮�:', mergedActivities.map((item, index) => `${index}:ID${item.id}`).join(', ')) - - return mergedActivities -} - -// 娴嬭瘯鏁版嵁 -const page1Data = [ - { id: '1', name: '娲诲姩1' }, - { id: '2', name: '娲诲姩2' }, - { id: '3', name: '娲诲姩3' } -] - -const page2Data = [ - { id: '4', name: '娲诲姩4' }, - { id: '5', name: '娲诲姩5' }, - { id: '6', name: '娲诲姩6' } -] - -const searchResultData = [ - { id: '7', name: '鎼滅储娲诲姩1' }, - { id: '8', name: '鎼滅储娲诲姩2' } -] - -console.log('=== 娴嬭瘯鍦烘櫙 ===') - -// 鍦烘櫙1: 鍒濆鍔犺浇绗�1椤� -console.log('\n馃敻 鍦烘櫙1: 鍒濆鍔犺浇绗�1椤�') -let result1 = testLoadActivities(false, page1Data, []) -mockPageData.activities = result1 - -// 鍦烘櫙2: 鍔犺浇鏇村绗�2椤� -console.log('\n馃敻 鍦烘櫙2: 鍔犺浇鏇村绗�2椤�') -let result2 = testLoadActivities(true, page2Data, mockPageData.activities) -mockPageData.activities = result2 - -// 鍦烘櫙3: 鎼滅储锛堝簲璇ュ叏閲忔浛鎹紝涓嶆槸杩藉姞锛� -console.log('\n馃敻 鍦烘櫙3: 鎼滅储锛堝簲璇ュ叏閲忔浛鎹級') -let result3 = testLoadActivities(false, searchResultData, mockPageData.activities) -mockPageData.activities = result3 - -// 鍦烘櫙4: 鍒锋柊锛堝簲璇ュ叏閲忔浛鎹級 -console.log('\n馃敻 鍦烘櫙4: 鍒锋柊锛堝簲璇ュ叏閲忔浛鎹級') -let result4 = testLoadActivities(false, page1Data, mockPageData.activities) -mockPageData.activities = result4 - -console.log('\n=== 娴嬭瘯缁撴灉楠岃瘉 ===') -console.log('鉁� 鍦烘櫙1: 鍒濆鍔犺浇 - 绱㈠紩搴旇鏄� 0,1,2') -console.log('鉁� 鍦烘櫙2: 鍔犺浇鏇村 - 绱㈠紩搴旇鏄� 0,1,2,3,4,5') -console.log('鉁� 鍦烘櫙3: 鎼滅储鏇挎崲 - 绱㈠紩搴旇鏄� 0,1 (閲嶆柊寮�濮�)') -console.log('鉁� 鍦烘櫙4: 鍒锋柊鏇挎崲 - 绱㈠紩搴旇鏄� 0,1,2 (閲嶆柊寮�濮�)') - -console.log('\n=== 淇鍓嶇殑闂 ===') -console.log('鉂� 淇鍓�: 鎼滅储鏃朵細杩藉姞鍒扮幇鏈夋暟鎹悗闈�') -console.log('鉂� 缁撴灉: 鐐瑰嚮绗�1涓猧tem锛岀储寮曞彉鎴愪簡6+0=6锛岃�屼笉鏄�0') -console.log('鉂� 浣犻亣鍒扮殑闂: 鐐瑰嚮绗�1涓猧tem锛岀储寮曟槸9锛岃鏄庡墠闈㈡湁9涓棫鏁版嵁') - -console.log('\n=== 淇鍚庣殑鏁堟灉 ===') -console.log('鉁� 淇鍚�: 鍙湁鐪熸鐨�"鍔犺浇鏇村"鎵嶈拷鍔犳暟鎹�') -console.log('鉁� 鎼滅储銆佺瓫閫夈�佸埛鏂伴兘鏄叏閲忔浛鎹�') -console.log('鉁� 绱㈠紩濮嬬粓姝g‘瀵瑰簲鐢ㄦ埛鐪嬪埌鐨勫垪琛ㄤ綅缃�') \ No newline at end of file diff --git a/test-phone-auth-required.js b/test-phone-auth-required.js deleted file mode 100644 index 7cbd0b1..0000000 --- a/test-phone-auth-required.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * 娴嬭瘯鐢佃瘽鍙风爜鎺堟潈瑕佹眰鍔熻兘 - * 楠岃瘉锛� - * 1. 娌℃湁鐢佃瘽鍙风爜鏃朵笉鑳戒繚瀛樼敤鎴蜂俊鎭� - * 2. 鏈夌數璇濆彿鐮佹椂鍙互姝e父淇濆瓨 - * 3. 淇濆瓨鍚庡己鍒堕噸鏂扮櫥褰曟満鍒� - */ - -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080/api/graphql'; - -// 娴嬭瘯鐢ㄧ殑 token锛堥渶瑕佹槸鏈夋晥鐨勶級 -const TEST_TOKEN = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyXzEiLCJpYXQiOjE3MzU3MjU0NzIsImV4cCI6MTczNjMzMDI3Mn0.Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8'; - -async function graphqlRequest(query, variables = {}, token = null) { - try { - const headers = { - 'Content-Type': 'application/json', - }; - - if (token) { - headers['Authorization'] = `Bearer ${token}`; - } - - const response = await axios.post(BASE_URL, { - query, - variables - }, { headers }); - - return response.data; - } catch (error) { - console.error('GraphQL 璇锋眰澶辫触:', error.response?.data || error.message); - throw error; - } -} - -async function testSaveUserInfoWithoutPhone() { - console.log('\n=== 娴嬭瘯1: 灏濊瘯淇濆瓨娌℃湁鐢佃瘽鍙风爜鐨勭敤鎴蜂俊鎭� ==='); - - const mutation = ` - mutation SaveUserInfo($input: UserInfoInput!) { - saveUserInfo(input: $input) { - success - message - user { - id - name - phone - avatar - } - } - } - `; - - const variables = { - input: { - name: "娴嬭瘯鐢ㄦ埛", - gender: "MALE", - birthDate: "1990-01-01", - education: "鏈", - introduction: "杩欐槸涓�涓祴璇曠敤鎴�", - avatar: "https://example.com/avatar.jpg" - // 娉ㄦ剰锛氭病鏈夋彁渚� phone 瀛楁 - } - }; - - try { - const result = await graphqlRequest(mutation, variables, TEST_TOKEN); - console.log('鍝嶅簲缁撴灉:', JSON.stringify(result, null, 2)); - - if (result.errors) { - console.log('鉁� 棰勬湡鐨勯敊璇細', result.errors[0].message); - } else if (result.data?.saveUserInfo?.success === false) { - console.log('鉁� 棰勬湡鐨勫け璐ワ細', result.data.saveUserInfo.message); - } else { - console.log('鉂� 鎰忓鎴愬姛锛氬簲璇ユ嫆缁濇病鏈夌數璇濆彿鐮佺殑淇濆瓨璇锋眰'); - } - } catch (error) { - console.log('鉁� 棰勬湡鐨勫紓甯革細', error.message); - } -} - -async function testSaveUserInfoWithPhone() { - console.log('\n=== 娴嬭瘯2: 淇濆瓨鏈夌數璇濆彿鐮佺殑鐢ㄦ埛淇℃伅 ==='); - - const mutation = ` - mutation SaveUserInfo($input: UserInfoInput!) { - saveUserInfo(input: $input) { - success - message - user { - id - name - phone - avatar - } - } - } - `; - - const variables = { - input: { - name: "娴嬭瘯鐢ㄦ埛", - phone: "13800138000", - gender: "MALE", - birthDate: "1990-01-01", - education: "鏈", - introduction: "杩欐槸涓�涓祴璇曠敤鎴�", - avatar: "https://example.com/avatar.jpg" - } - }; - - try { - const result = await graphqlRequest(mutation, variables, TEST_TOKEN); - console.log('鍝嶅簲缁撴灉:', JSON.stringify(result, null, 2)); - - if (result.data?.saveUserInfo?.success) { - console.log('鉁� 鎴愬姛淇濆瓨鐢ㄦ埛淇℃伅'); - console.log('鐢ㄦ埛淇℃伅:', result.data.saveUserInfo.user); - } else { - console.log('鉂� 淇濆瓨澶辫触:', result.data?.saveUserInfo?.message); - } - } catch (error) { - console.log('鉂� 璇锋眰寮傚父:', error.message); - } -} - -async function testGetUserInfo() { - console.log('\n=== 娴嬭瘯3: 鑾峰彇鐢ㄦ埛淇℃伅楠岃瘉淇濆瓨缁撴灉 ==='); - - const query = ` - query GetUserInfo { - userInfo { - id - name - phone - gender - birthDate - education - introduction - avatar - createdAt - updatedAt - } - } - `; - - try { - const result = await graphqlRequest(query, {}, TEST_TOKEN); - console.log('鐢ㄦ埛淇℃伅:', JSON.stringify(result.data?.userInfo, null, 2)); - - if (result.data?.userInfo) { - console.log('鉁� 鎴愬姛鑾峰彇鐢ㄦ埛淇℃伅'); - if (result.data.userInfo.phone) { - console.log('鉁� 鐢佃瘽鍙风爜宸蹭繚瀛�:', result.data.userInfo.phone); - } else { - console.log('鉂� 鐢佃瘽鍙风爜鏈繚瀛�'); - } - } else { - console.log('鉂� 鑾峰彇鐢ㄦ埛淇℃伅澶辫触'); - } - } catch (error) { - console.log('鉂� 璇锋眰寮傚父:', error.message); - } -} - -async function runTests() { - console.log('寮�濮嬫祴璇曠數璇濆彿鐮佹巿鏉冭姹傚姛鑳�...'); - - try { - await testSaveUserInfoWithoutPhone(); - await testSaveUserInfoWithPhone(); - await testGetUserInfo(); - - console.log('\n=== 娴嬭瘯鎬荤粨 ==='); - console.log('1. 鉁� 鍚庣宸叉纭嫆缁濇病鏈夌數璇濆彿鐮佺殑鐢ㄦ埛淇℃伅淇濆瓨'); - console.log('2. 鉁� 鏈夌數璇濆彿鐮佹椂鍙互姝e父淇濆瓨鐢ㄦ埛淇℃伅'); - console.log('3. 鉁� 灏忕▼搴忕宸叉坊鍔犵數璇濆彿鐮佹巿鏉冩鏌�'); - console.log('4. 鉁� 涓汉淇℃伅淇濆瓨鍚庝細寮哄埗閲嶆柊鐧诲綍'); - console.log('5. 鉁� 鎶ュ悕椤甸潰宸插己鍒惰姹傜數璇濆彿鐮佹巿鏉�'); - - } catch (error) { - console.error('娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error); - } -} - -// 杩愯娴嬭瘯 -runTests(); \ No newline at end of file diff --git a/test-phone-display-fixed.js b/test-phone-display-fixed.js deleted file mode 100644 index 4c7f9de..0000000 --- a/test-phone-display-fixed.js +++ /dev/null @@ -1,194 +0,0 @@ -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080/api'; - -async function testPhoneDisplay() { - console.log('=== 娴嬭瘯鐢佃瘽鍙风爜鍥炴樉鍔熻兘 ===\n'); - - try { - // 1. 鍏堢櫥褰曡幏鍙杢oken - console.log('1. 鐧诲綍鑾峰彇token...'); - const loginResponse = await axios.post(`${BASE_URL}/auth/web-login`, { - phone: '13981970816', - password: '123456' - }); - - if (!loginResponse.data.token) { - console.log('鉂� 鐧诲綍澶辫触锛屾棤娉曡幏鍙杢oken'); - return; - } - - const token = loginResponse.data.token; - const userInfo = loginResponse.data.userInfo; - - console.log('鉁� 鐧诲綍鎴愬姛'); - console.log('- Token鑾峰彇鎴愬姛'); - console.log('- 鐧诲綍杩斿洖鐨勭敤鎴蜂俊鎭�:'); - console.log(' - 鐢ㄦ埛ID:', userInfo.userId); - console.log(' - 濮撳悕:', userInfo.name); - console.log(' - 鐢佃瘽:', userInfo.phone); - console.log(' - 鐢ㄦ埛绫诲瀷:', userInfo.userType); - - // 2. 淇濆瓨鐢ㄦ埛淇℃伅 - console.log('\n2. 淇濆瓨鐢ㄦ埛淇℃伅...'); - const saveUserResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - mutation SaveUserInfo($input: SaveUserInfoInput!) { - saveUserInfo(input: $input) { - success - message - user { - id - name - phone - gender - birthday - } - } - } - `, - variables: { - input: { - name: '娴嬭瘯鐢ㄦ埛鐢佃瘽鍥炴樉', - phone: '13981970816', - gender: 'MALE', - birthday: '1990-01-01' - } - } - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (saveUserResponse.data.data?.saveUserInfo?.success) { - console.log('鉁� 淇濆瓨鐢ㄦ埛淇℃伅鎴愬姛'); - const savedUser = saveUserResponse.data.data.saveUserInfo.user; - console.log('- 淇濆瓨鍚庣殑鐢ㄦ埛淇℃伅:'); - console.log(' - 鐢ㄦ埛ID:', savedUser.id); - console.log(' - 濮撳悕:', savedUser.name); - console.log(' - 鐢佃瘽:', savedUser.phone); - console.log(' - 鎬у埆:', savedUser.gender); - console.log(' - 鐢熸棩:', savedUser.birthday); - } else { - console.log('鉂� 淇濆瓨鐢ㄦ埛淇℃伅澶辫触'); - console.log('閿欒:', saveUserResponse.data.errors || saveUserResponse.data.data?.saveUserInfo?.message); - return; - } - - // 3. 鏌ヨ鐢ㄦ埛妗f楠岃瘉鐢佃瘽鍙风爜鍥炴樉 - console.log('\n3. 鏌ヨ鐢ㄦ埛妗f楠岃瘉鐢佃瘽鍙风爜鍥炴樉...'); - const userProfileResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - query { - userProfile { - id - name - phone - gender - birthday - roles - userType - employee { - id - name - roleId - description - } - judge { - id - name - title - company - description - } - player { - id - name - phone - description - } - } - } - ` - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (userProfileResponse.data.data?.userProfile) { - console.log('鉁� 鏌ヨ鐢ㄦ埛妗f鎴愬姛'); - const profile = userProfileResponse.data.data.userProfile; - console.log('- 鐢ㄦ埛妗f淇℃伅:'); - console.log(' - 鐢ㄦ埛ID:', profile.id); - console.log(' - 濮撳悕:', profile.name); - console.log(' - 鐢佃瘽:', profile.phone); - console.log(' - 鎬у埆:', profile.gender); - console.log(' - 鐢熸棩:', profile.birthday); - console.log(' - 瑙掕壊:', profile.roles); - console.log(' - 鐢ㄦ埛绫诲瀷:', profile.userType); - - // 楠岃瘉鐢佃瘽鍙风爜鏄惁姝g‘鍥炴樉 - if (profile.phone === '13981970816') { - console.log('鉁� 鐢佃瘽鍙风爜鍥炴樉姝g‘: ' + profile.phone); - } else { - console.log('鉂� 鐢佃瘽鍙风爜鍥炴樉閿欒锛屾湡鏈�: 13981970816锛屽疄闄�: ' + profile.phone); - } - - // 楠岃瘉濮撳悕鏄惁姝g‘鍥炴樉 - if (profile.name === '娴嬭瘯鐢ㄦ埛鐢佃瘽鍥炴樉') { - console.log('鉁� 濮撳悕鍥炴樉姝g‘: ' + profile.name); - } else { - console.log('鉂� 濮撳悕鍥炴樉閿欒锛屾湡鏈�: 娴嬭瘯鐢ㄦ埛鐢佃瘽鍥炴樉锛屽疄闄�: ' + profile.name); - } - } else { - console.log('鉂� 鏌ヨ鐢ㄦ埛妗f澶辫触'); - console.log('閿欒:', userProfileResponse.data.errors); - } - - // 4. 閲嶆柊鐧诲綍楠岃瘉鐢佃瘽鍙风爜鍥炴樉 - console.log('\n4. 閲嶆柊鐧诲綍楠岃瘉鐢佃瘽鍙风爜鍥炴樉...'); - const reLoginResponse = await axios.post(`${BASE_URL}/auth/web-login`, { - phone: '13981970816', - password: '123456' - }); - - if (reLoginResponse.data.token) { - console.log('鉁� 閲嶆柊鐧诲綍鎴愬姛'); - const reLoginUserInfo = reLoginResponse.data.userInfo; - console.log('- 閲嶆柊鐧诲綍杩斿洖鐨勭敤鎴蜂俊鎭�:'); - console.log(' - 鐢ㄦ埛ID:', reLoginUserInfo.userId); - console.log(' - 濮撳悕:', reLoginUserInfo.name); - console.log(' - 鐢佃瘽:', reLoginUserInfo.phone); - console.log(' - 鐢ㄦ埛绫诲瀷:', reLoginUserInfo.userType); - - // 楠岃瘉閲嶆柊鐧诲綍鍚庣數璇濆彿鐮佹槸鍚︽纭洖鏄� - if (reLoginUserInfo.phone === '13981970816') { - console.log('鉁� 閲嶆柊鐧诲綍鍚庣數璇濆彿鐮佸洖鏄炬纭�: ' + reLoginUserInfo.phone); - } else { - console.log('鉂� 閲嶆柊鐧诲綍鍚庣數璇濆彿鐮佸洖鏄鹃敊璇紝鏈熸湜: 13981970816锛屽疄闄�: ' + reLoginUserInfo.phone); - } - - // 楠岃瘉閲嶆柊鐧诲綍鍚庡鍚嶆槸鍚︽纭洖鏄� - if (reLoginUserInfo.name === '娴嬭瘯鐢ㄦ埛鐢佃瘽鍥炴樉') { - console.log('鉁� 閲嶆柊鐧诲綍鍚庡鍚嶅洖鏄炬纭�: ' + reLoginUserInfo.name); - } else { - console.log('鉂� 閲嶆柊鐧诲綍鍚庡鍚嶅洖鏄鹃敊璇紝鏈熸湜: 娴嬭瘯鐢ㄦ埛鐢佃瘽鍥炴樉锛屽疄闄�: ' + reLoginUserInfo.name); - } - } else { - console.log('鉂� 閲嶆柊鐧诲綍澶辫触'); - console.log('閿欒:', reLoginResponse.data); - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); - - } catch (error) { - console.error('鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.response?.data || error.message); - } -} - -// 杩愯娴嬭瘯 -testPhoneDisplay(); \ No newline at end of file diff --git a/test-player-phone-fix.js b/test-player-phone-fix.js deleted file mode 100644 index b1f59a9..0000000 --- a/test-player-phone-fix.js +++ /dev/null @@ -1,114 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯Player phone瀛楁淇敼鍚庣殑鍔熻兘 -async function testPlayerPhoneFix() { - const baseURL = 'http://localhost:8080/api'; - - console.log('=== 娴嬭瘯Player phone瀛楁淇敼鍚庣殑鍔熻兘 ===\n'); - - try { - // 1. 娴嬭瘯GraphQL鏌ヨ - 鑾峰彇閫夋墜淇℃伅 - console.log('1. 娴嬭瘯GraphQL鏌ヨ閫夋墜淇℃伅...'); - const graphqlQuery = { - query: ` - query { - players(page: 1, size: 5) { - content { - id - name - phone - userInfo { - id - phone - } - } - totalElements - } - } - ` - }; - - const graphqlResponse = await axios.post(`${baseURL}/graphql`, graphqlQuery, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (graphqlResponse.data.data && graphqlResponse.data.data.players) { - const players = graphqlResponse.data.data.players.content; - console.log(`鉁� 鎴愬姛鑾峰彇 ${players.length} 涓�夋墜淇℃伅`); - - // 妫�鏌hone瀛楁鐨勬暟鎹竴鑷存�� - players.forEach((player, index) => { - console.log(` 閫夋墜${index + 1}: ${player.name}`); - console.log(` Player.phone (宸插簾寮�): ${player.phone || 'null'}`); - console.log(` User.phone (姝g‘鏉ユ簮): ${player.userInfo?.phone || 'null'}`); - - // 妫�鏌ユ暟鎹竴鑷存�� - if (player.userInfo?.phone) { - console.log(` 鉁� 浠嶶ser瀹炰綋鎴愬姛鑾峰彇phone: ${player.userInfo.phone}`); - } else { - console.log(` 鈿� User瀹炰綋涓病鏈塸hone鏁版嵁`); - } - console.log(''); - }); - } else { - console.log('鉁� GraphQL鏌ヨ澶辫触鎴栬繑鍥炵┖鏁版嵁'); - console.log('鍝嶅簲:', JSON.stringify(graphqlResponse.data, null, 2)); - } - - } catch (error) { - console.error('娴嬭瘯杩囩▼涓彂鐢熼敊璇�:'); - if (error.response) { - console.error('鐘舵�佺爜:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', JSON.stringify(error.response.data, null, 2)); - } else { - console.error('閿欒淇℃伅:', error.message); - } - } - - try { - // 2. 娴嬭瘯娲诲姩閫夋墜鍒楄〃API - console.log('\n2. 娴嬭瘯娲诲姩閫夋墜鍒楄〃API...'); - const listResponse = await axios.get(`${baseURL}/activity-players/applications`, { - params: { - page: 1, - size: 5 - } - }); - - if (listResponse.data && listResponse.data.content) { - const applications = listResponse.data.content; - console.log(`鉁� 鎴愬姛鑾峰彇 ${applications.length} 涓�夋墜鐢宠璁板綍`); - - applications.forEach((app, index) => { - console.log(` 鐢宠${index + 1}: ${app.playerName}`); - console.log(` 鎵嬫満鍙�: ${app.phone || 'null'}`); - console.log(` 椤圭洰: ${app.projectName || 'null'}`); - console.log(''); - }); - } else { - console.log('鉁� 娲诲姩閫夋墜鍒楄〃API杩斿洖绌烘暟鎹�'); - } - - } catch (error) { - console.error('\n娲诲姩閫夋墜鍒楄〃API娴嬭瘯澶辫触:'); - if (error.response) { - console.error('鐘舵�佺爜:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', JSON.stringify(error.response.data, null, 2)); - } else { - console.error('閿欒淇℃伅:', error.message); - } - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); - console.log('\n鎬荤粨:'); - console.log('1. Player瀹炰綋鐨刾hone瀛楁宸叉爣璁颁负@Deprecated'); - console.log('2. 鎵�鏈塖QL鏌ヨ宸蹭慨鏀逛负浠嶶ser琛ㄨ幏鍙杙hone'); - console.log('3. DTO绫诲凡淇敼涓轰粠User瀹炰綋鑾峰彇phone'); - console.log('4. GraphQL schema涓璓layer.phone宸叉爣璁颁负搴熷純'); - console.log('5. 寤鸿鍓嶇閫愭杩佺Щ鍒颁娇鐢╱serInfo.phone瀛楁'); -} - -// 杩愯娴嬭瘯 -testPlayerPhoneFix(); \ No newline at end of file diff --git a/test-playercount-fix.js b/test-playercount-fix.js deleted file mode 100644 index e003e78..0000000 --- a/test-playercount-fix.js +++ /dev/null @@ -1,91 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯淇敼鍚庣殑playerCount缁熻閫昏緫 -async function testPlayerCountFix() { - console.log('=== 娴嬭瘯playerCount缁熻閫昏緫淇敼 ===\n'); - - const graphqlEndpoint = 'http://localhost:8080/api/graphql'; - - // GraphQL鏌ヨ锛氳幏鍙栨瘮璧涘垪琛� - const query = ` - query getActivities($page: Int!, $size: Int!, $name: String, $state: Int) { - activities(page: $page, size: $size, name: $name, state: $state) { - content { - id - name - description - playerCount - playerMax - state - stateName - signupDeadline - matchTime - } - totalElements - page - size - } - } - `; - - try { - console.log('1. 鑾峰彇鎵�鏈夋瘮璧涘垪琛�...'); - const response = await axios.post(graphqlEndpoint, { - query: query, - variables: { - page: 1, - size: 10, - name: null, - state: null - } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.error('GraphQL閿欒:', response.data.errors); - return; - } - - const activities = response.data.data.activities.content; - console.log(`鎵惧埌 ${activities.length} 涓瘮璧�:\n`); - - activities.forEach((activity, index) => { - console.log(`${index + 1}. 姣旇禌: ${activity.name}`); - console.log(` ID: ${activity.id}`); - console.log(` 宸叉姤鍚嶄汉鏁�: ${activity.playerCount} (淇敼鍚庡簲鍖呭惈寰呭鏍�+瀹℃牳閫氳繃)`); - console.log(` 鏈�澶т汉鏁�: ${activity.playerMax || '鏃犻檺鍒�'}`); - console.log(` 鐘舵��: ${activity.stateName} (${activity.state})`); - console.log(` 鎶ュ悕鎴: ${activity.signupDeadline || '鏈缃�'}`); - console.log(` 姣旇禌鏃堕棿: ${activity.matchTime || '鏈缃�'}`); - console.log(''); - }); - - // 濡傛灉鏈夋瘮璧涳紝閫夋嫨绗竴涓繘琛岃缁嗛獙璇� - if (activities.length > 0) { - const firstActivity = activities[0]; - console.log(`\n2. 楠岃瘉姣旇禌 "${firstActivity.name}" 鐨刾layerCount缁熻...`); - - // 杩欓噷鍙互娣诲姞鏇磋缁嗙殑楠岃瘉閫昏緫 - // 姣斿鐩存帴鏌ヨ鏁版嵁搴撴垨璋冪敤鍏朵粬API鏉ラ獙璇佺粺璁℃槸鍚︽纭� - console.log(` 褰撳墠鏄剧ず鐨刾layerCount: ${firstActivity.playerCount}`); - console.log(' 鉁� 淇敼宸茬敓鏁堬細鐜板湪缁熻鍖呭惈寰呭鏍�(state=0)鍜屽鏍搁�氳繃(state=1)鐨勬姤鍚嶈褰�'); - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); - console.log('鉁� 鍚庣playerCount缁熻閫昏緫宸叉垚鍔熶慨鏀�'); - console.log('鉁� 鐜板湪鏄剧ず鐨勫凡鎶ュ悕浜烘暟鍖呭惈寰呭鏍稿拰瀹℃牳閫氳繃鐨勬姤鍚嶈褰�'); - - } catch (error) { - console.error('娴嬭瘯澶辫触:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testPlayerCountFix(); \ No newline at end of file diff --git a/test-registration-debug.html b/test-registration-debug.html deleted file mode 100644 index 553ed5b..0000000 --- a/test-registration-debug.html +++ /dev/null @@ -1,126 +0,0 @@ -<!DOCTYPE html> -<html lang="zh-CN"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>娴嬭瘯娉ㄥ唽椤甸潰璋冭瘯</title> - <style> - body { - font-family: Arial, sans-serif; - max-width: 800px; - margin: 0 auto; - padding: 20px; - background-color: #f5f5f5; - } - .container { - background: white; - padding: 30px; - border-radius: 10px; - box-shadow: 0 2px 10px rgba(0,0,0,0.1); - } - h1 { - color: #333; - text-align: center; - margin-bottom: 30px; - } - .info { - background: #e3f2fd; - padding: 15px; - border-radius: 5px; - margin-bottom: 20px; - border-left: 4px solid #2196f3; - } - .steps { - background: #f3e5f5; - padding: 15px; - border-radius: 5px; - margin-bottom: 20px; - border-left: 4px solid #9c27b0; - } - .steps ol { - margin: 0; - padding-left: 20px; - } - .steps li { - margin-bottom: 8px; - } - .note { - background: #fff3e0; - padding: 15px; - border-radius: 5px; - border-left: 4px solid #ff9800; - } - .debug-info { - background: #f1f8e9; - padding: 15px; - border-radius: 5px; - margin-top: 20px; - border-left: 4px solid #4caf50; - } - code { - background: #f5f5f5; - padding: 2px 6px; - border-radius: 3px; - font-family: 'Courier New', monospace; - } - </style> -</head> -<body> - <div class="container"> - <h1>馃攳 娉ㄥ唽椤甸潰璋冭瘯娴嬭瘯</h1> - - <div class="info"> - <h3>馃搵 娴嬭瘯鐩殑</h3> - <p>妫�鏌ユ敞鍐岄〉闈腑鎬у埆鍜岀敓鏃ュ瓧娈电殑鏁版嵁缁戝畾闂锛屾煡鐪嬪疄闄呯殑鐢ㄦ埛鏁版嵁缁撴瀯銆�</p> - </div> - - <div class="steps"> - <h3>馃殌 娴嬭瘯姝ラ</h3> - <ol> - <li>鍦ㄥ皬绋嬪簭寮�鍙戣�呭伐鍏蜂腑鎵撳紑椤圭洰</li> - <li>瀵艰埅鍒版敞鍐岄〉闈細<code>pages/registration/registration</code></li> - <li>鏌ョ湅鎺у埗鍙拌緭鍑虹殑璋冭瘯淇℃伅</li> - <li>妫�鏌ヤ互涓嬪叧閿俊鎭細 - <ul> - <li><code>馃攳 瀹為檯鐢ㄦ埛鏁版嵁:</code> - 鏌ョ湅瀹屾暣鐨勭敤鎴锋暟鎹粨鏋�</li> - <li><code>馃攳 棰勫~鍏呯敤鎴蜂俊鎭�:</code> - 鏌ョ湅棰勫~鍏呰繃绋�</li> - <li><code>馃懁 璁剧疆鎬у埆:</code> - 鏌ョ湅鎬у埆璁剧疆杩囩▼</li> - <li><code>馃巶 璁剧疆鐢熸棩:</code> - 鏌ョ湅鐢熸棩璁剧疆杩囩▼</li> - </ul> - </li> - </ol> - </div> - - <div class="note"> - <h3>鈿狅笍 娉ㄦ剰浜嬮」</h3> - <p>濡傛灉鐢ㄦ埛鏁版嵁涓己灏� <code>gender</code> 鎴� <code>birthday</code>/<code>birthDate</code> 瀛楁锛岄偅涔堣繖浜涘瓧娈靛氨涓嶄細琚濉厖锛岃繖鍙兘鏄棶棰樼殑鏍规簮銆�</p> - </div> - - <div class="debug-info"> - <h3>馃敡 宸叉坊鍔犵殑璋冭瘯浠g爜</h3> - <p>鍦� <code>registration.js</code> 涓凡娣诲姞浠ヤ笅璋冭瘯浠g爜锛�</p> - <ul> - <li><code>loadUserInfo()</code> 鏂规硶涓坊鍔犱簡鐢ㄦ埛鏁版嵁鎵撳嵃</li> - <li><code>prefillUserInfo()</code> 鏂规硶涓坊鍔犱簡棰勫~鍏呰繃绋嬫墦鍗�</li> - <li>绉婚櫎浜嗘棫鐨� <code>player</code> 宓屽缁撴瀯澶勭悊浠g爜</li> - </ul> - </div> - - <div class="info"> - <h3>馃幆 棰勬湡缁撴灉</h3> - <p>閫氳繃璋冭瘯淇℃伅锛屾垜浠簲璇ヨ兘澶熺湅鍒帮細</p> - <ul> - <li>瀹為檯鐨勭敤鎴锋暟鎹粨鏋�</li> - <li>鎬у埆鍜岀敓鏃ュ瓧娈垫槸鍚﹀瓨鍦�</li> - <li>瀛楁鐨勬暟鎹被鍨嬪拰鏍煎紡</li> - <li>棰勫~鍏呰繃绋嬫槸鍚︽甯告墽琛�</li> - </ul> - </div> - </div> - - <script> - console.log('馃攳 娉ㄥ唽椤甸潰璋冭瘯娴嬭瘯椤甸潰宸插姞杞�'); - console.log('璇峰湪灏忕▼搴忓紑鍙戣�呭伐鍏蜂腑瀵艰埅鍒版敞鍐岄〉闈㈡煡鐪嬭皟璇曚俊鎭�'); - </script> -</body> -</html> \ No newline at end of file diff --git a/test-registration-logic.js b/test-registration-logic.js deleted file mode 100644 index 51ebb0c..0000000 --- a/test-registration-logic.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 娴嬭瘯灏忕▼搴忔姤鍚嶉�昏緫淇敼 - * 楠岃瘉鍚庣鏈嶅姟鏄惁姝e父缂栬瘧鍜屽惎鍔� - */ - -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080/api'; - -async function testRegistrationLogic() { - console.log('馃殌 寮�濮嬫祴璇曞皬绋嬪簭鎶ュ悕閫昏緫淇敼...\n'); - - try { - // 娴嬭瘯GraphQL绔偣 - console.log('1. 娴嬭瘯GraphQL绔偣...'); - try { - const graphqlResponse = await axios.post(`${BASE_URL}/graphql`, { - query: ` - query { - __schema { - types { - name - } - } - } - ` - }); - console.log('鉁� GraphQL绔偣姝e父'); - } catch (error) { - if (error.response && error.response.status === 401) { - console.log('鉁� GraphQL绔偣姝e父 (闇�瑕佽璇�)'); - } else { - console.log('鉂� GraphQL绔偣寮傚父:', error.message); - } - } - - console.log('\n馃搵 灏忕▼搴忔姤鍚嶉�昏緫淇敼鎬荤粨:'); - console.log('鉁� 1. User淇濆瓨閫昏緫: 鏍规嵁phone鏌ヨ锛屽瓨鍦ㄥ垯鏇存柊锛屽惁鍒欐柊澧�'); - console.log(' - createOrUpdateUser()鏂规硶宸叉纭疄鐜�'); - console.log(' - 鍏堥�氳繃userService.findByPhone(phone)鏌ヨ'); - console.log(' - 瀛樺湪鍒欐洿鏂扮敤鎴蜂俊鎭紝鍚﹀垯鍒涘缓鏂扮敤鎴�'); - - console.log('\n鉁� 2. Player淇濆瓨閫昏緫: 鏍规嵁userId鏌ヨ锛屽瓨鍦ㄥ垯鏇存柊锛屽惁鍒欐柊澧�'); - console.log(' - 淇敼浜唂indOrCreatePlayer()鏂规硶鐨勬墽琛岄『搴�'); - console.log(' - 鍏堣皟鐢╟reateOrUpdateUser()淇濆瓨User'); - console.log(' - 鍐嶉�氳繃playerRepository.findByUserId(user.getId())鏌ヨPlayer'); - console.log(' - 濡傛灉Player瀛樺湪鍒欐洿鏂帮紝鍚﹀垯鍒涘缓鏂癙layer骞跺叧鑱攗serId'); - - console.log('\n馃幆 淇敼鍚庣殑鎶ュ悕娴佺▼:'); - console.log('1锔忊儯 鎺ユ敹鎶ュ悕璇锋眰 -> ActivityPlayerService.submitActivityRegistration()'); - console.log('2锔忊儯 璋冪敤findOrCreatePlayer() -> 鍏堝鐞哢ser锛屽啀澶勭悊Player'); - console.log('3锔忊儯 createOrUpdateUser(): 鏍规嵁phone鏌ヨUser锛屽瓨鍦ㄥ垯鏇存柊锛屽惁鍒欐柊澧�'); - console.log('4锔忊儯 playerRepository.findByUserId(): 鏍规嵁userId鏌ヨPlayer'); - console.log('5锔忊儯 濡傛灉Player瀛樺湪鍒欐洿鏂颁俊鎭紝鍚﹀垯鍒涘缓鏂癙layer骞跺叧鑱攗serId'); - console.log('6锔忊儯 鍒涘缓ActivityPlayer鎶ュ悕璁板綍'); - - console.log('\n馃敡 鍏蜂綋淇敼鍐呭:'); - console.log('- 绉婚櫎浜嗗搴熷純鐨凱layer.phone瀛楁鐨勪緷璧�'); - console.log('- 鏀逛负閫氳繃userId鍏宠仈User鍜孭layer'); - console.log('- 纭繚鏁版嵁涓�鑷存�у拰閬垮厤閲嶅'); - console.log('- 绗﹀悎浣犺姹傜殑涓ゆ淇濆瓨閫昏緫'); - - console.log('\n鉁� 3. 鍚庣鏈嶅姟缂栬瘧鍜屽惎鍔ㄦ甯�'); - console.log('鉁� 4. 鎵�鏈変慨鏀瑰凡鐢熸晥'); - - console.log('\n鉁� 娴嬭瘯瀹屾垚锛佸皬绋嬪簭鎶ュ悕閫昏緫宸叉寜浣犵殑瑕佹眰淇敼锛�'); - console.log(' 1. 淇濆瓨user鏃讹紝鍏堟煡璇㈡湁娌℃湁鐩稿悓鐨刾hone锛屽瓨鍦ㄥ氨鏇存柊锛屽惁鍒欐柊澧�'); - console.log(' 2. 淇濆瓨player鏃讹紝鏌ユ壘鏄惁鏈夌涓�姝ヤ繚瀛樿繃鐨剈serId锛屾湁灏辨洿鏂板搴旂殑player锛屾病鏈夊氨鏂板player'); - - } catch (error) { - console.error('鉂� 娴嬭瘯澶辫触:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testRegistrationLogic(); \ No newline at end of file diff --git a/test-review-fix-validation.js b/test-review-fix-validation.js deleted file mode 100644 index 858923c..0000000 --- a/test-review-fix-validation.js +++ /dev/null @@ -1,200 +0,0 @@ -const axios = require('axios'); - -const graphqlUrl = 'http://localhost:8080/api/graphql'; - -// 浣跨敤涔嬪墠鎴愬姛鐨勫井淇ode -const wxCode = '0f3cd4ll2X7Eqg4242ml2zvTju4cd4l1'; - -async function testReviewFixValidation() { - try { - console.log('=== 楠岃瘉璇勫鍔熻兘淇 ===\n'); - - // 1. 鍏堣繘琛屽井淇$櫥褰曡幏鍙杢oken - console.log('1. 寰俊鐧诲綍鑾峰彇token...'); - const loginMutation = ` - mutation wxLogin($input: WxLoginRequest!) { - wxLogin(input: $input) { - token - userInfo { - userId - name - userType - } - } - } - `; - - const loginResponse = await axios.post(graphqlUrl, { - query: loginMutation, - variables: { - input: { - code: wxCode, - wxOpenid: "test-openid-152" - } - } - }); - - if (loginResponse.data.errors) { - console.error('寰俊鐧诲綍澶辫触:', loginResponse.data.errors); - return; - } - - const { token, userInfo } = loginResponse.data.data.wxLogin; - console.log('鉁� 寰俊鐧诲綍鎴愬姛!'); - console.log('鐢ㄦ埛淇℃伅:', userInfo); - - const headers = { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - }; - - // 2. 娴嬭瘯鏈瘎瀹¢」鐩煡璇� (瀵瑰簲 currentTab = 0) - console.log('\n2. 娴嬭瘯鏈瘎瀹¢」鐩煡璇� (currentTab = 0)...'); - const unReviewedQuery = ` - query GetUnReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - unReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - items { - id - projectName - activityName - stageName - studentName - submitTime - status - } - total - hasMore - } - } - `; - - const unReviewedResponse = await axios.post(graphqlUrl, { - query: unReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: null - } - }, { headers }); - - if (unReviewedResponse.data.errors) { - console.error('鉂� 鏈瘎瀹¢」鐩煡璇㈠け璐�:', unReviewedResponse.data.errors); - } else { - console.log('鉁� 鏈瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('椤圭洰鏁伴噺:', unReviewedResponse.data.data.unReviewedProjects.total); - console.log('鏄惁鏈夋洿澶�:', unReviewedResponse.data.data.unReviewedProjects.hasMore); - } - - // 3. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇� (瀵瑰簲 currentTab = 1) - console.log('\n3. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇� (currentTab = 1)...'); - const reviewedQuery = ` - query GetReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - reviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - items { - id - projectName - activityName - stageName - studentName - submitTime - reviewTime - score - status - } - total - hasMore - } - } - `; - - const reviewedResponse = await axios.post(graphqlUrl, { - query: reviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: null - } - }, { headers }); - - if (reviewedResponse.data.errors) { - console.error('鉂� 宸茶瘎瀹¢」鐩煡璇㈠け璐�:', reviewedResponse.data.errors); - } else { - console.log('鉁� 宸茶瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('椤圭洰鏁伴噺:', reviewedResponse.data.data.reviewedProjects.total); - console.log('鏄惁鏈夋洿澶�:', reviewedResponse.data.data.reviewedProjects.hasMore); - } - - // 4. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇� (瀵瑰簲 currentTab = 2) - console.log('\n4. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇� (currentTab = 2)...'); - const studentUnReviewedQuery = ` - query GetStudentUnReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - studentUnReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - items { - id - projectName - activityName - stageName - studentName - submitTime - status - } - total - hasMore - } - } - `; - - const studentUnReviewedResponse = await axios.post(graphqlUrl, { - query: studentUnReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: null - } - }, { headers }); - - if (studentUnReviewedResponse.data.errors) { - console.error('鉂� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈠け璐�:', studentUnReviewedResponse.data.errors); - } else { - console.log('鉁� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('椤圭洰鏁伴噺:', studentUnReviewedResponse.data.data.studentUnReviewedProjects.total); - console.log('鏄惁鏈夋洿澶�:', studentUnReviewedResponse.data.data.studentUnReviewedProjects.hasMore); - } - - // 5. 娴嬭瘯璇勫缁熻鏌ヨ - console.log('\n5. 娴嬭瘯璇勫缁熻鏌ヨ...'); - const statisticsQuery = ` - query GetReviewStatistics { - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } - `; - - const statisticsResponse = await axios.post(graphqlUrl, { - query: statisticsQuery - }, { headers }); - - if (statisticsResponse.data.errors) { - console.error('鉂� 璇勫缁熻鏌ヨ澶辫触:', statisticsResponse.data.errors); - } else { - console.log('鉁� 璇勫缁熻鏌ヨ鎴愬姛'); - const stats = statisticsResponse.data.data.reviewStatistics; - console.log('鏈瘎瀹℃暟閲�:', stats.unReviewedCount); - console.log('宸茶瘎瀹℃暟閲�:', stats.reviewedCount); - console.log('瀛﹀憳鏈瘎瀹℃暟閲�:', stats.studentUnReviewedCount); - } - - console.log('\n=== 楠岃瘉瀹屾垚 ==='); - console.log('鉁� 鎵�鏈夎瘎瀹″姛鑳芥煡璇㈤兘姝e父宸ヤ綔锛�'); - console.log('鉁� Switch璇彞鏁板瓧瀛楃涓茶浆鎹㈤棶棰樺凡淇'); - console.log('鉁� GraphQL鏌ヨ鍙傛暟绌哄瓧绗︿覆闂宸蹭慨澶�'); - - } catch (error) { - console.error('鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.response?.data || error.message); - } -} - -testReviewFixValidation(); \ No newline at end of file diff --git a/test-review-fix-with-token.js b/test-review-fix-with-token.js deleted file mode 100644 index 6ee52e3..0000000 --- a/test-review-fix-with-token.js +++ /dev/null @@ -1,194 +0,0 @@ -const axios = require('axios'); - -const graphqlUrl = 'http://localhost:8080/api/graphql'; - -// 浣跨敤涔嬪墠鎴愬姛鑾峰彇鐨則oken锛堣繖閲岄渶瑕佺敤鎴锋彁渚涗竴涓湁鏁堢殑token锛� -// 鎴栬�呮垜浠彲浠ヤ粠涔嬪墠鐨勬祴璇曚腑鑾峰彇 -const TEST_TOKEN = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxNTIiLCJwaG9uZSI6IjEzOTgxOTcwODE2Iiwid3hPcGVuaWQiOiJ0ZXN0LW9wZW5pZC0xNTIiLCJpYXQiOjE3MzU2MzE0NzQsImV4cCI6MTczNjIzNjI3NH0.Ej_Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7Ej7E'; // 绀轰緥token锛岄渶瑕佹浛鎹负瀹為檯鏈夋晥鐨則oken - -async function testReviewFixWithToken() { - try { - console.log('=== 浣跨敤鐜版湁Token楠岃瘉璇勫鍔熻兘淇 ===\n'); - - const headers = { - 'Authorization': `Bearer ${TEST_TOKEN}`, - 'Content-Type': 'application/json' - }; - - // 1. 娴嬭瘯鏈瘎瀹¢」鐩煡璇� (瀵瑰簲 currentTab = 0) - console.log('1. 娴嬭瘯鏈瘎瀹¢」鐩煡璇� (currentTab = 0)...'); - const unReviewedQuery = ` - query GetUnReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - unReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - items { - id - projectName - activityName - stageName - studentName - submitTime - status - } - total - hasMore - } - } - `; - - try { - const unReviewedResponse = await axios.post(graphqlUrl, { - query: unReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: null - } - }, { headers }); - - if (unReviewedResponse.data.errors) { - console.error('鉂� 鏈瘎瀹¢」鐩煡璇㈠け璐�:', unReviewedResponse.data.errors); - } else { - console.log('鉁� 鏈瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('椤圭洰鏁伴噺:', unReviewedResponse.data.data.unReviewedProjects.total); - console.log('鏄惁鏈夋洿澶�:', unReviewedResponse.data.data.unReviewedProjects.hasMore); - } - } catch (error) { - console.error('鉂� 鏈瘎瀹¢」鐩煡璇㈣姹傚け璐�:', error.response?.data || error.message); - } - - // 2. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇� (瀵瑰簲 currentTab = 1) - console.log('\n2. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇� (currentTab = 1)...'); - const reviewedQuery = ` - query GetReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - reviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - items { - id - projectName - activityName - stageName - studentName - submitTime - reviewTime - score - status - } - total - hasMore - } - } - `; - - try { - const reviewedResponse = await axios.post(graphqlUrl, { - query: reviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: null - } - }, { headers }); - - if (reviewedResponse.data.errors) { - console.error('鉂� 宸茶瘎瀹¢」鐩煡璇㈠け璐�:', reviewedResponse.data.errors); - } else { - console.log('鉁� 宸茶瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('椤圭洰鏁伴噺:', reviewedResponse.data.data.reviewedProjects.total); - console.log('鏄惁鏈夋洿澶�:', reviewedResponse.data.data.reviewedProjects.hasMore); - } - } catch (error) { - console.error('鉂� 宸茶瘎瀹¢」鐩煡璇㈣姹傚け璐�:', error.response?.data || error.message); - } - - // 3. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇� (瀵瑰簲 currentTab = 2) - console.log('\n3. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇� (currentTab = 2)...'); - const studentUnReviewedQuery = ` - query GetStudentUnReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - studentUnReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - items { - id - projectName - activityName - stageName - studentName - submitTime - status - } - total - hasMore - } - } - `; - - try { - const studentUnReviewedResponse = await axios.post(graphqlUrl, { - query: studentUnReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: null - } - }, { headers }); - - if (studentUnReviewedResponse.data.errors) { - console.error('鉂� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈠け璐�:', studentUnReviewedResponse.data.errors); - } else { - console.log('鉁� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('椤圭洰鏁伴噺:', studentUnReviewedResponse.data.data.studentUnReviewedProjects.total); - console.log('鏄惁鏈夋洿澶�:', studentUnReviewedResponse.data.data.studentUnReviewedProjects.hasMore); - } - } catch (error) { - console.error('鉂� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈣姹傚け璐�:', error.response?.data || error.message); - } - - // 4. 娴嬭瘯璇勫缁熻鏌ヨ - console.log('\n4. 娴嬭瘯璇勫缁熻鏌ヨ...'); - const statisticsQuery = ` - query GetReviewStatistics { - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } - `; - - try { - const statisticsResponse = await axios.post(graphqlUrl, { - query: statisticsQuery - }, { headers }); - - if (statisticsResponse.data.errors) { - console.error('鉂� 璇勫缁熻鏌ヨ澶辫触:', statisticsResponse.data.errors); - } else { - console.log('鉁� 璇勫缁熻鏌ヨ鎴愬姛'); - const stats = statisticsResponse.data.data.reviewStatistics; - console.log('鏈瘎瀹℃暟閲�:', stats.unReviewedCount); - console.log('宸茶瘎瀹℃暟閲�:', stats.reviewedCount); - console.log('瀛﹀憳鏈瘎瀹℃暟閲�:', stats.studentUnReviewedCount); - } - } catch (error) { - console.error('鉂� 璇勫缁熻鏌ヨ璇锋眰澶辫触:', error.response?.data || error.message); - } - - console.log('\n=== 楠岃瘉鎬荤粨 ==='); - console.log('鉁� 淇鍐呭:'); - console.log(' 1. Switch璇彞鏁板瓧瀛楃涓茶浆鎹㈤棶棰� - 宸蹭慨澶�'); - console.log(' - switchTab鏂规硶涓坊鍔犱簡parseInt()杞崲'); - console.log(' - switch璇彞涓坊鍔犱簡parseInt()纭繚鏁板瓧姣旇緝'); - console.log(' - dataKey鍒ゆ柇涓坊鍔犱簡parseInt()杞崲'); - console.log(' 2. GraphQL鏌ヨ鍙傛暟绌哄瓧绗︿覆闂 - 宸蹭慨澶�'); - console.log(' - 娣诲姞浜哾efault case澶勭悊鏃犳晥鐨刢urrentTab鍊�'); - console.log(' - 娣诲姞浜唓uery涓虹┖鏃剁殑閿欒妫�鏌ュ拰杩斿洖'); - console.log(' 3. 鎵�鏈塆raphQL鏌ヨ閮芥湁瀹屾暣鐨剄uery瀛楃涓�'); - - } catch (error) { - console.error('鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.message); - } -} - -// 濡傛灉娌℃湁鏈夋晥token锛屾樉绀鸿鏄� -console.log('娉ㄦ剰锛氭鑴氭湰闇�瑕佹湁鏁堢殑JWT token鎵嶈兘瀹屾暣娴嬭瘯銆�'); -console.log('濡傛灉鎮ㄦ湁鏈夋晥鐨則oken锛岃鏇挎崲TEST_TOKEN鍙橀噺鐨勫�笺��'); -console.log('鎴栬�呮彁渚涙柊鐨勫井淇ode鏉ヨ幏鍙杢oken銆俓n'); - -testReviewFixWithToken(); \ No newline at end of file diff --git a/test-review-page-queries.js b/test-review-page-queries.js deleted file mode 100644 index 4d05454..0000000 --- a/test-review-page-queries.js +++ /dev/null @@ -1,200 +0,0 @@ -const axios = require('axios'); - -const graphqlUrl = 'http://localhost:8080/api/graphql'; - -// 鏂扮殑寰俊鐧诲綍code -const wxCode = '0d3F150w3zNAL535DY1w3u7q4i2F150Y'; - -async function testReviewPageQueries() { - try { - console.log('=== 寮�濮嬫祴璇曡瘎瀹¢〉闈raphQL鏌ヨ ===\n'); - - // 1. 鍏堣繘琛屽井淇$櫥褰曡幏鍙杢oken - console.log('1. 寰俊鐧诲綍鑾峰彇token...'); - const loginMutation = ` - mutation wxLogin($input: WxLoginRequest!) { - wxLogin(input: $input) { - token - userInfo { - userId - name - userType - } - } - } - `; - - const loginResponse = await axios.post(graphqlUrl, { - query: loginMutation, - variables: { - input: { - code: wxCode, - wxOpenid: "test-openid-152" - } - } - }); - - if (loginResponse.data.errors) { - console.error('寰俊鐧诲綍澶辫触:', loginResponse.data.errors); - return; - } - - const { token, userInfo } = loginResponse.data.data.wxLogin; - console.log('寰俊鐧诲綍鎴愬姛!'); - console.log('鐢ㄦ埛淇℃伅:', userInfo); - console.log('Token:', token.substring(0, 50) + '...\n'); - - // 2. 娴嬭瘯鏈瘎瀹¢」鐩煡璇� - console.log('2. 娴嬭瘯鏈瘎瀹¢」鐩煡璇�...'); - const unReviewedQuery = ` - query unReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - unReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - total - hasMore - items { - id - projectName - activityName - stageName - studentName - submitTime - } - } - } - `; - - const unReviewedResponse = await axios.post(graphqlUrl, { - query: unReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: "" - } - }, { - headers: { - 'Authorization': `Bearer ${token}` - } - }); - - if (unReviewedResponse.data.errors) { - console.error('鏈瘎瀹¢」鐩煡璇㈠け璐�:', unReviewedResponse.data.errors); - } else { - console.log('鏈瘎瀹¢」鐩煡璇㈡垚鍔�:', unReviewedResponse.data.data.unReviewedProjects); - } - - // 3. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇� - console.log('\n3. 娴嬭瘯宸茶瘎瀹¢」鐩煡璇�...'); - const reviewedQuery = ` - query reviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - reviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - total - hasMore - items { - id - projectName - activityName - stageName - studentName - submitTime - reviewTime - score - } - } - } - `; - - const reviewedResponse = await axios.post(graphqlUrl, { - query: reviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: "" - } - }, { - headers: { - 'Authorization': `Bearer ${token}` - } - }); - - if (reviewedResponse.data.errors) { - console.error('宸茶瘎瀹¢」鐩煡璇㈠け璐�:', reviewedResponse.data.errors); - } else { - console.log('宸茶瘎瀹¢」鐩煡璇㈡垚鍔�:', reviewedResponse.data.data.reviewedProjects); - } - - // 4. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇� - console.log('\n4. 娴嬭瘯瀛﹀憳鏈瘎瀹¢」鐩煡璇�...'); - const studentUnReviewedQuery = ` - query studentUnReviewedProjects($page: Int!, $pageSize: Int!, $searchKeyword: String) { - studentUnReviewedProjects(page: $page, pageSize: $pageSize, searchKeyword: $searchKeyword) { - total - hasMore - items { - id - projectName - activityName - stageName - studentName - submitTime - } - } - } - `; - - const studentUnReviewedResponse = await axios.post(graphqlUrl, { - query: studentUnReviewedQuery, - variables: { - page: 1, - pageSize: 10, - searchKeyword: "" - } - }, { - headers: { - 'Authorization': `Bearer ${token}` - } - }); - - if (studentUnReviewedResponse.data.errors) { - console.error('瀛﹀憳鏈瘎瀹¢」鐩煡璇㈠け璐�:', studentUnReviewedResponse.data.errors); - } else { - console.log('瀛﹀憳鏈瘎瀹¢」鐩煡璇㈡垚鍔�:', studentUnReviewedResponse.data.data.studentUnReviewedProjects); - } - - // 5. 娴嬭瘯璇勫缁熻鏌ヨ - console.log('\n5. 娴嬭瘯璇勫缁熻鏌ヨ...'); - const statisticsQuery = ` - query reviewStatistics { - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } - `; - - const statisticsResponse = await axios.post(graphqlUrl, { - query: statisticsQuery - }, { - headers: { - 'Authorization': `Bearer ${token}` - } - }); - - if (statisticsResponse.data.errors) { - console.error('璇勫缁熻鏌ヨ澶辫触:', statisticsResponse.data.errors); - } else { - console.log('璇勫缁熻鏌ヨ鎴愬姛:', statisticsResponse.data.data.reviewStatistics); - } - - console.log('\n=== 鎵�鏈夋祴璇曞畬鎴� ==='); - - } catch (error) { - console.error('娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -testReviewPageQueries(); \ No newline at end of file diff --git a/test-review-queries.js b/test-review-queries.js deleted file mode 100644 index f1074de..0000000 --- a/test-review-queries.js +++ /dev/null @@ -1,245 +0,0 @@ -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080/api'; - -// 娴嬭瘯鐢ㄧ殑token锛堢敤鎴稩D=152, 璇勫ID=72锛� -let TEST_TOKEN = 'your_actual_token_here'; - -async function getValidToken() { - try { - console.log('灏濊瘯浣跨敤寰俊鐧诲綍code鑾峰彇token...'); - - const wxLoginMutation = ` - mutation WxLogin($input: WxLoginRequest!) { - wxLogin(input: $input) { - token - userInfo { - userId - name - phone - userType - } - } - } - `; - - const loginResponse = await axios.post('http://localhost:8080/api/graphql', { - query: wxLoginMutation, - variables: { - input: { - code: '0e3xj8000AMc6V11gY200KTotq3xj80L' - } - } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (loginResponse.data?.data?.wxLogin?.token) { - const token = loginResponse.data.data.wxLogin.token; - const user = loginResponse.data.data.wxLogin.userInfo; - TEST_TOKEN = token; - console.log('鉁� 寰俊鐧诲綍鎴愬姛'); - console.log('鐢ㄦ埛淇℃伅:', user); - console.log('Token:', token.substring(0, 20) + '...'); - return true; - } else { - console.log('鉁� 寰俊鐧诲綍澶辫触:', loginResponse.data); - return false; - } - } catch (error) { - console.log('鉁� 寰俊鐧诲綍澶辫触:', error.response?.data || error.message); - return false; - } -} - -async function testReviewQueries() { - console.log('寮�濮嬫祴璇曡瘎瀹$浉鍏崇殑GraphQL鏌ヨ...\n'); - - // 鍏堣幏鍙栨湁鏁坱oken - const tokenObtained = await getValidToken(); - if (!tokenObtained) { - console.log('鏃犳硶鑾峰彇鏈夋晥token锛屾祴璇曠粓姝�'); - return; - } - - const headers = { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${TEST_TOKEN}` - }; - - // 娴嬭瘯1: 鑾峰彇鏈瘎瀹¢」鐩� - console.log('1. 娴嬭瘯鑾峰彇鏈瘎瀹¢」鐩�...'); - try { - const unReviewedQuery = { - query: ` - query GetUnReviewedProjects { - unReviewedProjects(page: 1, pageSize: 10) { - items { - id - projectName - activityName - stageName - studentName - submitTime - status - } - total - hasMore - } - } - ` - }; - - const response1 = await axios.post(`${BASE_URL}/graphql`, unReviewedQuery, { headers }); - console.log('鉁� 鏈瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('杩斿洖鏁版嵁:', JSON.stringify(response1.data, null, 2)); - } catch (error) { - console.log('鉁� 鏈瘎瀹¢」鐩煡璇㈠け璐�'); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n'); - - // 娴嬭瘯2: 鑾峰彇宸茶瘎瀹¢」鐩� - console.log('2. 娴嬭瘯鑾峰彇宸茶瘎瀹¢」鐩�...'); - try { - const reviewedQuery = { - query: ` - query GetReviewedProjects { - reviewedProjects(page: 1, pageSize: 10) { - items { - id - projectName - activityName - stageName - studentName - submitTime - reviewTime - score - status - } - total - hasMore - } - } - ` - }; - - const response2 = await axios.post(`${BASE_URL}/graphql`, reviewedQuery, { headers }); - console.log('鉁� 宸茶瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('杩斿洖鏁版嵁:', JSON.stringify(response2.data, null, 2)); - } catch (error) { - console.log('鉁� 宸茶瘎瀹¢」鐩煡璇㈠け璐�'); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n'); - - // 娴嬭瘯3: 鑾峰彇瀛﹀憳鏈瘎瀹¢」鐩� - console.log('3. 娴嬭瘯鑾峰彇瀛﹀憳鏈瘎瀹¢」鐩�...'); - try { - const studentUnReviewedQuery = { - query: ` - query GetStudentUnReviewedProjects { - studentUnReviewedProjects(page: 1, pageSize: 10) { - items { - id - projectName - activityName - stageName - studentName - submitTime - status - } - total - hasMore - } - } - ` - }; - - const response3 = await axios.post(`${BASE_URL}/graphql`, studentUnReviewedQuery, { headers }); - console.log('鉁� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈡垚鍔�'); - console.log('杩斿洖鏁版嵁:', JSON.stringify(response3.data, null, 2)); - } catch (error) { - console.log('鉁� 瀛﹀憳鏈瘎瀹¢」鐩煡璇㈠け璐�'); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n'); - - // 娴嬭瘯4: 鑾峰彇璇勫缁熻 - console.log('4. 娴嬭瘯鑾峰彇璇勫缁熻...'); - try { - const statisticsQuery = { - query: ` - query GetReviewStatistics { - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } - ` - }; - - const response4 = await axios.post(`${BASE_URL}/graphql`, statisticsQuery, { headers }); - console.log('鉁� 璇勫缁熻鏌ヨ鎴愬姛'); - console.log('杩斿洖鏁版嵁:', JSON.stringify(response4.data, null, 2)); - } catch (error) { - console.log('鉁� 璇勫缁熻鏌ヨ澶辫触'); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n'); - - // 娴嬭瘯5: 楠岃瘉褰撳墠鐢ㄦ埛璇勫韬唤 - console.log('5. 娴嬭瘯楠岃瘉褰撳墠鐢ㄦ埛璇勫韬唤...'); - try { - const userProfileQuery = { - query: ` - query GetUserProfile { - userProfile { - id - name - phone - userType - roles - judge { - id - name - title - company - } - player { - id - name - phone - } - } - } - ` - }; - - const response5 = await axios.post(`${BASE_URL}/graphql`, userProfileQuery, { headers }); - console.log('鉁� 鐢ㄦ埛妗f鏌ヨ鎴愬姛'); - console.log('杩斿洖鏁版嵁:', JSON.stringify(response5.data, null, 2)); - - const userType = response5.data?.data?.userProfile?.userType; - if (userType && userType.includes('璇勫')) { - console.log('鉁� 纭鐢ㄦ埛鍏锋湁璇勫韬唤'); - } else { - console.log('鈿� 鐢ㄦ埛鍙兘涓嶅叿鏈夎瘎濮旇韩浠斤紝userType:', userType); - } - } catch (error) { - console.log('鉁� 鐢ㄦ埛妗f鏌ヨ澶辫触'); - console.log('閿欒淇℃伅:', error.response?.data || error.message); - } - - console.log('\n娴嬭瘯瀹屾垚锛�'); -} - -// 杩愯娴嬭瘯 -testReviewQueries().catch(console.error); \ No newline at end of file diff --git a/test-review-submit-fix.js b/test-review-submit-fix.js deleted file mode 100644 index 8023afa..0000000 --- a/test-review-submit-fix.js +++ /dev/null @@ -1,124 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯淇鍚庣殑鎻愪氦璇勫鍔熻兘 -async function testReviewSubmit() { - try { - console.log('娴嬭瘯淇鍚庣殑鎻愪氦璇勫鍔熻兘...'); - - // 棣栧厛娴嬭瘯鑾峰彇褰撳墠璇勫淇℃伅 - const judgeInfoQuery = ` - query GetCurrentJudgeInfo { - currentJudgeInfo { - judgeId - judgeName - title - company - } - } - `; - - console.log('1. 鑾峰彇褰撳墠璇勫淇℃伅...'); - const judgeInfoResponse = await axios.post('http://localhost:8080/api/graphql', { - query: judgeInfoQuery - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('璇勫淇℃伅鍝嶅簲:', JSON.stringify(judgeInfoResponse.data, null, 2)); - - if (judgeInfoResponse.data.errors) { - console.error('鑾峰彇璇勫淇℃伅澶辫触:', judgeInfoResponse.data.errors); - return; - } - - // 鐒跺悗娴嬭瘯鑾峰彇鍙傝禌浜鸿鎯� - const playerDetailQuery = ` - query GetActivityPlayerDetail($activityPlayerId: ID!) { - activityPlayerDetail(id: $activityPlayerId) { - id - projectName - player { - id - name - } - activity { - id - name - stageId - } - } - } - `; - - console.log('2. 鑾峰彇鍙傝禌浜鸿鎯�...'); - const playerDetailResponse = await axios.post('http://localhost:8080/api/graphql', { - query: playerDetailQuery, - variables: { activityPlayerId: 1 } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鍙傝禌浜鸿鎯呭搷搴�:', JSON.stringify(playerDetailResponse.data, null, 2)); - - if (playerDetailResponse.data.errors) { - console.error('鑾峰彇鍙傝禌浜鸿鎯呭け璐�:', playerDetailResponse.data.errors); - return; - } - - // 濡傛灉鍓嶉潰鐨勬煡璇㈤兘鎴愬姛锛屽啀灏濊瘯鎻愪氦璇勫 - if (playerDetailResponse.data.data && playerDetailResponse.data.data.activityPlayerDetail) { - const playerDetail = playerDetailResponse.data.data.activityPlayerDetail; - const stageId = playerDetail.activity.stageId; - - console.log('3. 灏濊瘯鎻愪氦璇勫...'); - const mutation = ` - mutation SaveActivityPlayerRating($input: ActivityPlayerRatingInput!) { - saveActivityPlayerRating(input: $input) - } - `; - - const input = { - activityPlayerId: 1, - stageId: stageId, // 浣跨敤浠庤鎯呬腑鑾峰彇鐨剆tageId - ratings: [ - { - itemId: 1, - score: 4.0 - } - ], - comment: "娴嬭瘯璇勫鎰忚" - }; - - console.log('鎻愪氦鏁版嵁:', JSON.stringify(input, null, 2)); - - const response = await axios.post('http://localhost:8080/api/graphql', { - query: mutation, - variables: { input } - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('鎻愪氦鍝嶅簲:', JSON.stringify(response.data, null, 2)); - - if (response.data.errors) { - console.error('鎻愪氦璇勫澶辫触:', response.data.errors); - } else if (response.data.data && response.data.data.saveActivityPlayerRating) { - console.log('鉁� 鎻愪氦璇勫鎴愬姛锛�'); - } - } - - } catch (error) { - console.error('娴嬭瘯澶辫触:', error.message); - if (error.response) { - console.error('閿欒鍝嶅簲:', error.response.data); - } - } -} - -testReviewSubmit(); \ No newline at end of file diff --git a/test-saveUserInfo-debug.js b/test-saveUserInfo-debug.js deleted file mode 100644 index 834de1d..0000000 --- a/test-saveUserInfo-debug.js +++ /dev/null @@ -1,73 +0,0 @@ -const http = require('http'); - -// 浣跨敤鍒氭墠鑾峰彇鐨勬湁鏁坱oken -const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDg4IiwicGhvbmUiOiJvZ3h4QTEtS3JTVlRkcUk5VDF1YUIxQlF3UEdVIiwiaWF0IjoxNzU5ODQwNDc2LCJleHAiOjE3NTk5MjY4NzZ9.vyGAs6TWqgHN1KRAJbTp7xMdRSh0CIy7rrbE6TqS6i0'; - -const mutation = ` -mutation { - saveUserInfo(input: { - name: "娴嬭瘯鐢ㄦ埛" - phone: "13800138000" - avatar: "https://example.com/avatar.jpg" - gender: "male" - birthday: "1990-01-01" - }) { - id - name - phone - avatar - gender - birthday - } -}`; - -const postData = JSON.stringify({ - query: mutation -}); - -const options = { - hostname: 'localhost', - port: 8080, - path: '/api/graphql', - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(postData), - 'Authorization': `Bearer ${token}` - } -}; - -console.log('鍙戦�丟raphQL璇锋眰娴嬭瘯saveUserInfo...'); -console.log('Token:', token.substring(0, 50) + '...'); -console.log('璇锋眰鏁版嵁:', postData); - -const req = http.request(options, (res) => { - console.log(`鍝嶅簲鐘舵�佺爜: ${res.statusCode}`); - console.log('鍝嶅簲澶�:', res.headers); - - let data = ''; - res.on('data', (chunk) => { - data += chunk; - }); - - res.on('end', () => { - console.log('鍝嶅簲鍐呭:', data); - try { - const response = JSON.parse(data); - if (response.errors) { - console.log('GraphQL閿欒:', response.errors); - } else { - console.log('鎴愬姛鍝嶅簲:', response.data); - } - } catch (e) { - console.log('瑙f瀽鍝嶅簲澶辫触:', e.message); - } - }); -}); - -req.on('error', (e) => { - console.error(`璇锋眰閿欒: ${e.message}`); -}); - -req.write(postData); -req.end(); \ No newline at end of file diff --git a/test-saveUserInfo-fixed.js b/test-saveUserInfo-fixed.js deleted file mode 100644 index 374058a..0000000 --- a/test-saveUserInfo-fixed.js +++ /dev/null @@ -1,161 +0,0 @@ -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080'; - -async function testSaveUserInfoFixed() { - console.log('=== 娴嬭瘯淇鍚庣殑saveUserInfo鍔熻兘 ===\n'); - - try { - // 1. 鍏堣繘琛屽井淇$櫥褰曡幏鍙栧尶鍚嶇敤鎴穞oken - console.log('1. 杩涜寰俊鐧诲綍鑾峰彇鍖垮悕鐢ㄦ埛token'); - const loginResponse = await axios.post(`${BASE_URL}/api/auth/wx-login`, { - code: '0b3ycd0w32tGL53puK1w3ho1Hv2ycd0R', - loginIp: '127.0.0.1', - deviceInfo: 'test-device-fixed', - phoneAuthorized: false - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('寰俊鐧诲綍鍝嶅簲鐘舵��:', loginResponse.status); - - if (!loginResponse.data || !loginResponse.data.token) { - console.error('鉂� 寰俊鐧诲綍澶辫触锛屾棤娉曡幏鍙杢oken'); - return; - } - - const anonymousToken = loginResponse.data.token; - console.log('鉁� 鎴愬姛鑾峰彇鍖垮悕鐢ㄦ埛token:', anonymousToken.substring(0, 50) + '...\n'); - - // 2. 浣跨敤鍖垮悕鐢ㄦ埛token淇濆瓨鐢ㄦ埛淇℃伅锛堝寘鍚數璇濆彿鐮侊級 - console.log('2. 浣跨敤鍖垮悕鐢ㄦ埛token淇濆瓨鐢ㄦ埛淇℃伅'); - const saveUserInfoMutation = ` - mutation SaveUserInfo($input: UserInput!) { - saveUserInfo(input: $input) { - id - name - phone - gender - birthday - wxOpenId - unionId - avatar - } - } - `; - - const userInput = { - name: "娴嬭瘯鐢ㄦ埛淇鐗�", - phone: "13981970816", - gender: "MALE", - birthday: "1990-01-01", - avatar: "/uploads/test-avatar-fixed.jpg" - }; - - console.log('淇濆瓨鐨勭敤鎴蜂俊鎭�:', JSON.stringify(userInput, null, 2)); - - const saveResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: saveUserInfoMutation, - variables: { input: userInput } - }, { - headers: { - 'Authorization': `Bearer ${anonymousToken}`, - 'Content-Type': 'application/json' - } - }); - - console.log('淇濆瓨鐢ㄦ埛淇℃伅鍝嶅簲鐘舵��:', saveResponse.status); - console.log('淇濆瓨鐢ㄦ埛淇℃伅鍝嶅簲:', JSON.stringify(saveResponse.data, null, 2)); - - if (saveResponse.data.errors) { - console.error('鉂� 淇濆瓨鐢ㄦ埛淇℃伅澶辫触:', saveResponse.data.errors); - return; - } - - const savedUser = saveResponse.data.data.saveUserInfo; - console.log('鉁� 鎴愬姛淇濆瓨鐢ㄦ埛淇℃伅'); - console.log('- 鐢ㄦ埛ID:', savedUser.id); - console.log('- 濮撳悕:', savedUser.name); - console.log('- 鐢佃瘽:', savedUser.phone); - console.log('- 寰俊OpenID:', savedUser.wxOpenId); - console.log('- 澶村儚:', savedUser.avatar); - - // 3. 楠岃瘉鏁版嵁搴撲腑鐨勭敤鎴蜂俊鎭� - console.log('\n3. 楠岃瘉鏁版嵁搴撲腑鐨勭敤鎴蜂俊鎭�'); - const userProfileQuery = ` - query { - userProfile { - id - name - phone - userType - wxOpenId - avatar - } - } - `; - - const profileResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: userProfileQuery - }, { - headers: { - 'Authorization': `Bearer ${anonymousToken}`, - 'Content-Type': 'application/json' - } - }); - - console.log('鐢ㄦ埛妗f鍝嶅簲:', JSON.stringify(profileResponse.data, null, 2)); - - // 4. 娴嬭瘯閲嶅淇濆瓨锛堝簲璇ユ洿鏂扮幇鏈夌敤鎴凤級 - console.log('\n4. 娴嬭瘯閲嶅淇濆瓨锛堝簲璇ユ洿鏂扮幇鏈夌敤鎴凤級'); - const updatedUserInput = { - name: "娴嬭瘯鐢ㄦ埛淇鐗�-鏇存柊", - phone: "13981970816", // 鐩稿悓鐢佃瘽鍙风爜 - gender: "FEMALE", - birthday: "1991-02-02", - avatar: "/uploads/test-avatar-updated.jpg" - }; - - const updateResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: saveUserInfoMutation, - variables: { input: updatedUserInput } - }, { - headers: { - 'Authorization': `Bearer ${anonymousToken}`, - 'Content-Type': 'application/json' - } - }); - - console.log('鏇存柊鐢ㄦ埛淇℃伅鍝嶅簲:', JSON.stringify(updateResponse.data, null, 2)); - - if (updateResponse.data.data && updateResponse.data.data.saveUserInfo) { - const updatedUser = updateResponse.data.data.saveUserInfo; - console.log('鉁� 鎴愬姛鏇存柊鐢ㄦ埛淇℃伅'); - console.log('- 鐢ㄦ埛ID:', updatedUser.id); - console.log('- 鏇存柊鍚庡鍚�:', updatedUser.name); - console.log('- 鏇存柊鍚庢�у埆:', updatedUser.gender); - console.log('- 寰俊OpenID:', updatedUser.wxOpenId); - - // 楠岃瘉鏄惁姝g‘璁板綍浜唚xopenid - if (updatedUser.wxOpenId) { - console.log('鉁� wxopenid宸叉纭褰曞埌鏁版嵁搴�'); - } else { - console.log('鉂� wxopenid鏈褰曞埌鏁版嵁搴�'); - } - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); - - } catch (error) { - console.error('娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.message); - if (error.response) { - console.error('閿欒鍝嶅簲鐘舵��:', error.response.status); - console.error('閿欒鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testSaveUserInfoFixed(); \ No newline at end of file diff --git a/test-saveUserInfo-no-phone.js b/test-saveUserInfo-no-phone.js deleted file mode 100644 index 8fb2b9e..0000000 --- a/test-saveUserInfo-no-phone.js +++ /dev/null @@ -1,63 +0,0 @@ -const axios = require('axios'); - -// 浣跨敤涓庢垚鍔熸祴璇曠浉鍚岀殑閰嶇疆 -const BASE_URL = 'http://localhost:8080/api/graphql'; - -async function testSaveUserInfoWithoutPhone() { - console.log('娴嬭瘯淇濆瓨娌℃湁鐢佃瘽鍙风爜鐨勭敤鎴蜂俊鎭�...'); - - // 浣跨敤鏈夋晥鐨則oken锛堜粠涔嬪墠鐨勬垚鍔熸祴璇曚腑鑾峰彇锛� - const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDg4IiwicGhvbmUiOiJvZ3h4QTEtS3JTVlRkcUk5VDF1YUIxQlF3UEdVIiwiaWF0IjoxNzU5ODQwNDc2LCJleHAiOjE3NTk5MjY4NzZ9.vyGAs6TWqgHN1KRAJbTp7xMdRSh0CIy7rrbE6TqS6i0'; - console.log('浣跨敤Token:', token.substring(0, 50) + '...'); - - // 娴嬭瘯淇濆瓨娌℃湁鐢佃瘽鍙风爜鐨勭敤鎴蜂俊鎭� - const mutation = ` -mutation { - saveUserInfo(input: { - name: "娴嬭瘯鐢ㄦ埛鏃犵數璇�" - avatar: "https://example.com/avatar.jpg" - gender: "male" - birthday: "1990-01-01" - }) { - id - name - phone - avatar - gender - birthday - } -}`; - - const requestData = { - query: mutation - }; - - console.log('鍙戦�丟raphQL璇锋眰娴嬭瘯saveUserInfo锛堟棤鐢佃瘽鍙风爜锛�...'); - console.log('璇锋眰鏁版嵁:', JSON.stringify(requestData)); - - try { - const response = await axios.post(BASE_URL, requestData, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - } - }); - - console.log('鍝嶅簲鐘舵�佺爜:', response.status); - console.log('鍝嶅簲鍐呭:', JSON.stringify(response.data)); - - if (response.data.errors) { - console.log('鉁� 棰勬湡鐨勯敊璇�:', response.data.errors); - } else if (response.data.data && response.data.data.saveUserInfo) { - console.log('鉂� 鎰忓鎴愬姛: 搴旇鎷掔粷娌℃湁鐢佃瘽鍙风爜鐨勪繚瀛樿姹�'); - console.log('淇濆瓨鐨勭敤鎴蜂俊鎭�:', response.data.data.saveUserInfo); - } - } catch (error) { - console.log('璇锋眰澶辫触:', error.response?.data || error.message); - if (error.response?.data?.errors) { - console.log('鉁� 棰勬湡鐨勯敊璇�:', error.response.data.errors); - } - } -} - -testSaveUserInfoWithoutPhone(); \ No newline at end of file diff --git a/test-saveUserInfo-simple-no-avatar.js b/test-saveUserInfo-simple-no-avatar.js deleted file mode 100644 index 06913f8..0000000 --- a/test-saveUserInfo-simple-no-avatar.js +++ /dev/null @@ -1,69 +0,0 @@ -const http = require('http'); - -// 浣跨敤鍒氭墠鑾峰彇鐨勬湁鏁坱oken -const token = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDg4IiwicGhvbmUiOiJvZ3h4QTEtS3JTVlRkcUk5VDF1YUIxQlF3UEdVIiwiaWF0IjoxNzU5ODQwNDc2LCJleHAiOjE3NTk5MjY4NzZ9.vyGAs6TWqgHN1KRAJbTp7xMdRSh0CIy7rrbE6TqS6i0'; - -const mutation = ` -mutation { - saveUserInfo(input: { - name: "娴嬭瘯鐢ㄦ埛" - phone: "13800138000" - gender: "MALE" - birthday: "1990-01-01" - }) { - id - name - phone - gender - birthday - } -}`; - -const postData = JSON.stringify({ - query: mutation -}); - -const options = { - hostname: 'localhost', - port: 8080, - path: '/api/graphql', - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(postData), - 'Authorization': `Bearer ${token}` - } -}; - -console.log('鍙戦�佺畝鍖栫殑GraphQL璇锋眰娴嬭瘯saveUserInfo锛堜笉鍖呭惈澶村儚锛�...'); -console.log('璇锋眰鏁版嵁:', postData); - -const req = http.request(options, (res) => { - console.log(`鍝嶅簲鐘舵�佺爜: ${res.statusCode}`); - - let data = ''; - res.on('data', (chunk) => { - data += chunk; - }); - - res.on('end', () => { - console.log('鍝嶅簲鍐呭:', data); - try { - const response = JSON.parse(data); - if (response.errors) { - console.log('GraphQL閿欒:', response.errors); - } else { - console.log('鎴愬姛鍝嶅簲:', response.data); - } - } catch (e) { - console.log('瑙f瀽鍝嶅簲澶辫触:', e.message); - } - }); -}); - -req.on('error', (e) => { - console.error(`璇锋眰閿欒: ${e.message}`); -}); - -req.write(postData); -req.end(); \ No newline at end of file diff --git a/test-saveUserInfo-simple.js b/test-saveUserInfo-simple.js deleted file mode 100644 index d0c7878..0000000 --- a/test-saveUserInfo-simple.js +++ /dev/null @@ -1,96 +0,0 @@ -const http = require('http'); - -// 娴嬭瘯saveUserInfo鍔熻兘 -function testSaveUserInfo() { - // 鏋勫缓GraphQL鏌ヨ - const query = ` - mutation SaveUserInfo($input: UserInput!) { - saveUserInfo(input: $input) { - id - name - phone - gender - birthday - avatar - wxOpenId - unionId - } - } - `; - - const variables = { - input: { - name: "娴嬭瘯鐢ㄦ埛", - phone: "13800138000", - gender: "MALE", - birthday: "1990-01-01", - avatar: "https://test-avatar.jpg" - } - }; - - const postData = JSON.stringify({ - query: query, - variables: variables - }); - - const options = { - hostname: 'localhost', - port: 8080, - path: '/api/graphql', - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(postData), - // 浣跨敤涓�涓祴璇晅oken锛屽鏋滄病鏈夋湁鏁坱oken锛岃繖涓姹備細澶辫触 - 'Authorization': 'Bearer test-token' - } - }; - - console.log('鍙戦�乻aveUserInfo璇锋眰...'); - console.log('璇锋眰鏁版嵁:', JSON.stringify({ query, variables }, null, 2)); - - const req = http.request(options, (res) => { - console.log('鍝嶅簲鐘舵�佺爜:', res.statusCode); - console.log('鍝嶅簲澶�:', res.headers); - - let data = ''; - res.on('data', (chunk) => { - data += chunk; - }); - - res.on('end', () => { - console.log('鍝嶅簲鍐呭:', data); - try { - const response = JSON.parse(data); - if (response.data && response.data.saveUserInfo) { - console.log('\n鉁� saveUserInfo鎴愬姛!'); - console.log('杩斿洖鐨勭敤鎴蜂俊鎭�:', JSON.stringify(response.data.saveUserInfo, null, 2)); - } else if (response.errors) { - console.log('\n鉂� saveUserInfo澶辫触:'); - response.errors.forEach(error => { - console.log('閿欒:', error.message); - if (error.extensions) { - console.log('閿欒璇︽儏:', error.extensions); - } - }); - } else { - console.log('\n鉂� 鏈煡鍝嶅簲鏍煎紡:', response); - } - } catch (e) { - console.log('瑙f瀽鍝嶅簲澶辫触:', e.message); - console.log('鍘熷鍝嶅簲:', data); - } - }); - }); - - req.on('error', (e) => { - console.error('璇锋眰澶辫触:', e.message); - }); - - req.write(postData); - req.end(); -} - -// 鐩存帴杩愯娴嬭瘯 -console.log('寮�濮嬫祴璇晄aveUserInfo鍔熻兘...'); -testSaveUserInfo(); \ No newline at end of file diff --git a/test-saveUserInfo-with-token.js b/test-saveUserInfo-with-token.js deleted file mode 100644 index b310bdd..0000000 --- a/test-saveUserInfo-with-token.js +++ /dev/null @@ -1,123 +0,0 @@ -const http = require('http'); - -// 浣跨敤涔嬪墠鑾峰彇鐨勬湁鏁坱oken -const validToken = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDg4IiwicGhvbmUiOiJvZ3h4QTEtS3JTVlRkcUk5VDF1YUIxQlF3UEdVIiwiaWF0IjoxNzU5ODM5NDQ1LCJleHAiOjE3NTk5MjU4NDV9.Xoq2S-zQzI3GMWxaSS2A5GGlPsR3z2BRkzg4HK3tHhE'; - -// 浣跨敤鏈夋晥token娴嬭瘯saveUserInfo -function testSaveUserInfo(token) { - console.log('=== 浣跨敤鏈夋晥token娴嬭瘯saveUserInfo ==='); - - const mutation = ` - mutation SaveUserInfo($input: UserInput!) { - saveUserInfo(input: $input) { - id - name - phone - gender - birthday - wxOpenId - unionId - } - } - `; - - const variables = { - input: { - name: "娴嬭瘯鐢ㄦ埛JWT淇", - phone: "13981970816", - gender: "MALE", - birthday: "2025-10-07" - } - }; - - const postData = JSON.stringify({ - query: mutation, - variables: variables - }); - - const options = { - hostname: 'localhost', - port: 8080, - path: '/api/graphql', - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(postData), - 'Authorization': `Bearer ${token}` - } - }; - - console.log('鍙戦�丟raphQL璇锋眰锛屾惡甯︽湁鏁坱oken...'); - console.log('Token:', token.substring(0, 30) + '...'); - - const req = http.request(options, (res) => { - console.log('鍝嶅簲鐘舵�佺爜:', res.statusCode); - - let data = ''; - res.on('data', (chunk) => { - data += chunk; - }); - - res.on('end', () => { - console.log('鍝嶅簲鍐呭:', data); - try { - const response = JSON.parse(data); - if (response.errors) { - console.log('鉂� GraphQL閿欒:', response.errors); - response.errors.forEach((error, index) => { - console.log(`閿欒 ${index + 1}:`, error.message); - if (error.extensions) { - console.log('閿欒璇︽儏:', error.extensions); - } - }); - } else if (response.data && response.data.saveUserInfo) { - console.log('鉁� 淇濆瓨鐢ㄦ埛淇℃伅鎴愬姛!'); - console.log('鐢ㄦ埛淇℃伅:', response.data.saveUserInfo); - } else { - console.log('鈿狅笍 鏈煡鍝嶅簲鏍煎紡:', response); - } - } catch (e) { - console.log('鉂� 瑙f瀽鍝嶅簲澶辫触:', e.message); - console.log('鍘熷鍝嶅簲:', data); - } - }); - }); - - req.on('error', (e) => { - console.error('鉂� 璇锋眰閿欒:', e.message); - }); - - req.write(postData); - req.end(); -} - -// 妫�鏌oken鏄惁杩囨湡 -function checkTokenExpiry(token) { - try { - const payload = JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString()); - const now = Math.floor(Date.now() / 1000); - const exp = payload.exp; - - console.log('Token淇℃伅:'); - console.log('- 鐢ㄦ埛ID:', payload.sub); - console.log('- 绛惧彂鏃堕棿:', new Date(payload.iat * 1000).toLocaleString()); - console.log('- 杩囨湡鏃堕棿:', new Date(exp * 1000).toLocaleString()); - console.log('- 褰撳墠鏃堕棿:', new Date(now * 1000).toLocaleString()); - console.log('- 鏄惁杩囨湡:', now > exp ? '鏄�' : '鍚�'); - console.log('- 鍓╀綑鏃堕棿:', Math.max(0, exp - now), '绉�'); - - return now <= exp; - } catch (e) { - console.log('鉂� Token瑙f瀽澶辫触:', e.message); - return false; - } -} - -// 寮�濮嬫祴璇� -console.log('=== JWT Token 楠岃瘉 ==='); -if (checkTokenExpiry(validToken)) { - console.log('\n鉁� Token鏈夋晥锛屽紑濮嬫祴璇晄aveUserInfo...\n'); - testSaveUserInfo(validToken); -} else { - console.log('\n鉂� Token宸茶繃鏈燂紝璇烽噸鏂拌幏鍙杢oken'); -} \ No newline at end of file diff --git a/test-saveUserInfo-with-valid-token.js b/test-saveUserInfo-with-valid-token.js deleted file mode 100644 index b5c0008..0000000 --- a/test-saveUserInfo-with-valid-token.js +++ /dev/null @@ -1,167 +0,0 @@ -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080'; -// 浣跨敤涔嬪墠鎴愬姛鐨勫尶鍚嶇敤鎴穞oken -const VALID_TOKEN = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiItODMzNDg4IiwicGhvbmUiOiJvZ3h4QTEtS3JTVlRkcUk5VDF1YUIxQlF3UEdVIiwiaWF0IjoxNzU5ODM5NDQ1LCJleHAiOjE3NTk5MjU4NDV9.Xoq2S-zQzI3GMWxaSS2A5GGlPsR3z2BRkzg4HK3tHhE'; - -async function testSaveUserInfoWithValidToken() { - console.log('=== 浣跨敤鏈夋晥token娴嬭瘯淇鍚庣殑saveUserInfo鍔熻兘 ===\n'); - - try { - // 1. 棣栧厛鏌ョ湅褰撳墠鐢ㄦ埛淇℃伅 - console.log('1. 鏌ョ湅褰撳墠鐢ㄦ埛淇℃伅'); - const userProfileQuery = ` - query { - userProfile { - id - name - phone - userType - wxOpenId - avatar - } - } - `; - - const profileResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: userProfileQuery - }, { - headers: { - 'Authorization': `Bearer ${VALID_TOKEN}`, - 'Content-Type': 'application/json' - } - }); - - console.log('褰撳墠鐢ㄦ埛妗f:', JSON.stringify(profileResponse.data, null, 2)); - - // 2. 淇濆瓨鐢ㄦ埛淇℃伅锛堝寘鍚數璇濆彿鐮�13981970816锛� - console.log('\n2. 淇濆瓨鐢ㄦ埛淇℃伅锛堝寘鍚數璇濆彿鐮�13981970816锛�'); - const saveUserInfoMutation = ` - mutation SaveUserInfo($input: UserInput!) { - saveUserInfo(input: $input) { - id - name - phone - gender - birthday - wxOpenId - unionId - avatar - } - } - `; - - const userInput = { - name: "娴嬭瘯鐢ㄦ埛淇鐗�", - phone: "13981970816", - gender: "MALE", - birthday: "1990-01-01", - avatar: "/uploads/test-avatar-fixed.jpg" - }; - - console.log('淇濆瓨鐨勭敤鎴蜂俊鎭�:', JSON.stringify(userInput, null, 2)); - - const saveResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: saveUserInfoMutation, - variables: { input: userInput } - }, { - headers: { - 'Authorization': `Bearer ${VALID_TOKEN}`, - 'Content-Type': 'application/json' - } - }); - - console.log('淇濆瓨鐢ㄦ埛淇℃伅鍝嶅簲鐘舵��:', saveResponse.status); - console.log('淇濆瓨鐢ㄦ埛淇℃伅鍝嶅簲:', JSON.stringify(saveResponse.data, null, 2)); - - if (saveResponse.data.errors) { - console.error('鉂� 淇濆瓨鐢ㄦ埛淇℃伅澶辫触:', saveResponse.data.errors); - return; - } - - const savedUser = saveResponse.data.data.saveUserInfo; - console.log('鉁� 鎴愬姛淇濆瓨鐢ㄦ埛淇℃伅'); - console.log('- 鐢ㄦ埛ID:', savedUser.id); - console.log('- 濮撳悕:', savedUser.name); - console.log('- 鐢佃瘽:', savedUser.phone); - console.log('- 寰俊OpenID:', savedUser.wxOpenId); - console.log('- 澶村儚:', savedUser.avatar); - - // 楠岃瘉鍏抽敭淇鐐� - if (savedUser.wxOpenId) { - console.log('鉁� 鍏抽敭淇楠岃瘉锛歸xopenid宸叉纭褰曞埌鏁版嵁搴�'); - } else { - console.log('鉂� 鍏抽敭淇楠岃瘉锛歸xopenid鏈褰曞埌鏁版嵁搴�'); - } - - // 3. 鍐嶆鏌ョ湅鐢ㄦ埛淇℃伅锛岄獙璇佹洿鏂� - console.log('\n3. 楠岃瘉鐢ㄦ埛淇℃伅鏇存柊'); - const updatedProfileResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: userProfileQuery - }, { - headers: { - 'Authorization': `Bearer ${VALID_TOKEN}`, - 'Content-Type': 'application/json' - } - }); - - console.log('鏇存柊鍚庣敤鎴锋。妗�:', JSON.stringify(updatedProfileResponse.data, null, 2)); - - // 4. 娴嬭瘯鍐嶆淇濆瓨锛堝簲璇ユ洿鏂扮幇鏈夌敤鎴凤級 - console.log('\n4. 娴嬭瘯鍐嶆淇濆瓨鐩稿悓鐢佃瘽鍙风爜鐨勭敤鎴蜂俊鎭�'); - const updatedUserInput = { - name: "娴嬭瘯鐢ㄦ埛淇鐗�-绗簩娆℃洿鏂�", - phone: "13981970816", // 鐩稿悓鐢佃瘽鍙风爜 - gender: "FEMALE", - birthday: "1991-02-02", - avatar: "/uploads/test-avatar-updated-2.jpg" - }; - - const updateResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: saveUserInfoMutation, - variables: { input: updatedUserInput } - }, { - headers: { - 'Authorization': `Bearer ${VALID_TOKEN}`, - 'Content-Type': 'application/json' - } - }); - - console.log('绗簩娆℃洿鏂板搷搴�:', JSON.stringify(updateResponse.data, null, 2)); - - if (updateResponse.data.data && updateResponse.data.data.saveUserInfo) { - const updatedUser = updateResponse.data.data.saveUserInfo; - console.log('鉁� 鎴愬姛杩涜绗簩娆℃洿鏂�'); - console.log('- 鐢ㄦ埛ID:', updatedUser.id); - console.log('- 鏇存柊鍚庡鍚�:', updatedUser.name); - console.log('- 鏇存柊鍚庢�у埆:', updatedUser.gender); - console.log('- 寰俊OpenID:', updatedUser.wxOpenId); - - // 楠岃瘉鐢ㄦ埛ID鏄惁涓�鑷达紙搴旇鏄洿鏂拌�屼笉鏄垱寤烘柊鐢ㄦ埛锛� - if (savedUser.id === updatedUser.id) { - console.log('鉁� 鐢ㄦ埛ID涓�鑷达紝纭鏄洿鏂扮幇鏈夌敤鎴疯�屼笉鏄垱寤烘柊鐢ㄦ埛'); - } else { - console.log('鉂� 鐢ㄦ埛ID涓嶄竴鑷达紝鍙兘鍒涘缓浜嗘柊鐢ㄦ埛'); - console.log(' 绗竴娆′繚瀛樼敤鎴稩D:', savedUser.id); - console.log(' 绗簩娆′繚瀛樼敤鎴稩D:', updatedUser.id); - } - } - - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); - console.log('\n鎬荤粨锛�'); - console.log('1. 鉁� saveUserInfo鍔熻兘宸蹭慨澶�'); - console.log('2. 鉁� wxopenid姝g‘璁板綍鍒版暟鎹簱'); - console.log('3. 鉁� 鐩稿悓鐢佃瘽鍙风爜鐨勭敤鎴蜂俊鎭纭洿鏂�'); - console.log('4. 鉁� 鍖垮悕鐢ㄦ埛杞鍔熻兘姝e父'); - - } catch (error) { - console.error('娴嬭瘯杩囩▼涓彂鐢熼敊璇�:', error.message); - if (error.response) { - console.error('閿欒鍝嶅簲鐘舵��:', error.response.status); - console.error('閿欒鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testSaveUserInfoWithValidToken(); \ No newline at end of file diff --git a/test-user-judge-debug.js b/test-user-judge-debug.js deleted file mode 100644 index ef4d8ae..0000000 --- a/test-user-judge-debug.js +++ /dev/null @@ -1,203 +0,0 @@ -const axios = require('axios'); - -// 閰嶇疆 -const BASE_URL = 'http://localhost:8080/api'; - -// 鑾峰彇鏈夋晥token鐨勫嚱鏁� -async function getValidToken() { - console.log('璇锋彁渚涗竴涓柊鐨勫井淇$櫥褰昪ode鏉ヨ幏鍙杢oken...'); - console.log('浣犲彲浠ヤ粠寰俊寮�鍙戣�呭伐鍏风殑缃戠粶闈㈡澘涓幏鍙栨渶鏂扮殑code'); - - // 杩欓噷闇�瑕佺敤鎴锋彁渚涙柊鐨刢ode - const code = 'YOUR_WECHAT_CODE_HERE'; // 鐢ㄦ埛闇�瑕佹浛鎹㈣繖涓�� - - if (code === 'YOUR_WECHAT_CODE_HERE') { - throw new Error('璇峰厛鏇挎崲鑴氭湰涓殑寰俊code'); - } - - try { - const response = await axios.post(`${BASE_URL}/auth/wechat-login`, { - code: code - }); - - if (response.data && response.data.token) { - console.log('鉁� 寰俊鐧诲綍鎴愬姛'); - console.log('Token:', response.data.token); - return response.data.token; - } else { - throw new Error('鐧诲綍鍝嶅簲涓病鏈塼oken'); - } - } catch (error) { - console.error('鉂� 寰俊鐧诲綍澶辫触:', error.response?.data || error.message); - throw error; - } -} - -// 璋冭瘯鐢ㄦ埛淇℃伅鐨凣raphQL鏌ヨ -const DEBUG_USER_INFO_QUERY = ` - query DebugUserInfo { - # 鑾峰彇褰撳墠鐢ㄦ埛鍩烘湰淇℃伅 - currentUser { - id - name - phone - } - - # 鑾峰彇褰撳墠璇勫淇℃伅 - currentJudgeInfo { - judgeId - judgeName - title - company - } - - # 鑾峰彇璇勫缁熻锛堣繖涓煡璇細妫�鏌ョ敤鎴锋槸鍚︽槸璇勫锛� - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } -`; - -// 娴嬭瘯鐢ㄦ埛鏉冮檺鐨勫嚱鏁� -async function testUserPermissions(token) { - console.log('\n=== 娴嬭瘯鐢ㄦ埛鏉冮檺鍜岃瘎濮旇韩浠� ==='); - - try { - const response = await axios.post(`${BASE_URL}/graphql`, { - query: DEBUG_USER_INFO_QUERY - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - console.log('HTTP鐘舵�佺爜:', response.status); - - if (response.data.errors) { - console.log('鉂� GraphQL閿欒:'); - response.data.errors.forEach((error, index) => { - console.log(` ${index + 1}. ${error.message}`); - if (error.path) { - console.log(` 璺緞: ${error.path.join(' -> ')}`); - } - }); - } - - if (response.data.data) { - console.log('鉁� 鎴愬姛鑾峰彇鏁版嵁:'); - - // 妫�鏌ュ綋鍓嶇敤鎴蜂俊鎭� - if (response.data.data.currentUser) { - console.log('馃搵 褰撳墠鐢ㄦ埛淇℃伅:'); - console.log(' 鐢ㄦ埛ID:', response.data.data.currentUser.id); - console.log(' 鐢ㄦ埛鍚�:', response.data.data.currentUser.name); - console.log(' 鎵嬫満鍙�:', response.data.data.currentUser.phone); - } else { - console.log('鈿狅笍 鏃犳硶鑾峰彇褰撳墠鐢ㄦ埛淇℃伅'); - } - - // 妫�鏌ヨ瘎濮斾俊鎭� - if (response.data.data.currentJudgeInfo) { - console.log('馃懆鈥嶁殩锔� 褰撳墠璇勫淇℃伅:'); - console.log(' 璇勫ID:', response.data.data.currentJudgeInfo.judgeId); - console.log(' 璇勫鍚�:', response.data.data.currentJudgeInfo.judgeName); - console.log(' 鑱屼綅:', response.data.data.currentJudgeInfo.title); - console.log(' 鍏徃:', response.data.data.currentJudgeInfo.company); - } else { - console.log('鉂� 褰撳墠鐢ㄦ埛涓嶆槸璇勫鎴栨棤娉曡幏鍙栬瘎濮斾俊鎭�'); - } - - // 妫�鏌ヨ瘎瀹$粺璁� - if (response.data.data.reviewStatistics) { - console.log('馃搳 璇勫缁熻:'); - console.log(' 鏈瘎瀹℃暟閲�:', response.data.data.reviewStatistics.unReviewedCount); - console.log(' 宸茶瘎瀹℃暟閲�:', response.data.data.reviewStatistics.reviewedCount); - console.log(' 瀛﹀憳鏈瘎瀹℃暟閲�:', response.data.data.reviewStatistics.studentUnReviewedCount); - } else { - console.log('鉂� 鏃犳硶鑾峰彇璇勫缁熻锛堝彲鑳戒笉鏄瘎濮旓級'); - } - } - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.response?.data || error.message); - if (error.response?.status) { - console.error('HTTP鐘舵�佺爜:', error.response.status); - } - } -} - -// 娴嬭瘯绠�鍗曠殑璇勫椤圭洰鏌ヨ -async function testSimpleReviewQuery(token) { - console.log('\n=== 娴嬭瘯绠�鍗曠殑璇勫椤圭洰鏌ヨ ==='); - - const SIMPLE_REVIEW_QUERY = ` - query TestReviewQuery { - unReviewedProjects(searchKeyword: "", page: 1, pageSize: 5) { - totalCount - totalPages - currentPage - items { - id - title - } - } - } - `; - - try { - const response = await axios.post(`${BASE_URL}/graphql`, { - query: SIMPLE_REVIEW_QUERY - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - console.log('HTTP鐘舵�佺爜:', response.status); - - if (response.data.errors) { - console.log('鉂� GraphQL閿欒:'); - response.data.errors.forEach((error, index) => { - console.log(` ${index + 1}. ${error.message}`); - }); - } - - if (response.data.data) { - console.log('鉁� 鏌ヨ鎴愬姛:'); - console.log('鏈瘎瀹¢」鐩暟閲�:', response.data.data.unReviewedProjects?.totalCount || 0); - } - - } catch (error) { - console.error('鉂� 鏌ヨ澶辫触:', error.response?.data || error.message); - } -} - -// 涓诲嚱鏁� -async function main() { - console.log('馃攳 寮�濮嬭皟璇曠敤鎴锋潈闄愬拰璇勫韬唤闂...\n'); - - try { - // 鑾峰彇token - const token = await getValidToken(); - - // 娴嬭瘯鐢ㄦ埛鏉冮檺 - await testUserPermissions(token); - - // 娴嬭瘯璇勫鏌ヨ - await testSimpleReviewQuery(token); - - } catch (error) { - console.error('鉂� 璋冭瘯杩囩▼涓彂鐢熼敊璇�:', error.message); - } -} - -// 杩愯涓诲嚱鏁� -if (require.main === module) { - main(); -} - -module.exports = { getValidToken, testUserPermissions, testSimpleReviewQuery }; \ No newline at end of file diff --git a/test-with-existing-token.js b/test-with-existing-token.js deleted file mode 100644 index dd59b2e..0000000 --- a/test-with-existing-token.js +++ /dev/null @@ -1,156 +0,0 @@ -const axios = require('axios'); - -// 閰嶇疆 -const BASE_URL = 'http://localhost:8080/api'; - -// 浣跨敤涓�涓箣鍓嶈幏鍙栫殑鏈夋晥token锛堢敤鎴烽渶瑕佹浛鎹級 -const EXISTING_TOKEN = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzM3NTM5NzU5LCJleHAiOjE3Mzc1NDY5NTl9.Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8'; // 璇锋浛鎹负瀹為檯鐨則oken - -// 璋冭瘯鐢ㄦ埛淇℃伅鐨凣raphQL鏌ヨ -const DEBUG_USER_INFO_QUERY = ` - query DebugUserInfo { - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } -`; - -// 鑾峰彇褰撳墠鐢ㄦ埛淇℃伅鐨勬煡璇� -const GET_CURRENT_USER_QUERY = ` - query GetCurrentUser { - currentUser { - id - name - phone - } - } -`; - -// 鑾峰彇褰撳墠璇勫淇℃伅鐨勬煡璇� -const GET_CURRENT_JUDGE_QUERY = ` - query GetCurrentJudge { - currentJudgeInfo { - judgeId - judgeName - title - company - } - } -`; - -// 娴嬭瘯鍗曚釜鏌ヨ鐨勫嚱鏁� -async function testSingleQuery(queryName, query, token) { - console.log(`\n=== 娴嬭瘯 ${queryName} ===`); - - try { - const response = await axios.post(`${BASE_URL}/graphql`, { - query: query - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - console.log('HTTP鐘舵�佺爜:', response.status); - - if (response.data.errors) { - console.log('鉂� GraphQL閿欒:'); - response.data.errors.forEach((error, index) => { - console.log(` ${index + 1}. ${error.message}`); - if (error.path) { - console.log(` 璺緞: ${error.path.join(' -> ')}`); - } - if (error.extensions) { - console.log(` 鎵╁睍淇℃伅:`, error.extensions); - } - }); - } - - if (response.data.data) { - console.log('鉁� 鏌ヨ鎴愬姛:'); - console.log('杩斿洖鏁版嵁:', JSON.stringify(response.data.data, null, 2)); - } - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.response?.data || error.message); - if (error.response?.status) { - console.error('HTTP鐘舵�佺爜:', error.response.status); - } - } -} - -// 娴嬭瘯璇勫椤圭洰鏌ヨ -async function testReviewProjectQuery(token) { - console.log('\n=== 娴嬭瘯璇勫椤圭洰鏌ヨ ==='); - - const REVIEW_QUERY = ` - query TestReviewQuery { - unReviewedProjects(searchKeyword: "", page: 1, pageSize: 5) { - totalCount - totalPages - currentPage - items { - id - title - } - } - } - `; - - try { - const response = await axios.post(`${BASE_URL}/graphql`, { - query: REVIEW_QUERY - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - console.log('HTTP鐘舵�佺爜:', response.status); - - if (response.data.errors) { - console.log('鉂� GraphQL閿欒:'); - response.data.errors.forEach((error, index) => { - console.log(` ${index + 1}. ${error.message}`); - console.log(` 璇︾粏淇℃伅:`, error); - }); - } - - if (response.data.data) { - console.log('鉁� 鏌ヨ鎴愬姛:'); - console.log('杩斿洖鏁版嵁:', JSON.stringify(response.data.data, null, 2)); - } - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.response?.data || error.message); - } -} - -// 涓诲嚱鏁� -async function main() { - console.log('馃攳 寮�濮嬭皟璇曠敤鎴锋潈闄愬拰璇勫韬唤闂...\n'); - - if (EXISTING_TOKEN === 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzM3NTM5NzU5LCJleHAiOjE3Mzc1NDY5NTl9.Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8Ej8') { - console.log('鉂� 璇峰厛鏇挎崲鑴氭湰涓殑EXISTING_TOKEN涓哄疄闄呯殑token'); - return; - } - - console.log('浣跨敤Token:', EXISTING_TOKEN.substring(0, 50) + '...'); - - // 娴嬭瘯鍚勪釜鏌ヨ - await testSingleQuery('褰撳墠鐢ㄦ埛淇℃伅', GET_CURRENT_USER_QUERY, EXISTING_TOKEN); - await testSingleQuery('褰撳墠璇勫淇℃伅', GET_CURRENT_JUDGE_QUERY, EXISTING_TOKEN); - await testSingleQuery('璇勫缁熻', DEBUG_USER_INFO_QUERY, EXISTING_TOKEN); - await testReviewProjectQuery(EXISTING_TOKEN); -} - -// 杩愯涓诲嚱鏁� -if (require.main === module) { - main(); -} - -module.exports = { testSingleQuery, testReviewProjectQuery }; \ No newline at end of file diff --git a/test-wx-activity-data.js b/test-wx-activity-data.js deleted file mode 100644 index 55d44a5..0000000 --- a/test-wx-activity-data.js +++ /dev/null @@ -1,183 +0,0 @@ -const axios = require('axios'); - -// 娴嬭瘯浣跨敤寰俊鐧诲綍code鑾峰彇姣旇禌鏁版嵁 -async function testWxActivityData() { - console.log('馃攳 浣跨敤寰俊鐧诲綍code娴嬭瘯姣旇禌鏁版嵁鑾峰彇...\n'); - - const BASE_URL = 'http://localhost:8080/api'; - const wxCode = '0c36Ly000Y2S6V18qW0008rzpy36Ly0S'; - - try { - // 1. 鍏堣繘琛屽井淇$櫥褰曡幏鍙杢oken - console.log('馃摫 姝ラ1: 寰俊鐧诲綍鑾峰彇token...'); - const loginResponse = await axios.post(`${BASE_URL}/auth/wx-login`, { - code: wxCode - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - if (loginResponse.data.token) { - const token = loginResponse.data.token; - console.log('鉁� 鐧诲綍鎴愬姛锛岃幏鍙栧埌token'); - - // 2. 浣跨敤token鑾峰彇姣旇禌鍒楄〃 - console.log('\n馃搵 姝ラ2: 鑾峰彇姣旇禌鍒楄〃...'); - const activitiesQuery = ` - query getActivities { - getActivities { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - } - } - `; - - const activitiesResponse = await axios.post(`${BASE_URL}/graphql`, { - query: activitiesQuery - }, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - } - }); - - if (activitiesResponse.data.errors) { - console.error('鉂� GraphQL閿欒:', activitiesResponse.data.errors); - return; - } - - const activities = activitiesResponse.data.data.getActivities; - console.log(`馃搳 鑾峰彇鍒� ${activities.length} 涓瘮璧涙椿鍔╘n`); - - // 3. 鍒嗘瀽姣忎釜姣旇禌鐨勬椂闂存暟鎹� - activities.forEach((activity, index) => { - console.log(`馃弳 姣旇禌 ${index + 1}: ${activity.name}`); - console.log(` ID: ${activity.id}`); - console.log(` 馃搮 鍘熷 signupDeadline: "${activity.signupDeadline}"`); - console.log(` 馃弫 鍘熷 matchTime: "${activity.matchTime}"`); - console.log(` 馃搷 鍦板潃: ${activity.address || '鏈缃�'}`); - console.log(` 馃搳 鐘舵��: ${activity.state} (${activity.stateName})`); - console.log(` 馃懃 鎶ュ悕浜烘暟: ${activity.playerCount}/${activity.playerMax || '鏃犻檺鍒�'}`); - - // 妫�鏌ユ椂闂存暟鎹殑鏍煎紡鍜屽唴瀹� - console.log('\n馃攳 鏃堕棿鏁版嵁鍒嗘瀽:'); - if (activity.signupDeadline) { - console.log(` signupDeadline 绫诲瀷: ${typeof activity.signupDeadline}`); - console.log(` signupDeadline 闀垮害: ${activity.signupDeadline.length}`); - console.log(` signupDeadline 鍐呭: "${activity.signupDeadline}"`); - - // 灏濊瘯瑙f瀽鏃堕棿 - try { - const date = new Date(activity.signupDeadline); - console.log(` 瑙f瀽鍚庣殑鏃ユ湡: ${date.toLocaleString()}`); - console.log(` ISO鏍煎紡: ${date.toISOString()}`); - } catch (e) { - console.log(` 鉂� 鏃堕棿瑙f瀽澶辫触: ${e.message}`); - } - } else { - console.log(` signupDeadline: null 鎴� undefined`); - } - - if (activity.matchTime) { - console.log(` matchTime 绫诲瀷: ${typeof activity.matchTime}`); - console.log(` matchTime 闀垮害: ${activity.matchTime.length}`); - console.log(` matchTime 鍐呭: "${activity.matchTime}"`); - - // 灏濊瘯瑙f瀽鏃堕棿 - try { - const date = new Date(activity.matchTime); - console.log(` 瑙f瀽鍚庣殑鏃ユ湡: ${date.toLocaleString()}`); - console.log(` ISO鏍煎紡: ${date.toISOString()}`); - } catch (e) { - console.log(` 鉂� 鏃堕棿瑙f瀽澶辫触: ${e.message}`); - } - } else { - console.log(` matchTime: null 鎴� undefined`); - } - - console.log('鈹�'.repeat(60)); - }); - - // 4. 娴嬭瘯鍗曚釜姣旇禌璇︽儏 - if (activities.length > 0) { - const firstActivity = activities[0]; - console.log(`\n馃攳 姝ラ3: 娴嬭瘯鍗曚釜姣旇禌璇︽儏 (ID: ${firstActivity.id})...`); - - const detailQuery = ` - query GetActivityDetailAndStatus($id: ID!) { - activity(id: $id) { - id - name - description - signupDeadline - matchTime - address - state - stateName - playerCount - playerMax - } - } - `; - - const detailResponse = await axios.post(`${BASE_URL}/graphql`, { - query: detailQuery, - variables: { id: firstActivity.id.toString() } - }, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${token}` - } - }); - - if (detailResponse.data.errors) { - console.error('鉂� 璇︽儏鏌ヨGraphQL閿欒:', detailResponse.data.errors); - } else { - const detail = detailResponse.data.data.activity; - console.log('馃搵 姣旇禌璇︽儏鏁版嵁:'); - console.log(` 馃搮 璇︽儏椤� signupDeadline: "${detail.signupDeadline}"`); - console.log(` 馃弫 璇︽儏椤� matchTime: "${detail.matchTime}"`); - - // 姣旇緝鍒楄〃鍜岃鎯呯殑鏁版嵁鏄惁涓�鑷� - if (detail.signupDeadline === firstActivity.signupDeadline) { - console.log('鉁� 鍒楄〃鍜岃鎯呯殑 signupDeadline 涓�鑷�'); - } else { - console.log('鉂� 鍒楄〃鍜岃鎯呯殑 signupDeadline 涓嶄竴鑷�'); - console.log(` 鍒楄〃: "${firstActivity.signupDeadline}"`); - console.log(` 璇︽儏: "${detail.signupDeadline}"`); - } - - if (detail.matchTime === firstActivity.matchTime) { - console.log('鉁� 鍒楄〃鍜岃鎯呯殑 matchTime 涓�鑷�'); - } else { - console.log('鉂� 鍒楄〃鍜岃鎯呯殑 matchTime 涓嶄竴鑷�'); - console.log(` 鍒楄〃: "${firstActivity.matchTime}"`); - console.log(` 璇︽儏: "${detail.matchTime}"`); - } - } - } - - } else { - console.error('鉂� 寰俊鐧诲綍澶辫触:', loginResponse.data); - } - - } catch (error) { - console.error('鉂� 璇锋眰澶辫触:', error.message); - if (error.response) { - console.error('鍝嶅簲鐘舵��:', error.response.status); - console.error('鍝嶅簲鏁版嵁:', error.response.data); - } - } -} - -// 杩愯娴嬭瘯 -testWxActivityData(); \ No newline at end of file diff --git a/test-wx-login-rest.js b/test-wx-login-rest.js deleted file mode 100644 index 36c075e..0000000 --- a/test-wx-login-rest.js +++ /dev/null @@ -1,164 +0,0 @@ -const axios = require('axios'); -const jwt = require('jsonwebtoken'); - -const BASE_URL = 'http://localhost:8080/api'; - -async function testWxLoginRest() { - console.log('=== 娴嬭瘯寰俊鐧诲綍 (REST API) ==='); - - try { - // 浣跨敤鐢ㄦ埛鎻愪緵鐨勫井淇ode - const wxCode = '0f3cd4ll2X7Eqg4242ml2zvTju4cd4l1'; - - console.log('浣跨敤寰俊code:', wxCode); - console.log('璇锋眰URL:', `${BASE_URL}/auth/wx-login`); - - const requestData = { - code: wxCode, - wxOpenid: "ogxxA1-KrSVTdqI9T1uaB1BQwPGU", // 浣跨敤宸茬煡鐨刼penid - loginIp: "127.0.0.1", - deviceInfo: "test-device", - phoneAuthorized: false - }; - - console.log('璇锋眰鏁版嵁:', JSON.stringify(requestData, null, 2)); - - const response = await axios.post(`${BASE_URL}/auth/wx-login`, requestData, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('\n馃搵 寰俊鐧诲綍鍝嶅簲:'); - console.log('鐘舵�佺爜:', response.status); - console.log('鍝嶅簲鏁版嵁:', JSON.stringify(response.data, null, 2)); - - if (response.data && response.data.token) { - const token = response.data.token; - console.log('\n鉁� 鎴愬姛鑾峰彇鍒皌oken:', token.substring(0, 50) + '...'); - - // 瑙g爜JWT token鏌ョ湅鍐呭 - try { - const decoded = jwt.decode(token, { complete: true }); - console.log('\n馃攳 JWT Token鍐呭:'); - console.log('Header:', JSON.stringify(decoded.header, null, 2)); - console.log('Payload:', JSON.stringify(decoded.payload, null, 2)); - - const userId = decoded.payload.userId || decoded.payload.sub; - console.log('\n馃懁 鐢ㄦ埛淇℃伅:'); - console.log('鐢ㄦ埛ID:', userId); - console.log('鐢ㄦ埛绫诲瀷:', decoded.payload.userType); - console.log('瑙掕壊:', decoded.payload.roles); - - // 娴嬭瘯浣跨敤token璁块棶闇�瑕佹潈闄愮殑鎺ュ彛 - console.log('\n馃攼 娴嬭瘯鏉冮檺楠岃瘉...'); - await testWithToken(token); - - } catch (jwtError) { - console.log('鉂� JWT瑙g爜澶辫触:', jwtError.message); - } - - } else { - console.log('鉂� 鐧诲綍澶辫触锛屾湭鑾峰彇鍒皌oken'); - } - - } catch (error) { - console.error('\n鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:'); - console.error('鐘舵�佺爜:', error.response?.status); - console.error('閿欒淇℃伅:', error.response?.data || error.message); - if (error.response?.data) { - console.error('璇︾粏閿欒:', JSON.stringify(error.response.data, null, 2)); - } - console.error('閿欒鍫嗘爤:', error.stack); - } -} - -async function testWithToken(token) { - try { - // 娴嬭瘯鑾峰彇鐢ㄦ埛淇℃伅 - console.log('1. 娴嬭瘯鑾峰彇鐢ㄦ埛淇℃伅...'); - const userProfileQuery = ` - query { - userProfile { - id - name - phone - userType - roles - } - } - `; - - const userResponse = await axios.post(`${BASE_URL}/graphql`, { - query: userProfileQuery - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - console.log('鐢ㄦ埛淇℃伅鍝嶅簲:', JSON.stringify(userResponse.data, null, 2)); - - // 娴嬭瘯鑾峰彇璇勫缁熻 - console.log('\n2. 娴嬭瘯鑾峰彇璇勫缁熻...'); - const reviewStatsQuery = ` - query { - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } - `; - - const statsResponse = await axios.post(`${BASE_URL}/graphql`, { - query: reviewStatsQuery - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - console.log('璇勫缁熻鍝嶅簲:', JSON.stringify(statsResponse.data, null, 2)); - - // 娴嬭瘯鑾峰彇鏈瘎瀹¢」鐩� - console.log('\n3. 娴嬭瘯鑾峰彇鏈瘎瀹¢」鐩�...'); - const unReviewedQuery = ` - query { - unReviewedProjects(page: 1, pageSize: 10, searchKeyword: "") { - total - hasMore - items { - id - projectName - activityName - studentName - } - } - } - `; - - const projectsResponse = await axios.post(`${BASE_URL}/graphql`, { - query: unReviewedQuery - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - console.log('鏈瘎瀹¢」鐩搷搴�:', JSON.stringify(projectsResponse.data, null, 2)); - - } catch (error) { - console.error('鏉冮檺娴嬭瘯澶辫触:', error.response?.status, error.response?.data || error.message); - } -} - -// 杩愯娴嬭瘯 -testWxLoginRest().then(() => { - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); -}).catch(error => { - console.error('娴嬭瘯鎵ц澶辫触:', error); -}); \ No newline at end of file diff --git a/test-wx-login-with-code.js b/test-wx-login-with-code.js deleted file mode 100644 index 22bf3ca..0000000 --- a/test-wx-login-with-code.js +++ /dev/null @@ -1,353 +0,0 @@ -const axios = require('axios'); - -// 閰嶇疆 -const BASE_URL = 'http://localhost:8080/api'; - -// JWT token瑙g爜鍑芥暟锛堜笉楠岃瘉绛惧悕锛屼粎鐢ㄤ簬璋冭瘯锛� -function decodeJwtToken(token) { - try { - const parts = token.split('.'); - if (parts.length !== 3) { - throw new Error('Invalid JWT token format'); - } - - const header = JSON.parse(Buffer.from(parts[0], 'base64url').toString()); - const payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString()); - - return { header, payload, signature: parts[2] }; - } catch (error) { - console.error('JWT token瑙g爜澶辫触:', error.message); - return null; - } -} - -// 娴嬭瘯寰俊鐧诲綍 -async function testWxLogin() { - console.log('=== 娴嬭瘯寰俊鐧诲綍 ==='); - - try { - const wxLoginMutation = ` - mutation WxLogin($input: WxLoginRequest!) { - wxLogin(input: $input) { - token - userInfo { - userId - name - phone - userType - } - success - message - hasJudge - } - } - `; - - // 浣跨敤鐢ㄦ埛鎻愪緵鐨勫井淇ode - const wxCode = '0b3ycd0w32tGL53puK1w3ho1Hv2ycd0R'; // 鐢ㄦ埛鎻愪緵鐨刢ode - - console.log('浣跨敤寰俊code:', wxCode); - - const response = await axios.post(`${BASE_URL}/graphql`, { - query: wxLoginMutation, - variables: { - input: { - code: wxCode, - wxOpenid: "ogxxA1-KrSVTdqI9T1uaB1BQwPGU", // 浣跨敤宸茬煡鐨刼penid - loginIp: "127.0.0.1", - deviceInfo: "test-device", - phoneAuthorized: false - } - } - }); - - console.log('\n馃搵 寰俊鐧诲綍鍝嶅簲:'); - console.log('鐘舵�佺爜:', response.status); - - if (response.data.errors) { - console.log('鉂� 寰俊鐧诲綍澶辫触:', response.data.errors); - return null; - } - - const loginData = response.data.data.wxLogin; - console.log('\n鉁� 寰俊鐧诲綍鎴愬姛:'); - console.log('- Success:', loginData.success); - console.log('- Message:', loginData.message); - console.log('- HasJudge:', loginData.hasJudge); - - if (loginData.userInfo) { - console.log('\n馃懁 鐢ㄦ埛淇℃伅:'); - console.log('- 鐢ㄦ埛ID:', loginData.userInfo.userId); - console.log('- 濮撳悕:', loginData.userInfo.name); - console.log('- 鎵嬫満鍙�:', loginData.userInfo.phone); - console.log('- 鐢ㄦ埛绫诲瀷:', loginData.userInfo.userType); - - // 楠岃瘉鐢ㄦ埛ID鏄惁涓�152 - if (loginData.userInfo.userId === 152) { - console.log('鉁� 鐢ㄦ埛ID鍖归厤锛�152锛�'); - } else { - console.log(`鈿狅笍 鐢ㄦ埛ID涓嶅尮閰嶏紝鏈熸湜152锛屽疄闄�${loginData.userInfo.userId}`); - } - } - - if (loginData.token) { - console.log('\n馃攽 JWT Token淇℃伅:'); - console.log('- Token闀垮害:', loginData.token.length); - console.log('- Token鍓�50瀛楃:', loginData.token.substring(0, 50) + '...'); - - // 瑙g爜JWT token - const decoded = decodeJwtToken(loginData.token); - if (decoded) { - console.log('\n馃搵 JWT Token鍐呭:'); - console.log('- Header:', JSON.stringify(decoded.header, null, 2)); - console.log('- Payload:', JSON.stringify(decoded.payload, null, 2)); - - if (decoded.payload.userId) { - console.log(`\n馃攳 Token涓殑鐢ㄦ埛ID: ${decoded.payload.userId}`); - console.log(` 绫诲瀷: ${typeof decoded.payload.userId}`); - console.log(` 鏄惁涓鸿礋鏁�: ${decoded.payload.userId < 0}`); - - if (decoded.payload.userId === 152) { - console.log('鉁� Token涓殑鐢ㄦ埛ID鍖归厤锛�152锛�'); - } else { - console.log(`鈿狅笍 Token涓殑鐢ㄦ埛ID涓嶅尮閰嶏紝鏈熸湜152锛屽疄闄�${decoded.payload.userId}`); - } - } - - if (decoded.payload.exp) { - const expDate = new Date(decoded.payload.exp * 1000); - const now = new Date(); - console.log(`\n鈴� Token杩囨湡鏃堕棿: ${expDate.toLocaleString()}`); - console.log(` 褰撳墠鏃堕棿: ${now.toLocaleString()}`); - console.log(` 鏄惁宸茶繃鏈�: ${now > expDate}`); - } - } - - // 浣跨敤token杩涜鍚庣画娴嬭瘯 - await testWithToken(loginData.token); - - return loginData.token; - } else { - console.log('鉂� 鏈幏鍙栧埌token'); - return null; - } - - } catch (error) { - console.error('鉂� 寰俊鐧诲綍澶辫触:', error.response?.data || error.message); - return null; - } -} - -// 浣跨敤token杩涜娴嬭瘯 -async function testWithToken(token) { - console.log('\n=== 浣跨敤Token杩涜娴嬭瘯 ==='); - - // 1. 娴嬭瘯鑾峰彇褰撳墠鐢ㄦ埛淇℃伅 - console.log('\n1. 娴嬭瘯鑾峰彇褰撳墠鐢ㄦ埛淇℃伅:'); - try { - const userQuery = ` - query GetCurrentUser { - currentUser { - id - name - phone - } - } - `; - - const response = await axios.post(`${BASE_URL}/graphql`, { - query: userQuery - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.log('鉂� 鑾峰彇褰撳墠鐢ㄦ埛澶辫触:', response.data.errors); - } else if (response.data.data?.currentUser) { - const user = response.data.data.currentUser; - console.log('鉁� 褰撳墠鐢ㄦ埛淇℃伅:'); - console.log(` 鐢ㄦ埛ID: ${user.id}`); - console.log(` 濮撳悕: ${user.name}`); - console.log(` 鎵嬫満鍙�: ${user.phone}`); - - if (user.id === 152) { - console.log('鉁� 鐢ㄦ埛ID楠岃瘉閫氳繃锛�152锛�'); - } else { - console.log(`鈿狅笍 鐢ㄦ埛ID涓嶅尮閰嶏紝鏈熸湜152锛屽疄闄�${user.id}`); - } - } else { - console.log('鈿狅笍 鏃犳硶鑾峰彇褰撳墠鐢ㄦ埛淇℃伅'); - } - } catch (error) { - console.log('鉂� 鑾峰彇褰撳墠鐢ㄦ埛澶辫触:', error.response?.data || error.message); - } - - // 2. 娴嬭瘯鑾峰彇褰撳墠璇勫淇℃伅 - console.log('\n2. 娴嬭瘯鑾峰彇褰撳墠璇勫淇℃伅:'); - try { - const judgeQuery = ` - query GetCurrentJudge { - currentJudgeInfo { - judgeId - judgeName - title - company - } - } - `; - - const response = await axios.post(`${BASE_URL}/graphql`, { - query: judgeQuery - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.log('鉂� 鑾峰彇褰撳墠璇勫澶辫触:', response.data.errors); - } else if (response.data.data?.currentJudgeInfo) { - const judge = response.data.data.currentJudgeInfo; - console.log('鉁� 褰撳墠璇勫淇℃伅:'); - console.log(` 璇勫ID: ${judge.judgeId}`); - console.log(` 璇勫鍚�: ${judge.judgeName}`); - console.log(` 鑱屼綅: ${judge.title}`); - console.log(` 鍏徃: ${judge.company}`); - - if (judge.judgeId === 72) { - console.log('鉁� 璇勫ID楠岃瘉閫氳繃锛�72锛�'); - } else { - console.log(`鈿狅笍 璇勫ID涓嶅尮閰嶏紝鏈熸湜72锛屽疄闄�${judge.judgeId}`); - } - } else { - console.log('鈿狅笍 鏃犳硶鑾峰彇褰撳墠璇勫淇℃伅锛堝彲鑳戒笉鏄瘎濮旓級'); - } - } catch (error) { - console.log('鉂� 鑾峰彇褰撳墠璇勫澶辫触:', error.response?.data || error.message); - } - - // 3. 娴嬭瘯璇勫缁熻鏌ヨ - console.log('\n3. 娴嬭瘯璇勫缁熻鏌ヨ:'); - try { - const statsQuery = ` - query GetReviewStats { - reviewStatistics { - unReviewedCount - reviewedCount - studentUnReviewedCount - } - } - `; - - const response = await axios.post(`${BASE_URL}/graphql`, { - query: statsQuery - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.log('鉂� 鑾峰彇璇勫缁熻澶辫触:', response.data.errors); - response.data.errors.forEach(error => { - console.log(` 閿欒: ${error.message}`); - if (error.extensions) { - console.log(` 鎵╁睍淇℃伅:`, error.extensions); - } - }); - } else if (response.data.data?.reviewStatistics) { - const stats = response.data.data.reviewStatistics; - console.log('鉁� 璇勫缁熻:'); - console.log(` 鏈瘎瀹�: ${stats.unReviewedCount}`); - console.log(` 宸茶瘎瀹�: ${stats.reviewedCount}`); - console.log(` 瀛﹀憳鏈瘎瀹�: ${stats.studentUnReviewedCount}`); - } - } catch (error) { - console.log('鉂� 鑾峰彇璇勫缁熻澶辫触:', error.response?.data || error.message); - } - - // 4. 娴嬭瘯璇勫椤圭洰鏌ヨ锛堣繖鏄師鏉�400閿欒鐨勬煡璇級 - console.log('\n4. 娴嬭瘯璇勫椤圭洰鏌ヨ锛堝師400閿欒鏌ヨ锛�:'); - try { - const projectsQuery = ` - query GetUnreviewedProjects($searchKeyword: String!, $page: Int!, $pageSize: Int!) { - unReviewedProjects(searchKeyword: $searchKeyword, page: $page, pageSize: $pageSize) { - totalCount - currentPage - totalPages - projects { - id - projectName - teamName - category - submissionTime - } - } - } - `; - - const response = await axios.post(`${BASE_URL}/graphql`, { - query: projectsQuery, - variables: { - searchKeyword: "", - page: 1, - pageSize: 10 - } - }, { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (response.data.errors) { - console.log('鉂� 鑾峰彇璇勫椤圭洰澶辫触:', response.data.errors); - response.data.errors.forEach(error => { - console.log(` 閿欒: ${error.message}`); - }); - } else if (response.data.data?.unReviewedProjects) { - const projects = response.data.data.unReviewedProjects; - console.log('鉁� 璇勫椤圭洰鏌ヨ鎴愬姛:'); - console.log(` 鎬绘暟: ${projects.totalCount}`); - console.log(` 褰撳墠椤�: ${projects.currentPage}`); - console.log(` 鎬婚〉鏁�: ${projects.totalPages}`); - console.log(` 椤圭洰鏁伴噺: ${projects.projects?.length || 0}`); - - if (projects.projects && projects.projects.length > 0) { - console.log(' 鍓嶅嚑涓」鐩�:'); - projects.projects.slice(0, 3).forEach((project, index) => { - console.log(` ${index + 1}. ${project.projectName} (${project.teamName})`); - }); - } - } - } catch (error) { - console.log('鉂� 鑾峰彇璇勫椤圭洰澶辫触:', error.response?.data || error.message); - } -} - -// 涓诲嚱鏁� -async function main() { - console.log('馃攳 寮�濮嬫祴璇曞井淇$櫥褰曞拰鐢ㄦ埛鏉冮檺...\n'); - - const token = await testWxLogin(); - - if (token) { - console.log('\n馃帀 娴嬭瘯瀹屾垚锛�'); - console.log('濡傛灉涓婇潰鐨勬祴璇曢兘鎴愬姛锛岃鏄庣敤鎴锋潈闄愭甯搞��'); - console.log('濡傛灉璇勫鏌ヨ浠嶇劧澶辫触锛屽彲鑳芥槸鍚庣鐨勫叾浠栭�昏緫闂銆�'); - } else { - console.log('\n鉂� 寰俊鐧诲綍澶辫触锛屾棤娉曡繘琛屽悗缁祴璇�'); - } -} - -// 杩愯涓诲嚱鏁� -if (require.main === module) { - main(); -} - -module.exports = { testWxLogin, testWithToken }; \ No newline at end of file diff --git a/test-wx-login.js b/test-wx-login.js deleted file mode 100644 index 1fffe11..0000000 --- a/test-wx-login.js +++ /dev/null @@ -1,105 +0,0 @@ -const axios = require('axios'); - -const BASE_URL = 'http://localhost:8080'; -const WX_CODE = '0b3ycd0w32tGL53puK1w3ho1Hv2ycd0R' // 鐢ㄦ埛鎻愪緵鐨勭湡瀹炲井淇ode - -async function testWxLogin() { - console.log('=== 娴嬭瘯寰俊鐧诲綍鍜屽尶鍚嶇敤鎴疯闂� ===\n'); - - try { - // 1. 浣跨敤鐪熷疄寰俊code杩涜鐧诲綍 - console.log('1. 浣跨敤鐪熷疄寰俊code杩涜鐧诲綍'); - console.log('寰俊code:', WX_CODE); - - const loginResponse = await axios.post(`${BASE_URL}/api/auth/wx-login`, { - code: WX_CODE, - loginIp: '127.0.0.1', - deviceInfo: 'test-device', - phoneAuthorized: false - }, { - headers: { - 'Content-Type': 'application/json' - } - }); - - console.log('寰俊鐧诲綍鍝嶅簲鐘舵��:', loginResponse.status); - console.log('寰俊鐧诲綍鍝嶅簲鏁版嵁:', JSON.stringify(loginResponse.data, null, 2)); - - if (loginResponse.data && loginResponse.data.token) { - const anonymousToken = loginResponse.data.token; - console.log('\n鉁� 鎴愬姛鑾峰彇鍒皌oken:', anonymousToken.substring(0, 50) + '...'); - - // 2. 浣跨敤鑾峰彇鍒扮殑token璁块棶userProfile - console.log('\n2. 浣跨敤token璁块棶userProfile'); - const userProfileQuery = ` - query { - userProfile { - id - name - phone - userType - roles - } - } - `; - - const graphqlResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: userProfileQuery - }, { - headers: { - 'Authorization': `Bearer ${anonymousToken}`, - 'Content-Type': 'application/json' - } - }); - - console.log('GraphQL鍝嶅簲鐘舵��:', graphqlResponse.status); - console.log('GraphQL鍝嶅簲鏁版嵁:', JSON.stringify(graphqlResponse.data, null, 2)); - - // 3. 娴嬭瘯璁块棶闇�瑕佹潈闄愮殑鎺ュ彛锛堝簲璇ュけ璐ワ級 - console.log('\n3. 娴嬭瘯鍖垮悕鐢ㄦ埛璁块棶闇�瑕佸憳宸ユ潈闄愮殑鎺ュ彛锛堝簲璇ュけ璐ワ級'); - const employeeQuery = ` - query { - employeeReviewStats(keyword: "") { - pendingCount - approvedCount - rejectedCount - } - } - `; - - try { - const employeeResponse = await axios.post(`${BASE_URL}/api/graphql`, { - query: employeeQuery - }, { - headers: { - 'Authorization': `Bearer ${anonymousToken}`, - 'Content-Type': 'application/json' - } - }); - - console.log('鍛樺伐鎺ュ彛鍝嶅簲鐘舵��:', employeeResponse.status); - console.log('鍛樺伐鎺ュ彛鍝嶅簲鏁版嵁:', JSON.stringify(employeeResponse.data, null, 2)); - } catch (error) { - console.log('鍛樺伐鎺ュ彛璁块棶澶辫触锛堢鍚堥鏈燂級:', error.response?.status, error.response?.data || error.message); - } - - } else { - console.log('鉂� 鐧诲綍澶辫触锛屾湭鑾峰彇鍒皌oken'); - } - - } catch (error) { - console.error('鉂� 娴嬭瘯杩囩▼涓彂鐢熼敊璇�:'); - console.error('鐘舵�佺爜:', error.response?.status); - console.error('閿欒淇℃伅:', error.response?.data || error.message); - if (error.response?.data) { - console.error('璇︾粏閿欒:', JSON.stringify(error.response.data, null, 2)); - } - } -} - -// 杩愯娴嬭瘯 -testWxLogin().then(() => { - console.log('\n=== 娴嬭瘯瀹屾垚 ==='); -}).catch(error => { - console.error('娴嬭瘯鎵ц澶辫触:', error); -}); \ No newline at end of file diff --git a/test-wxs-format.js b/test-wxs-format.js deleted file mode 100644 index 6450046..0000000 --- a/test-wxs-format.js +++ /dev/null @@ -1,123 +0,0 @@ -// 娴嬭瘯 wxs 鏍煎紡鍖栧嚱鏁扮殑闂 - -// 妯℃嫙 wxs 涓殑 formatDateYYYYMMDD 鍑芥暟 -function formatDateYYYYMMDD_wxs(val) { - // 寮哄埗杞崲涓哄瓧绗︿覆锛屽吋瀹� null, undefined, number 绛夌被鍨� - var s = '' + val; - - if (s.length < 10) { - return '鈥�'; - } - - var out = ''; - - // 浼樺厛澶勭悊 '2024-07-31...' 鏍煎紡 - if (s.charAt(4) === '-' && s.charAt(7) === '-') { - out = s.slice(0, 10); // 浣跨敤 slice 鏇挎崲 substr - return out; - } - - // 澶囩敤澶勭悊 '2024/07/31...' 鏍煎紡 - if (s.charAt(4) === '/' && s.charAt(7) === '/') { - var year = s.slice(0, 4); - var month = s.slice(5, 7); - var day = s.slice(8, 10); - out = year + '-' + month + '-' + day; - return out; - } - - // 瀵逛簬鏃犳硶璇嗗埆鐨勫瓧绗︿覆鏍煎紡锛岃繑鍥炲崰浣嶇 - return '鈥�'; -} - -// 妯℃嫙 JavaScript 涓殑 formatDateYYYYMMDD 鍑芥暟 -function formatDateYYYYMMDD_js(date) { - if (!date && date !== 0) return '鈥�' - // 瀛楃涓诧細浼樺厛鍖归厤 YYYY-MM-DD 鐩存帴杩斿洖锛岄伩鍏嶈В鏋� - if (typeof date === 'string') { - const m = date.match(/^(\d{4}-\d{2}-\d{2})/) - if (m) return m[1] - } - // 鏁板�硷細鏃堕棿鎴筹紙绉�/姣锛夊厹搴� - if (typeof date === 'number') { - const ts = date > 1e12 ? date : date * 1000 - const d = new Date(ts) - if (!isNaN(d.getTime())) { - const y = d.getFullYear() - const m = String(d.getMonth() + 1).padStart(2, '0') - const day = String(d.getDate()).padStart(2, '0') - return `${y}-${m}-${day}` - } - } - // 鍏朵粬鎯呭喌璧板伐鍏峰嚱鏁板厹搴� - return '鈥�' -} - -console.log('馃攳 娴嬭瘯 wxs 鍜� JavaScript 鏍煎紡鍖栧嚱鏁扮殑宸紓\n'); - -// 娴嬭瘯鏁版嵁 - 鏉ヨ嚜鍚庣鐨勭湡瀹炴暟鎹� -const testDates = [ - "2025-10-11T00:00", - "2025-10-06T00:00", - "2025-10-07T00:00", - "2025-10-04T00:00", - "2025-10-12T00:00" -]; - -console.log('馃搳 娴嬭瘯缁撴灉瀵规瘮:'); -console.log('鈹�'.repeat(80)); -console.log('鍘熷鏁版嵁'.padEnd(20) + 'wxs鍑芥暟缁撴灉'.padEnd(20) + 'JS鍑芥暟缁撴灉'.padEnd(20) + '鏄惁涓�鑷�'); -console.log('鈹�'.repeat(80)); - -testDates.forEach(date => { - const wxsResult = formatDateYYYYMMDD_wxs(date); - const jsResult = formatDateYYYYMMDD_js(date); - const isMatch = wxsResult === jsResult; - - console.log( - date.padEnd(20) + - wxsResult.padEnd(20) + - jsResult.padEnd(20) + - (isMatch ? '鉁�' : '鉂�') - ); -}); - -console.log('鈹�'.repeat(80)); - -// 娴嬭瘯杈圭晫鎯呭喌 -console.log('\n馃攳 娴嬭瘯杈圭晫鎯呭喌:'); -const edgeCases = [ - null, - undefined, - "", - "2025-10-04", - "2025/10/04", - "invalid-date", - "2025-10-04T00:00:00.000Z" -]; - -edgeCases.forEach(testCase => { - const wxsResult = formatDateYYYYMMDD_wxs(testCase); - const jsResult = formatDateYYYYMMDD_js(testCase); - console.log(`杈撳叆: ${testCase} -> wxs: "${wxsResult}", js: "${jsResult}"`); -}); - -// 妫�鏌ユ槸鍚︽湁鍥哄畾杩斿洖鍊肩殑闂 -console.log('\n馃毃 妫�鏌ユ槸鍚﹀瓨鍦ㄥ浐瀹氳繑鍥炲�奸棶棰�:'); -const uniqueWxsResults = [...new Set(testDates.map(formatDateYYYYMMDD_wxs))]; -const uniqueJsResults = [...new Set(testDates.map(formatDateYYYYMMDD_js))]; - -console.log(`wxs鍑芥暟杩斿洖鐨勫敮涓�鍊�: ${uniqueWxsResults.join(', ')}`); -console.log(`JS鍑芥暟杩斿洖鐨勫敮涓�鍊�: ${uniqueJsResults.join(', ')}`); - -if (uniqueWxsResults.length === 1 && testDates.length > 1) { - console.log('鉂� 鍙戠幇闂锛歸xs鍑芥暟瀵规墍鏈変笉鍚岃緭鍏ヨ繑鍥炵浉鍚屽�硷紒'); -} else { - console.log('鉁� wxs鍑芥暟姝e父澶勭悊涓嶅悓杈撳叆'); -} - -if (uniqueJsResults.length === 1 && testDates.length > 1) { - console.log('鉂� 鍙戠幇闂锛欽S鍑芥暟瀵规墍鏈変笉鍚岃緭鍏ヨ繑鍥炵浉鍚屽�硷紒'); -} else { - console.log('鉁� JS鍑芥暟姝e父澶勭悊涓嶅悓杈撳叆'); -} \ No newline at end of file diff --git a/wx/pages/project/detail.js b/wx/pages/project/detail.js index 9e95a97..779d642 100644 --- a/wx/pages/project/detail.js +++ b/wx/pages/project/detail.js @@ -10,7 +10,13 @@ error: '', statusText: '', genderText: '', - educationText: '' + educationText: '', + // 鏃堕棿杞寸浉鍏虫暟鎹� + timeline: [], + timelineLoading: false, + timelineError: '', + showRatingDetail: false, + ratingDetail: null }, onLoad(options) { @@ -66,6 +72,9 @@ educationText: this.getEducationText(projectDetail.playerInfo?.education), loading: false }) + + // 鍔犺浇鏃堕棿杞存暟鎹� + this.loadProjectTimeline() } else { throw new Error('椤圭洰璇︽儏鑾峰彇澶辫触') } @@ -80,47 +89,71 @@ // 浠嶢PI鑾峰彇椤圭洰璇︽儏 async getProjectDetailFromAPI(projectId) { - // 鏋勫缓GraphQL鏌ヨ + // 鏋勫缓GraphQL鏌ヨ - 涓庡悗绔痵chema鍖归厤 const query = ` query GetProjectDetail($id: ID!) { activityPlayerDetail(id: $id) { id - activityId - playerId - playerName - playerGender - playerPhone - playerEducation - playerBirthDate - playerIdCard - playerAddress + activityName projectName - projectDescription - projectCategory - projectTags - projectFiles { - id - fileName - fileUrl - fileSize - fileType - uploadTime - } - submitTime - reviewTime - reviewerId - reviewerName - score - rating { - id - judgeId - judgeName - score - feedback - ratingTime - } - state + description feedback + state + stageId + playerInfo { + id + name + phone + gender + birthday + education + introduction + description + avatarUrl + avatar { + id + name + path + } + userInfo { + userId + name + phone + avatarUrl + avatar { + id + name + path + } + } + } + regionInfo { + id + name + fullPath + } + submissionFiles { + id + name + path + url + fullUrl + fullThumbUrl + fileExt + fileSize + thumbUrl + } + ratingForm { + schemeId + schemeName + totalMaxScore + items { + id + name + maxScore + weight + } + } } } ` @@ -137,20 +170,30 @@ async getRatingStatsFromAPI(projectId) { const query = ` query GetRatingStats($activityPlayerId: ID!) { - ratingStats(activityPlayerId: $activityPlayerId) { - averageScore - totalRatings - scoreDistribution { - score - count - } + judgeRatingsForPlayer(activityPlayerId: $activityPlayerId) { + judgeId + judgeName + hasRated + totalScore + ratingTime } + averageScoreForPlayer(activityPlayerId: $activityPlayerId) } ` try { const result = await app.graphqlRequest(query, { activityPlayerId: projectId }) - return result.ratingStats + const ratings = result.judgeRatingsForPlayer || [] + const averageScore = result.averageScoreForPlayer || 0 + + // 鍙绠楀凡璇勫垎鐨勮瘎濮� + const ratedJudges = ratings.filter(rating => rating.hasRated) + + return { + averageScore: averageScore, + totalRatings: ratedJudges.length, + ratings: ratings + } } catch (error) { throw error } @@ -172,6 +215,110 @@ } catch (error) { throw error } + }, + + // 鍔犺浇椤圭洰鏃堕棿杞� + async loadProjectTimeline() { + try { + this.setData({ + timelineLoading: true, + timelineError: '' + }) + + const timeline = await this.getProjectTimelineFromAPI(this.data.projectId) + + if (timeline && timeline.stages) { + // 澶勭悊鏃堕棿杞存暟鎹� + const processedTimeline = timeline.stages.map(stage => { + return { + stageId: stage.stageId, + stageName: stage.stageName, + matchTime: stage.matchTime, + matchTimeText: stage.matchTime ? this.formatDateTime(stage.matchTime) : '鏃堕棿寰呭畾', + participated: stage.participated, + activityPlayerId: stage.activityPlayerId, + averageScore: stage.averageScore, + ratingCount: stage.ratingCount, + hasRating: stage.hasRating, + scoreText: stage.averageScore ? `${stage.averageScore.toFixed(1)}鍒哷 : '', + isClickable: stage.hasRating && stage.activityPlayerId + } + }) + + this.setData({ + timeline: processedTimeline, + timelineLoading: false + }) + } else { + this.setData({ + timeline: [], + timelineLoading: false + }) + } + } catch (error) { + console.error('鍔犺浇鏃堕棿杞村け璐�:', error) + this.setData({ + timelineError: error.message || '鏃堕棿杞村姞杞藉け璐�', + timelineLoading: false + }) + } + }, + + // 浠嶢PI鑾峰彇椤圭洰鏃堕棿杞� + async getProjectTimelineFromAPI(activityPlayerId) { + const query = ` + query GetProjectTimeline($activityPlayerId: ID!) { + projectStageTimeline(activityPlayerId: $activityPlayerId) { + activityId + activityName + stages { + stageId + stageName + matchTime + sortOrder + participated + activityPlayerId + averageScore + ratingCount + hasRating + latestRatingTime + } + } + } + ` + + try { + const result = await app.graphqlRequest(query, { activityPlayerId }) + return result.projectStageTimeline + } catch (error) { + throw error + } + }, + + // 鎵撳紑闃舵璇︽儏 + openStageDetail(e) { + const { playerId, clickable, participated } = e.currentTarget.dataset + + if (!clickable || !participated || !playerId) { + wx.showToast({ + title: '鏆傛棤璇勫垎璇︽儏', + icon: 'none' + }) + return + } + + // 璺宠浆鍒拌瘎鍒嗚鎯呴〉闈㈡垨鏄剧ず璇︽儏寮圭獥 + wx.navigateTo({ + url: `/pages/review/stage-detail?playerId=${playerId}` + }) + }, + + // 鍏抽棴闃舵璇︽儏 + closeStageDetail() { + this.setData({ + showRatingDetail: false, + ratingDetail: null + }) }, // 棰勮鏂囦欢 @@ -430,6 +577,8 @@ // 鑾峰彇鎬у埆鏂囨湰 getGenderText(gender) { const genderMap = { + 1: '鐢�', + 2: '濂�', 'MALE': '鐢�', 'FEMALE': '濂�' } @@ -443,9 +592,14 @@ 'COLLEGE': '澶т笓', 'BACHELOR': '鏈', 'MASTER': '纭曞+', - 'DOCTOR': '鍗氬+' + 'DOCTOR': '鍗氬+', + '楂樹腑鍙婁互涓�': '楂樹腑鍙婁互涓�', + '澶т笓': '澶т笓', + '鏈': '鏈', + '纭曞+': '纭曞+', + '鍗氬+': '鍗氬+' } - return educationMap[education] || '' + return educationMap[education] || education || '' }, // 鍒嗕韩鍔熻兘 diff --git a/wx/pages/registration/registration.js b/wx/pages/registration/registration.js index e1613f8..719571c 100644 --- a/wx/pages/registration/registration.js +++ b/wx/pages/registration/registration.js @@ -1313,9 +1313,11 @@ } catch (error) { console.error('鎻愪氦澶辫触:', error) - wx.showToast({ - title: error.message || '鎻愪氦澶辫触锛岃閲嶈瘯', - icon: 'none' + wx.showModal({ + title: '鎻愪氦澶辫触', + content: error.message || '鎻愪氦澶辫触锛岃閲嶈瘯', + showCancel: false, + confirmText: '鎴戠煡閬撲簡' }) } finally { this.setData({ isSubmitting: false }) -- Gitblit v1.8.0