多笔立减金
This commit is contained in:
parent
f0f4ce1235
commit
24994ec0d7
|
|
@ -1,11 +1,9 @@
|
||||||
package helper
|
package helper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
"voucher/internal/biz/bo"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHashMod(t *testing.T) {
|
func TestHashMod(t *testing.T) {
|
||||||
|
|
@ -45,37 +43,8 @@ func queryUsed(useNum *int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMd5(t *testing.T) {
|
func TestMd5(t *testing.T) {
|
||||||
|
//jsonStr := `{"content":"1","timestamp":1765447477945,"ciphertext":"77CAC2FCFDEBAC6665025A1B81E3BBF9"}`
|
||||||
jsonStr := `{
|
ciphertext := Md5("1" + "DrY1zLkOH01q0sN66vrmkdpbWsyb41ho")
|
||||||
"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)
|
|
||||||
t.Log(ciphertext)
|
t.Log(ciphertext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,16 +80,4 @@ func TestLength(t *testing.T) {
|
||||||
}`
|
}`
|
||||||
s := len(jsonStr)
|
s := len(jsonStr)
|
||||||
t.Log(s)
|
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))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue