cmb
This commit is contained in:
parent
22ef786d2e
commit
5256a965d7
|
|
@ -20,6 +20,10 @@ func (j *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
|||
return nil
|
||||
}
|
||||
|
||||
//req.PlainText.StockCreatorMchid = "1676203838"
|
||||
//req.PlainText.StockID = "20215869"
|
||||
//req.PlainText.CouponID = "96059179220"
|
||||
|
||||
orderWechat, err := j.OrderWechatRepo.GetByMSCId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.CouponID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -43,6 +47,7 @@ func (j *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
|||
|
||||
func (v *VoucherBiz) wechatVoucherUsed(ctx context.Context, orderWechat *bo.OrderWechatBo) error {
|
||||
if orderWechat.Status.IsUse() {
|
||||
log.Warnf("券状态已是已使用,忽略不处理,orderNo:%s", orderWechat.OrderNo)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +65,7 @@ func (v *VoucherBiz) wechatVoucherUsed(ctx context.Context, orderWechat *bo.Orde
|
|||
|
||||
func (j *VoucherBiz) wechatVoucherExpired(ctx context.Context, orderWechat *bo.OrderWechatBo) error {
|
||||
if orderWechat.Status.IsExpired() {
|
||||
log.Warnf("券状态已是已过期,忽略不处理,orderNo:%s", orderWechat.OrderNo)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ func (w *WechatNotifyConsumer) consumeMessages(ctx context.Context, mqConsumer m
|
|||
var handles []string
|
||||
for _, v := range resp.Messages {
|
||||
handles = append(handles, v.ReceiptHandle)
|
||||
log.Warnf("接收消息成功 wechat notify messageTag:%s, message: %s", v.MessageTag, v.MessageBody)
|
||||
log.Warnf("微信回调消费接收消息成功 messageTag:%s, message: %s", v.MessageTag, v.MessageBody)
|
||||
|
||||
if err := w.voucherService.WechatNotifyConsumer(ctx, v.MessageTag, v.MessageBody); err != nil {
|
||||
log.Errorf("wechat notify messageTag:%s, err:%+v", v.MessageTag, err)
|
||||
log.Errorf("微信回调消费处理失败err:%+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ package service
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"voucher/internal/biz/bo"
|
||||
)
|
||||
|
||||
|
|
@ -13,12 +11,8 @@ func (j *VoucherService) WechatNotifyConsumer(ctx context.Context, tag, msg stri
|
|||
var x *bo.WechatVoucherNotifyBo
|
||||
|
||||
if err := json.Unmarshal([]byte(msg), &x); err != nil {
|
||||
return fmt.Errorf("consume msg json.Unmarshal error:%s", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
if err := j.VoucherBiz.WechatNotifyConsumer(ctx, tag, x); err != nil {
|
||||
log.Errorf("WechatNotifyConsumer error:%s", err.Error())
|
||||
}
|
||||
|
||||
return nil
|
||||
return j.VoucherBiz.WechatNotifyConsumer(ctx, tag, x)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue