From e0f1a848a6af585880b7b3ea63c00f52ff1d87ec Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Wed, 28 May 2025 17:57:22 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0o?= =?UTF-8?q?rder=5Fno=202=E3=80=81=E7=94=B3=E8=AF=B7=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E9=85=8D=E7=BD=AENornal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ---- .vscode/launch.json | 24 +++++++++++++++++++ .vscode/tasks.json | 19 +++++++++++++++ app/user/cmd/api/desc/query.api | 1 + .../logic/agent/applyforagentlogic.go | 1 + .../logic/pay/querypaymentchecklogic.go | 1 - .../logic/pay/wechatpaycallbacklogic.go | 1 - .../internal/logic/query/querylistlogic.go | 2 +- app/user/cmd/api/internal/types/types.go | 1 + common/jwt/jwtx_test.go | 4 ++-- pkg/lzkit/crypto/ecb_test.go | 2 +- 11 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index e145787..ad61adf 100644 --- a/.gitignore +++ b/.gitignore @@ -13,10 +13,6 @@ data/* # gitlab ci .cache -#vscode -.vscode -.vscode/ - /tmp/ /app/api diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..bab84fb --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}", + "args": [] + }, + { + "name": "调试API服务", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}/app/user/cmd/api/main.go", + "args": ["-f", "etc/main.dev.yaml"], + "env": { + "ENV": "development" + } + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..5a7e86a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,19 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run Go-Zero API (无调试)", + "type": "shell", + "command": "go run ${workspaceFolder}/app/user/cmd/api/main.go -f ${workspaceFolder}/app/user/cmd/api/etc/main.dev.yaml", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + } + ] +} diff --git a/app/user/cmd/api/desc/query.api b/app/user/cmd/api/desc/query.api index ac536c0..6c8748b 100644 --- a/app/user/cmd/api/desc/query.api +++ b/app/user/cmd/api/desc/query.api @@ -13,6 +13,7 @@ info ( type Query { Id int64 `json:"id"` // 主键ID OrderId int64 `json:"order_id"` // 订单ID + OrderNo string `json:"order_no"` // 订单号 UserId int64 `json:"user_id"` // 用户ID ProductName string `json:"product_name"` // 产品ID QueryParams map[string]interface{} `json:"query_params"` diff --git a/app/user/cmd/api/internal/logic/agent/applyforagentlogic.go b/app/user/cmd/api/internal/logic/agent/applyforagentlogic.go index 3a9a964..a7eb57e 100644 --- a/app/user/cmd/api/internal/logic/agent/applyforagentlogic.go +++ b/app/user/cmd/api/internal/logic/agent/applyforagentlogic.go @@ -129,6 +129,7 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type agentModel.Mobile = agentAudit.Mobile agentModel.Region = agentAudit.Region agentModel.UserId = agentAudit.UserId + agentModel.LevelName = model.AgentLeveNameNormal agentModelInsert, insertAgentModelErr := l.svcCtx.AgentModel.Insert(transCtx, session, &agentModel) if insertAgentModelErr != nil { return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 新增代理失败: %+v", insertAgentModelErr) diff --git a/app/user/cmd/api/internal/logic/pay/querypaymentchecklogic.go b/app/user/cmd/api/internal/logic/pay/querypaymentchecklogic.go index 0f55322..0d83af9 100644 --- a/app/user/cmd/api/internal/logic/pay/querypaymentchecklogic.go +++ b/app/user/cmd/api/internal/logic/pay/querypaymentchecklogic.go @@ -40,7 +40,6 @@ func (l *QueryPaymentCheckLogic) QueryPaymentCheck(req *types.QueryPaymentCheckR resp = new(types.QueryPaymentCheckResp) resp.OrderStatus = order.Status resp.ProductName = product.ProductName - if order.Status == "paid" { authorization, err := l.svcCtx.AuthorizationModel.FindOneByOrderId(l.ctx, order.Id) if err != nil { diff --git a/app/user/cmd/api/internal/logic/pay/wechatpaycallbacklogic.go b/app/user/cmd/api/internal/logic/pay/wechatpaycallbacklogic.go index 95b8d86..97d87ae 100644 --- a/app/user/cmd/api/internal/logic/pay/wechatpaycallbacklogic.go +++ b/app/user/cmd/api/internal/logic/pay/wechatpaycallbacklogic.go @@ -140,7 +140,6 @@ func (l *WechatPayCallbackLogic) handleQueryOrderPayment(w http.ResponseWriter, return fmt.Errorf("插入授权信息失败: %+v", err) } } - w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte("success")) return nil diff --git a/app/user/cmd/api/internal/logic/query/querylistlogic.go b/app/user/cmd/api/internal/logic/query/querylistlogic.go index 7caa5c1..e6455cb 100644 --- a/app/user/cmd/api/internal/logic/query/querylistlogic.go +++ b/app/user/cmd/api/internal/logic/query/querylistlogic.go @@ -58,7 +58,7 @@ func (l *QueryListLogic) QueryList(req *types.QueryListReq) (resp *types.QueryLi // 设置订单ID query.OrderId = orderModel.Id query.UserId = orderModel.UserId - + query.OrderNo = orderModel.OrderNo // 获取商品信息 product, findProductErr := l.svcCtx.ProductModel.FindOne(l.ctx, orderModel.ProductId) if findProductErr != nil { diff --git a/app/user/cmd/api/internal/types/types.go b/app/user/cmd/api/internal/types/types.go index ce7f88f..b793ab7 100644 --- a/app/user/cmd/api/internal/types/types.go +++ b/app/user/cmd/api/internal/types/types.go @@ -378,6 +378,7 @@ type ProductResponse struct { type Query struct { Id int64 `json:"id"` // 主键ID OrderId int64 `json:"order_id"` // 订单ID + OrderNo string `json:"order_no"` // 订单号 UserId int64 `json:"user_id"` // 用户ID ProductName string `json:"product_name"` // 产品ID QueryParams map[string]interface{} `json:"query_params"` diff --git a/common/jwt/jwtx_test.go b/common/jwt/jwtx_test.go index 121889b..43d5424 100644 --- a/common/jwt/jwtx_test.go +++ b/common/jwt/jwtx_test.go @@ -8,7 +8,7 @@ import ( func TestGenerateAndParseJwtToken(t *testing.T) { // 测试参数 - userId := int64(102) + userId := int64(2012) secret := "WUvoIwL-FK0qnlxhvxR9tV6SjfOpeJMpKmY2QvT99lA" expireTime := int64(2592000) // 1小时过期 @@ -22,7 +22,7 @@ func TestGenerateAndParseJwtToken(t *testing.T) { } fmt.Println(token) // 解析token - parsedUserId, err := ParseJwtToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTA4NDAxNzAsImlhdCI6MTc0ODI0ODE3MCwidXNlcklkIjo2OH0.c7EihKJPsN9r2HL1tkKXD-UCVSMhUchBntB-XSA_WbQ", secret) + parsedUserId, err := ParseJwtToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTA5MjYyNTgsImlhdCI6MTc0ODMzNDI1OCwidXNlcklkIjoxNDN9.V4qV3dAjE6G-xm0KmB6QHCVhy2SmRDGAWcvl32hLNmI", secret) if err != nil { t.Fatalf("解析JWT令牌失败: %v", err) } diff --git a/pkg/lzkit/crypto/ecb_test.go b/pkg/lzkit/crypto/ecb_test.go index 6537510..3b1c180 100644 --- a/pkg/lzkit/crypto/ecb_test.go +++ b/pkg/lzkit/crypto/ecb_test.go @@ -9,7 +9,7 @@ import ( func TestAesEcbMobileEncryption(t *testing.T) { // 测试手机号加密 - mobile := "15008098853" + mobile := "18562870088" keyStr := "ff83609b2b24fc73196aac3d3dfb874f" // 测试加密