From e673d96f6f6856b96fa669597d35517fbdec5a9b Mon Sep 17 00:00:00 2001 From: future <1360317836@qq.com> Date: Wed, 27 May 2026 02:13:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20gym-member=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E4=B8=AD=E7=9A=84=E6=97=A0=E7=94=A8=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=92=8C=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gym-manage-api/gym-member/merge_comments.py | 102 ------------- .../gym-member/spotbugs-exclude.xml | 18 --- .../gym-member/test-member-apis.bat | 56 ------- .../gym-member/test-member-apis.ps1 | 140 ------------------ 4 files changed, 316 deletions(-) delete mode 100644 gym-manage-api/gym-member/merge_comments.py delete mode 100644 gym-manage-api/gym-member/spotbugs-exclude.xml delete mode 100644 gym-manage-api/gym-member/test-member-apis.bat delete mode 100644 gym-manage-api/gym-member/test-member-apis.ps1 diff --git a/gym-manage-api/gym-member/merge_comments.py b/gym-manage-api/gym-member/merge_comments.py deleted file mode 100644 index 3c1000c..0000000 --- a/gym-manage-api/gym-member/merge_comments.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- -import os -import re - -base_path = r"c:\Users\13603\Desktop\健身房项目\gym-manage\gym-manage-api\gym-member\src\main\java\cn\novalon\gym\manage\member" - -count = 0 -for root, dirs, files in os.walk(base_path): - for file in files: - if file.endswith('.java'): - filepath = os.path.join(root, file) - with open(filepath, 'r', encoding='utf-8') as f: - content = f.read() - - # 匹配模式:两个连续的注释块(类文档 + 作者注释) - pattern = r'(/\*\*[\s\S]*?\*/)\s*\n(/\*\*\s*\n\s*\*\s*@author\s+.+\s*\n\s*\*\s*@date\s+\d{4}-\d{2}-\d{2}\s*\n\s*\*/)' - - match = re.search(pattern, content) - if match: - class_doc = match.group(1) - author_doc = match.group(2) - - # 提取作者信息 - author_match = re.search(r'@author\s+(.+)', author_doc) - date_match = re.search(r'@date\s+(\d{4}-\d{2}-\d{2})', author_doc) - - if author_match and date_match: - author = author_match.group(1).strip() - date = date_match.group(1).strip() - - # 提取类文档的内容(去掉 /** 和 */) - class_doc_content = re.sub(r'/\*\*\s*\n|\s*\*/', '', class_doc).strip() - # 清理每行开头的多余星号和空格 - class_doc_lines = class_doc_content.split('\n') - cleaned_lines = [] - for line in class_doc_lines: - cleaned_line = re.sub(r'^\s*\*\s?', '', line).strip() - if cleaned_line: - cleaned_lines.append(cleaned_line) - class_doc_content = '\n * '.join(cleaned_lines) - - # 构建合并后的注释 - merged_doc = f"""/** - * {class_doc_content} - * - * @author {author} - * @date {date} - */""" - - # 替换原文 - new_content = content[:match.start()] + merged_doc + content[match.end():] - - with open(filepath, 'w', encoding='utf-8') as f: - f.write(new_content) - - count += 1 - print(f"已合并: {file}") - else: - # 检查是否有单独的作者注释在类文档之前 - pattern2 = r'/\*\*\s*\n\s*\*\s*@author\s+.+\s*\n\s*\*\s*@date\s+\d{4}-\d{2}-\d{2}\s*\n\s*\*/\s*\n(/\*\*[\s\S]*?\*/)' - match2 = re.search(pattern2, content) - if match2: - author_doc = match2.group(0).split('\n/**')[0] + '\n/**' - class_doc = '/**' + match2.group(1) - - # 提取作者信息 - author_match = re.search(r'@author\s+(.+)', author_doc) - date_match = re.search(r'@date\s+(\d{4}-\d{2}-\d{2})', author_doc) - - if author_match and date_match: - author = author_match.group(1).strip() - date = date_match.group(1).strip() - - # 提取类文档的内容 - class_doc_content = re.sub(r'/\*\*\s*\n|\s*\*/', '', class_doc).strip() - # 清理每行开头的多余星号和空格 - class_doc_lines = class_doc_content.split('\n') - cleaned_lines = [] - for line in class_doc_lines: - cleaned_line = re.sub(r'^\s*\*\s?', '', line).strip() - if cleaned_line: - cleaned_lines.append(cleaned_line) - class_doc_content = '\n * '.join(cleaned_lines) - - # 构建合并后的注释 - merged_doc = f"""/** - * {class_doc_content} - * - * @author {author} - * @date {date} - */""" - - # 替换原文 - new_content = content[:match2.start()] + merged_doc + content[match2.end():] - - with open(filepath, 'w', encoding='utf-8') as f: - f.write(new_content) - - count += 1 - print(f"已合并: {file}") - -print(f"\n完成!共合并 {count} 个文件") diff --git a/gym-manage-api/gym-member/spotbugs-exclude.xml b/gym-manage-api/gym-member/spotbugs-exclude.xml deleted file mode 100644 index fd9cd91..0000000 --- a/gym-manage-api/gym-member/spotbugs-exclude.xml +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/gym-manage-api/gym-member/test-member-apis.bat b/gym-manage-api/gym-member/test-member-apis.bat deleted file mode 100644 index 97a6060..0000000 --- a/gym-manage-api/gym-member/test-member-apis.bat +++ /dev/null @@ -1,56 +0,0 @@ -@echo off -chcp 65001 >nul -echo ======================================== -echo 会员模块接口测试 -echo ======================================== -echo. - -set BASE_URL=http://localhost:8084 -set MEMBER_ID=26 - -echo [测试 1] 获取会员信息 -echo 请求: GET %BASE_URL%/api/member/info -curl -X GET "%BASE_URL%/api/member/info" -H "X-Member-Id: %MEMBER_ID%" -s | jq . -echo. -echo. - -echo [测试 2] 查询关注状态 -echo 请求: GET %BASE_URL%/api/member/subscribe/status -curl -X GET "%BASE_URL%/api/member/subscribe/status" -H "X-Member-Id: %MEMBER_ID%" -s -echo. -echo. - -echo [测试 3] 更新会员信息 -echo 请求: PUT %BASE_URL%/api/member/info?nickname=TestUser^&gender=1^&birthday=1990-01-01^&address=TestAddress -curl -X PUT "%BASE_URL%/api/member/info?nickname=TestUser&gender=1&birthday=1990-01-01&address=TestAddress" -H "X-Member-Id: %MEMBER_ID%" -s -echo. -echo. - -echo [测试 4] 管理端录入手机号 -echo 请求: POST %BASE_URL%/api/admin/members/%MEMBER_ID%/phone -curl -X POST "%BASE_URL%/api/admin/members/%MEMBER_ID%/phone" -H "Content-Type: application/json" -d "{\"phone\":\"13800138000\"}" -s -echo. -echo. - -echo [测试 5] 验证手机号已更新 -echo 请求: GET %BASE_URL%/api/member/info -curl -X GET "%BASE_URL%/api/member/info" -H "X-Member-Id: %MEMBER_ID%" -s | jq . -echo. -echo. - -echo [测试 6] 服务号回调验证签名 -echo 请求: GET %BASE_URL%/api/member/auth/mp/callback?signature=test^×tamp=123^&nonce=test^&echostr=test -curl -X GET "%BASE_URL%/api/member/auth/mp/callback?signature=test×tamp=123&nonce=test&echostr=test" -s -echo. -echo. - -echo ======================================== -echo 测试完成 -echo ======================================== -echo. -echo 提示: -echo 1. 小程序登录需要提供真实的微信code -echo 2. 服务号回调需要微信服务器推送的真实事件 -echo 3. 管理端录入手机号需要配置正确的AES密钥 -echo. -pause diff --git a/gym-manage-api/gym-member/test-member-apis.ps1 b/gym-manage-api/gym-member/test-member-apis.ps1 deleted file mode 100644 index c4315ab..0000000 --- a/gym-manage-api/gym-member/test-member-apis.ps1 +++ /dev/null @@ -1,140 +0,0 @@ -# 会员模块接口测试脚本 -# 使用前请确保应用已启动在 http://localhost:8084 - -$BASE_URL = "http://localhost:8084" -$TEST_MEMBER_ID = 26 # 测试环境会员ID - -Write-Host "========================================" -ForegroundColor Cyan -Write-Host " 会员模块接口测试" -ForegroundColor Cyan -Write-Host "========================================" -ForegroundColor Cyan -Write-Host "" - -# ======================================== -# 1. 测试获取会员信息 -# ======================================== -Write-Host "[测试 1] 获取会员信息" -ForegroundColor Yellow -Write-Host "请求: GET $BASE_URL/api/member/info" -ForegroundColor Gray -Write-Host "Header: X-Member-Id: $TEST_MEMBER_ID" -ForegroundColor Gray -try { - $response = Invoke-RestMethod -Uri "$BASE_URL/api/member/info" -Method Get -Headers @{ - "X-Member-Id" = "$TEST_MEMBER_ID" - } - Write-Host "✅ 成功" -ForegroundColor Green - Write-Host "响应:" -ForegroundColor Cyan - $response | ConvertTo-Json -Depth 10 -} catch { - Write-Host "❌ 失败: $($_.Exception.Message)" -ForegroundColor Red -} -Write-Host "" - -# ======================================== -# 2. 测试查询关注状态 -# ======================================== -Write-Host "[测试 2] 查询关注状态" -ForegroundColor Yellow -Write-Host "请求: GET $BASE_URL/api/member/subscribe/status" -ForegroundColor Gray -Write-Host "Header: X-Member-Id: $TEST_MEMBER_ID" -ForegroundColor Gray -try { - $response = Invoke-RestMethod -Uri "$BASE_URL/api/member/subscribe/status" -Method Get -Headers @{ - "X-Member-Id" = "$TEST_MEMBER_ID" - } - Write-Host "✅ 成功" -ForegroundColor Green - Write-Host "响应: $response" -ForegroundColor Cyan -} catch { - Write-Host "❌ 失败: $($_.Exception.Message)" -ForegroundColor Red -} -Write-Host "" - -# ======================================== -# 3. 测试更新会员信息 -# ======================================== -Write-Host "[测试 3] 更新会员信息" -ForegroundColor Yellow -Write-Host "请求: PUT $BASE_URL/api/member/info?nickname=测试用户&gender=1&birthday=1990-01-01&address=测试地址" -ForegroundColor Gray -Write-Host "Header: X-Member-Id: $TEST_MEMBER_ID" -ForegroundColor Gray -try { - $response = Invoke-RestMethod -Uri "$BASE_URL/api/member/info?nickname=测试用户&gender=1&birthday=1990-01-01&address=测试地址" -Method Put -Headers @{ - "X-Member-Id" = "$TEST_MEMBER_ID" - } - Write-Host "✅ 成功" -ForegroundColor Green - Write-Host "响应: $response" -ForegroundColor Cyan -} catch { - Write-Host "❌ 失败: $($_.Exception.Message)" -ForegroundColor Red -} -Write-Host "" - -# ======================================== -# 4. 测试管理端录入手机号 -# ======================================== -Write-Host "[测试 4] 管理端录入手机号" -ForegroundColor Yellow -Write-Host "请求: POST $BASE_URL/api/admin/members/$TEST_MEMBER_ID/phone" -ForegroundColor Gray -Write-Host "Body: { `"phone`": `"13800138000`" }" -ForegroundColor Gray -try { - $body = @{ phone = "13800138000" } | ConvertTo-Json - $response = Invoke-RestMethod -Uri "$BASE_URL/api/admin/members/$TEST_MEMBER_ID/phone" -Method Post -Body $body -ContentType "application/json" - Write-Host "✅ 成功" -ForegroundColor Green - Write-Host "响应: $response" -ForegroundColor Cyan -} catch { - Write-Host "❌ 失败: $($_.Exception.Message)" -ForegroundColor Red -} -Write-Host "" - -# ======================================== -# 5. 再次获取会员信息(验证手机号已更新) -# ======================================== -Write-Host "[测试 5] 验证手机号已更新" -ForegroundColor Yellow -Write-Host "请求: GET $BASE_URL/api/member/info" -ForegroundColor Gray -Write-Host "Header: X-Member-Id: $TEST_MEMBER_ID" -ForegroundColor Gray -try { - $response = Invoke-RestMethod -Uri "$BASE_URL/api/member/info" -Method Get -Headers @{ - "X-Member-Id" = "$TEST_MEMBER_ID" - } - Write-Host "✅ 成功" -ForegroundColor Green - Write-Host "响应:" -ForegroundColor Cyan - $response | ConvertTo-Json -Depth 10 - - if ($response.hasPhone) { - Write-Host "✅ 手机号已成功绑定" -ForegroundColor Green - } else { - Write-Host "⚠️ 手机号未绑定" -ForegroundColor Yellow - } -} catch { - Write-Host "❌ 失败: $($_.Exception.Message)" -ForegroundColor Red -} -Write-Host "" - -# ======================================== -# 6. 测试小程序登录(需要有效的code) -# ======================================== -Write-Host "[测试 6] 小程序登录(需要提供有效的微信code)" -ForegroundColor Yellow -Write-Host "注意: 此测试需要从小程序获取真实的code,跳过自动测试" -ForegroundColor Gray -Write-Host "手动测试命令:" -ForegroundColor Cyan -Write-Host "curl -X POST $BASE_URL/api/member/auth/miniapp/login \" -ForegroundColor Gray -Write-Host " -H `"Content-Type: application/json`" \" -ForegroundColor Gray -Write-Host " -d `"{`"code`":`"YOUR_CODE_HERE`"}"`" -ForegroundColor Gray -Write-Host "" - -# ======================================== -# 7. 测试服务号回调验证签名 -# ======================================== -Write-Host "[测试 7] 服务号回调验证签名" -ForegroundColor Yellow -Write-Host "请求: GET $BASE_URL/api/member/auth/mp/callback?signature=test×tamp=123&nonce=test&echostr=test" -ForegroundColor Gray -try { - $response = Invoke-RestMethod -Uri "$BASE_URL/api/member/auth/mp/callback?signature=test×tamp=123&nonce=test&echostr=test" -Method Get - Write-Host "✅ 成功(返回echostr表示验证通过)" -ForegroundColor Green - Write-Host "响应: $response" -ForegroundColor Cyan -} catch { - Write-Host "❌ 失败: $($_.Exception.Message)" -ForegroundColor Red -} -Write-Host "" - -# ======================================== -# 总结 -# ======================================== -Write-Host "========================================" -ForegroundColor Cyan -Write-Host " 测试完成" -ForegroundColor Cyan -Write-Host "========================================" -ForegroundColor Cyan -Write-Host "" -Write-Host "提示:" -ForegroundColor Yellow -Write-Host "1. 小程序登录需要提供真实的微信code" -ForegroundColor Gray -Write-Host "2. 服务号回调需要微信服务器推送的真实事件" -ForegroundColor Gray -Write-Host "3. 管理端录入手机号需要配置正确的AES密钥" -ForegroundColor Gray -Write-Host ""