From e26e9f597895a740cced60c39807f9117c12b90f Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Fri, 12 Sep 2025 17:29:20 +0800 Subject: [PATCH] fix --- app/main/api/etc/main.dev.yaml | 4 ++-- app/main/api/etc/main.yaml | 4 ++-- app/main/api/internal/queue/paySuccessNotify.go | 14 +------------- pkg/lzkit/crypto/ecb_test.go | 11 +++++------ 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/app/main/api/etc/main.dev.yaml b/app/main/api/etc/main.dev.yaml index 3c73d81..ebf624d 100644 --- a/app/main/api/etc/main.dev.yaml +++ b/app/main/api/etc/main.dev.yaml @@ -60,7 +60,7 @@ AdminConfig: AccessExpire: 604800 RefreshAfter: 302400 Tianyuanapi: - AccessID: "3c042bb99b240ccc" - Key: "2732f526167c2de9b8dc6aa0f24ba8b7" + AccessID: "7f8a9b2c4d5e6f1a" + Key: "9e4f8a1b3c6d7e2f5a8b9c0d1e4f7a2b" BaseURL: "https://api.tianyuanapi.com" Timeout: 60 \ No newline at end of file diff --git a/app/main/api/etc/main.yaml b/app/main/api/etc/main.yaml index 9723684..e6850d6 100644 --- a/app/main/api/etc/main.yaml +++ b/app/main/api/etc/main.yaml @@ -61,7 +61,7 @@ AdminConfig: AccessExpire: 604800 RefreshAfter: 302400 Tianyuanapi: - AccessID: "3c042bb99b240ccc" - Key: "2732f526167c2de9b8dc6aa0f24ba8b7" + AccessID: "7f8a9b2c4d5e6f1a" + Key: "9e4f8a1b3c6d7e2f5a8b9c0d1e4f7a2b" BaseURL: "https://api.tianyuanapi.com" Timeout: 60 \ No newline at end of file diff --git a/app/main/api/internal/queue/paySuccessNotify.go b/app/main/api/internal/queue/paySuccessNotify.go index 42ac8c7..5479c65 100644 --- a/app/main/api/internal/queue/paySuccessNotify.go +++ b/app/main/api/internal/queue/paySuccessNotify.go @@ -72,23 +72,11 @@ func (l *PaySuccessNotifyUserHandler) ProcessTask(ctx context.Context, t *asynq. return fmt.Errorf("解密参数失败: %+v", aesdecryptErr) } - // 敏感数据脱敏处理 - desensitizedParams, err := l.desensitizeParams(decryptData) - if err != nil { - return fmt.Errorf("脱敏处理失败: %+v", err) - } - - // 对脱敏后的数据进行AES加密 - encryptedParams, encryptErr := crypto.AesEncrypt(desensitizedParams, key) - if encryptErr != nil { - return fmt.Errorf("加密脱敏数据失败: %+v", encryptErr) - } - query := &model.Query{ OrderId: order.Id, UserId: order.UserId, ProductId: product.Id, - QueryParams: encryptedParams, + QueryParams: data.Params, QueryState: "pending", } result, insertQueryErr := l.svcCtx.QueryModel.Insert(ctx, nil, query) diff --git a/pkg/lzkit/crypto/ecb_test.go b/pkg/lzkit/crypto/ecb_test.go index f7cb2f2..028a2ed 100644 --- a/pkg/lzkit/crypto/ecb_test.go +++ b/pkg/lzkit/crypto/ecb_test.go @@ -9,19 +9,18 @@ import ( func TestAesEcbMobileEncryption(t *testing.T) { // 测试手机号加密 - mobile := "18653052547" - key := []byte("ff83609b2b24fc73196aac3d3dfb874f") // 16字节AES-128密钥 + mobile := "18276151590" + key := "ff83609b2b24fc73196aac3d3dfb874f" // 16字节AES-128密钥 - keyStr := hex.EncodeToString(key) // 测试加密 - encrypted, err := EncryptMobile(mobile, keyStr) + encrypted, err := EncryptMobile(mobile, key) if err != nil { t.Fatalf("手机号加密失败: %v", err) } fmt.Printf("encrypted: %s\n", encrypted) jmStr := "m9EEeW9ZBBJmi1hx1k1uIQ==" // 测试解密 - decrypted, err := DecryptMobile(jmStr, keyStr) + decrypted, err := DecryptMobile(jmStr, key) if err != nil { t.Fatalf("手机号解密失败: %v", err) } @@ -32,7 +31,7 @@ func TestAesEcbMobileEncryption(t *testing.T) { } // 测试相同输入产生相同输出(确定性) - encrypted2, _ := EncryptMobile(mobile, keyStr) + encrypted2, _ := EncryptMobile(mobile, key) if encrypted != encrypted2 { t.Errorf("AES-ECB不是确定性的,两次加密结果不同: %s vs %s", encrypted, encrypted2) }