register tag
This commit is contained in:
parent
4fb8ddfc2d
commit
29d0bc633d
|
|
@ -10,6 +10,16 @@ import (
|
|||
"voucher/internal/pkg/lock"
|
||||
)
|
||||
|
||||
func (v *VoucherBiz) RegisterTag(ctx context.Context, productNo string) error {
|
||||
|
||||
product, err := v.ProductRepo.GetByProductNo(ctx, productNo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return v.registerNotifyTag(ctx, product.MchId, product.BatchNo)
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) registerNotifyTag(ctx context.Context, stockCreatorMchID, stockID string) error {
|
||||
|
||||
c := vo.WechatNotifyRegisterTagCacheKey.BuildCache([]string{v.bc.WechatNotifyMQ.Tag, stockCreatorMchID, stockID})
|
||||
|
|
|
|||
|
|
@ -103,9 +103,10 @@ func (v *VoucherBiz) order(ctx context.Context, product *bo.ProductBo, bizConten
|
|||
|
||||
_ = v.cmbToBB(ctx, bizContent)
|
||||
|
||||
if err = v.registerNotifyTag(ctx, order.MerchantNo, order.BatchNo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//去掉注册步骤回调tag
|
||||
//if err = v.registerNotifyTag(ctx, order.MerchantNo, order.BatchNo); err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
|
||||
//voucherNo, err := v.WechatCpnRepo.Order(ctx, order)
|
||||
//if err != nil {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ func NewHTTPServer(
|
|||
|
||||
srv.Route("/voucher/").GET("notifyRetry/{id}", cmb.NotifyRetry)
|
||||
srv.Route("/voucher/").GET("queryOrder/{order_no}", cmb.QueryOrder)
|
||||
srv.Route("/voucher/").GET("registerTag/{product_no}", cmb.RegisterTag)
|
||||
|
||||
v1.RegisterCmbHTTPServer(srv, cmb)
|
||||
|
||||
|
|
|
|||
|
|
@ -69,3 +69,15 @@ func (this *CmbService) QueryOrder(ctx http.Context) error {
|
|||
"data": str,
|
||||
})
|
||||
}
|
||||
|
||||
func (this *CmbService) RegisterTag(ctx http.Context) error {
|
||||
|
||||
productNo := ctx.Vars().Get("product_no")
|
||||
if productNo == "" {
|
||||
return fmt.Errorf("productNo is empty")
|
||||
}
|
||||
|
||||
return ctx.JSON(http2.StatusOK, map[string]interface{}{
|
||||
"data": this.VoucherBiz.RegisterTag(ctx, productNo),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue