切换主体

This commit is contained in:
ziming 2026-03-26 10:14:59 +08:00
parent 7c851ddb1b
commit cf9ecc4486
3 changed files with 15 additions and 5 deletions

View File

@ -21,6 +21,9 @@ func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, ip string, req
}
if order.ActivityId != "" {
if err = req.Validate(); err != nil {
return fmt.Errorf("multi validate req error: %v", err)
}
return this.MultiBiz.Run(ctx, ip, req.PlainText.StockCreatorMchid, req, order)
}
@ -43,6 +46,10 @@ func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, ip string, req
func (this *VoucherBiz) getOrder(ctx context.Context, req *bo.WechatVoucherNotifyBo) (*bo.OrderBo, error) {
if req.PlainText.StockCreatorMchid == "" || req.PlainText.StockID == "" || req.PlainText.CouponID == "" {
return nil, fmt.Errorf("订单查询参数错误")
}
order, err := this.OrderRepo.GetByCouponId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.CouponID)
if err != nil {

View File

@ -66,6 +66,8 @@ func (srv *NotifyService) Notify(ctx http.Context) error {
ip := helper.GetClientIP(ctx)
log.Warnf("微信回调通知[%s],解析数据,response:%+v", mchId, response)
if err = srv.VoucherBiz.WechatNotifyConsumer(ctx, ip, response); err != nil {
log.Errorf("微信回调通知[%s],处理失败,headers:%+v,body:%s,err:%s", mchId, headers, string(bodyBytes), err.Error())

View File

@ -24,8 +24,8 @@ var bc = &conf.Bootstrap{
},
}
// bc2 Callback{NotifyUrl:https://nsall.86698.cn/wechatPay/coupon_notify/fjxingwang, Mchid:1652465541}
var bc2 = &conf.Bootstrap{
// bcFJXW Callback{NotifyUrl:https://nsall.86698.cn/wechatPay/coupon_notify/fjxingwang, Mchid:1652465541}
var bcFJXW = &conf.Bootstrap{
Wechat: &conf.Wechat{
MchID: "1652465541", // notifyUrl https://nsall.86698.cn/wechatPay/coupon_notify/fjxingwang
MchCertificateSerialNumber: "1E3F2CE013203BA9C3DEFC5782FCD3329C3DAC1C",
@ -169,8 +169,8 @@ func QueryProduct() {
}
req := cashcoupons.QueryStockRequest{
StockId: core.String("21502886"),
StockCreatorMchid: core.String("1652465541"),
StockId: core.String("21923564"),
StockCreatorMchid: core.String("1100040695"),
}
svc := cashcoupons.StockApiService{Client: client}
@ -195,7 +195,8 @@ func QueryProduct() {
fmt.Printf("\n剩余库存:%d", availableStock)
fmt.Printf("\n剩余预算:%d", availableStock*couponAmount)
fmt.Printf("\nWxResp:%+v", WxResp(resp))
str, _ := json.Marshal(WxResp(resp))
fmt.Printf("\nWxResp:%+v", string(str))
return
}