29 lines
615 B
Go
29 lines
615 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"github.com/go-kratos/kratos/v2/log"
|
|
"voucher/internal/biz/bo"
|
|
)
|
|
|
|
func (v *VoucherService) WechatNotifyConsumer(ctx context.Context, tag, msg string) error {
|
|
|
|
var req *bo.WechatVoucherNotifyBo
|
|
|
|
if err := json.Unmarshal([]byte(msg), &req); err != nil {
|
|
return err
|
|
}
|
|
|
|
if req.PlainText.Status.IsSended() {
|
|
log.Warnf("券状态可用,忽略不处理,couponId:%s,stockId:%s,status:%s",
|
|
req.PlainText.CouponID,
|
|
req.PlainText.StockID,
|
|
req.PlainText.Status.GetText(),
|
|
)
|
|
return nil
|
|
}
|
|
|
|
return v.VoucherBiz.WechatNotifyConsumer(ctx, tag, req)
|
|
}
|