From 24994ec0d7707ccff29e12167b6a7af16b90d7c4 Mon Sep 17 00:00:00 2001 From: ziming Date: Tue, 16 Dec 2025 14:38:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=AC=94=E7=AB=8B=E5=87=8F=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/pkg/helper/utils_test.go | 47 ++----------------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/internal/pkg/helper/utils_test.go b/internal/pkg/helper/utils_test.go index 647fe9f..9d198f4 100644 --- a/internal/pkg/helper/utils_test.go +++ b/internal/pkg/helper/utils_test.go @@ -1,11 +1,9 @@ package helper import ( - "encoding/json" "fmt" "testing" "time" - "voucher/internal/biz/bo" ) func TestHashMod(t *testing.T) { @@ -45,37 +43,8 @@ func queryUsed(useNum *int) { } func TestMd5(t *testing.T) { - - jsonStr := `{ - "id": "4ab2699d-e91d-5460-9810-25fd6d4c69a5", - "create_time": "2025-12-08T17:54:24+08:00", - "resource_type": "encrypt-resource", - "event_type": "COUPON.USE", - "summary": "代金券核销通知", - "original_type": "coupon", - "associated_data": "coupon", - "plain_text": { - "stock_creator_mchid": "1652465541", - "stock_id": "21386484", - "coupon_id": "142388354994", - "coupon_name": "银行卡多笔立减", - "description": "", - "status": "SENDED", - "create_time": "2025-12-08T17:50:48+08:00", - "coupon_type": "NORMAL", - "no_cash": false, - "singleitem": false, - "business_type": "", - "consume_information": { - "consume_time": "2025-12-08T17:54:24+08:00", - "consume_mchid": "1274938601", - "transaction_id": "4200002996202512083063051834", - "consume_amount": 16 - } - } -}` - - ciphertext := Md5(jsonStr) + //jsonStr := `{"content":"1","timestamp":1765447477945,"ciphertext":"77CAC2FCFDEBAC6665025A1B81E3BBF9"}` + ciphertext := Md5("1" + "DrY1zLkOH01q0sN66vrmkdpbWsyb41ho") t.Log(ciphertext) } @@ -111,16 +80,4 @@ func TestLength(t *testing.T) { }` s := len(jsonStr) t.Log(s) - - var notify bo.WechatVoucherNotifyBo - err := json.Unmarshal([]byte(jsonStr), ¬ify) - if err != nil { - panic(err) - } - - // 输出验证 - fmt.Println("代金券ID:", notify.PlainText.CouponID) - fmt.Println("核销金额(分):", notify.PlainText.ConsumeInformation.ConsumeAmount) - fmt.Println("核销时间:", notify.PlainText.ConsumeInformation.ConsumeTime) - fmt.Println("核销时间:", notify.PlainText.ConsumeInformation.ConsumeTime.Format(time.DateTime)) }