This commit is contained in:
ziming 2025-05-27 13:44:58 +08:00
parent de9f99e62b
commit 2f7194c945
2 changed files with 24 additions and 24 deletions

View File

@ -71,11 +71,11 @@ func (v *VoucherBiz) wxToBBUse(ctx context.Context, order *bo.OrderBo, wxReq *bo
GmtVoucherCreate: fmt.Sprintf("%d", order.ReceiveSuccessTime.Unix()), GmtVoucherCreate: fmt.Sprintf("%d", order.ReceiveSuccessTime.Unix()),
} }
inputFormat := time.RFC3339
if wxReq.PlainText.ConsumeInformation.ConsumeTime != "" { if wxReq.PlainText.ConsumeInformation.ConsumeTime != "" {
inputFormat := time.RFC3339
useTime, _ := time.Parse(inputFormat, wxReq.PlainText.ConsumeInformation.ConsumeTime) useTime, _ := time.Parse(inputFormat, wxReq.PlainText.ConsumeInformation.ConsumeTime)
req.UseTime = fmt.Sprintf("%d", useTime.Unix()) timestampMs := useTime.UnixNano() / int64(time.Millisecond)
req.UseTime = fmt.Sprintf("%d", timestampMs)
} }
return v.KxMixRepo.Request(ctx, req.GetNotice()) return v.KxMixRepo.Request(ctx, req.GetNotice())

View File

@ -18,9 +18,9 @@ func Test_WechatNotifyProducer(t *testing.T) {
"original_type":"coupon", "original_type":"coupon",
"associated_data":"coupon", "associated_data":"coupon",
"plain_text":{ "plain_text":{
"stock_creator_mchid":"1676203838", "stock_creator_mchid":"1652465541",
"stock_id":"20215869", "stock_id":"10000000",
"coupon_id":"754343650536853505", "coupon_id":"192720602126930329826",
"coupon_name":"萧山农商新客激活礼", "coupon_name":"萧山农商新客激活礼",
"description":"","status":"USED", "description":"","status":"USED",
"create_time":"2025-03-07T15:49:31+08:00", "create_time":"2025-03-07T15:49:31+08:00",
@ -40,24 +40,24 @@ func Test_WechatNotifyProducer2(t *testing.T) {
tag := "voucher_notify_pro" tag := "voucher_notify_pro"
bodyStr := `{"id":"5465699d-de6a-5414-a8df-283167b577ca", bodyStr := `{"id":"5465699d-de6a-5414-a8df-283167b577ca",
"create_time":"2025-03-07T15:57:24+08:00", "create_time":"2025-03-07T15:57:24+08:00",
"resource_type":"encrypt-resource", "resource_type":"encrypt-resource",
"event_type":"COUPON.USE", "event_type":"COUPON.USE",
"summary":"代金券核销通知", "summary":"代金券核销通知",
"original_type":"coupon", "original_type":"coupon",
"associated_data":"coupon", "associated_data":"coupon",
"plain_text":{ "plain_text":{
"stock_creator_mchid":"1652465541", "stock_creator_mchid":"1652465541",
"stock_id":"20392273", "stock_id":"20392273",
"coupon_id":"101286678322", "coupon_id":"101286678322",
"coupon_name":"test", "coupon_name":"test",
"description":"", "description":"",
"status":"USED", "status":"USED",
"create_time":"2025-03-07T15:49:31+08:00", "create_time":"2025-03-07T15:49:31+08:00",
"coupon_type":"NORMAL", "coupon_type":"NORMAL",
"no_cash":false, "no_cash":false,
"singleitem":false, "singleitem":false,
"consume_information":{"consume_time":"2025-03-07T15:57:24+08:00","consume_mchid":"1800002761","transaction_id":"4200002544202503077103159055"}}}` "consume_information":{"consume_time":"2025-03-07T15:57:24+08:00","consume_mchid":"1800002761","transaction_id":"4200002544202503077103159055"}}}`
if err := wechatNotifyProducer(tag, bodyStr); err != nil { if err := wechatNotifyProducer(tag, bodyStr); err != nil {
t.Errorf("入队失败 error = %v", err) t.Errorf("入队失败 error = %v", err)