多笔立减金
This commit is contained in:
parent
10eda78e58
commit
408a929b33
|
|
@ -6,6 +6,7 @@ import "time"
|
|||
type MultiNotifyDataBo struct {
|
||||
ID int64
|
||||
Source string
|
||||
IP string
|
||||
NotifyID string
|
||||
OrderNo string
|
||||
OutBizNo string
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func NewMultiBiz(
|
|||
}
|
||||
}
|
||||
|
||||
func (biz *MultiBiz) Notify(ctx context.Context, source string, req *bo.WechatVoucherNotifyBo) error {
|
||||
func (biz *MultiBiz) Notify(ctx context.Context, ip, source string, req *bo.WechatVoucherNotifyBo) error {
|
||||
|
||||
cl := vo.MultiNotifyLockKey.BuildCache([]string{
|
||||
source,
|
||||
|
|
@ -66,7 +66,7 @@ func (biz *MultiBiz) Notify(ctx context.Context, source string, req *bo.WechatVo
|
|||
return err
|
||||
}
|
||||
|
||||
if err = biz.Run(ctx, source, req, order); err != nil {
|
||||
if err = biz.Run(ctx, ip, source, req, order); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ func (biz *MultiBiz) order(ctx context.Context, req *bo.WechatVoucherNotifyBo) (
|
|||
return order, nil
|
||||
}
|
||||
|
||||
func (biz *MultiBiz) Run(ctx context.Context, source string, req *bo.WechatVoucherNotifyBo, order *bo.OrderBo) error {
|
||||
func (biz *MultiBiz) Run(ctx context.Context, ip, source string, req *bo.WechatVoucherNotifyBo, order *bo.OrderBo) error {
|
||||
|
||||
if order.ActivityId == "" {
|
||||
return fmt.Errorf("批次活动ID为空,不是多笔立减金,请检查")
|
||||
|
|
@ -102,7 +102,7 @@ func (biz *MultiBiz) Run(ctx context.Context, source string, req *bo.WechatVouch
|
|||
return nil
|
||||
}
|
||||
} else {
|
||||
mnd, err = biz.mndCreate(ctx, source, req, order)
|
||||
mnd, err = biz.mndCreate(ctx, ip, source, req, order)
|
||||
if err != nil {
|
||||
return fmt.Errorf("创建通知数据错误 error: %v", err)
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ func (biz *MultiBiz) run(ctx context.Context, req *bo.WechatVoucherNotifyBo, mnd
|
|||
return biz.Request(ctx, mnd, nl, order)
|
||||
}
|
||||
|
||||
func (biz *MultiBiz) mndCreate(ctx context.Context, source string, req *bo.WechatVoucherNotifyBo, order *bo.OrderBo) (*bo.MultiNotifyDataBo, error) {
|
||||
func (biz *MultiBiz) mndCreate(ctx context.Context, ip, source string, req *bo.WechatVoucherNotifyBo, order *bo.OrderBo) (*bo.MultiNotifyDataBo, error) {
|
||||
|
||||
originalData, err := req.Str()
|
||||
if err != nil {
|
||||
|
|
@ -160,6 +160,7 @@ func (biz *MultiBiz) mndCreate(ctx context.Context, source string, req *bo.Wecha
|
|||
|
||||
return biz.MultiNotifyDataRepo.Create(ctx, &bo.MultiNotifyDataBo{
|
||||
Source: source,
|
||||
IP: ip,
|
||||
NotifyID: req.ID,
|
||||
OrderNo: order.OrderNo,
|
||||
OutBizNo: order.OutBizNo,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, re
|
|||
}
|
||||
|
||||
if order.ActivityId != "" {
|
||||
return this.MultiBiz.Run(ctx, "lsxd_"+order.MerchantNo, req, order)
|
||||
return this.MultiBiz.Run(ctx, "127.0.0.1", "lsxd_"+req.PlainText.StockCreatorMchid, req, order)
|
||||
}
|
||||
|
||||
if req.PlainText.Status.IsSended() {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ const TableNameMultiNotifyDatum = "multi_notify_data"
|
|||
// MultiNotifyDatum mapped from table <multi_notify_data>
|
||||
type MultiNotifyDatum struct {
|
||||
ID int64 `gorm:"column:id;primaryKey" json:"id"`
|
||||
IP string `gorm:"column:ip;not null;comment:ip" json:"ip"` // ip
|
||||
Source string `gorm:"column:source;not null;comment:来源" json:"source"` // 来源
|
||||
NotifyID string `gorm:"column:notify_id;not null;comment:回调通知id" json:"notify_id"` // 回调通知id
|
||||
OrderNo string `gorm:"column:order_no;not null;comment:订单号" json:"order_no"` // 订单号
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ func (p *MultiNotifyDataRepoImpl) Create(ctx context.Context, req *bo.MultiNotif
|
|||
|
||||
info := &model.MultiNotifyDatum{
|
||||
Source: req.Source,
|
||||
IP: req.IP,
|
||||
NotifyID: req.NotifyID,
|
||||
OrderNo: req.OrderNo,
|
||||
OutBizNo: req.OutBizNo,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ func (srv *TripartiteService) QiXingNotify(ctx http.Context) error {
|
|||
return srv.ResponseErr(ctx, fmt.Sprintf("validate wxNotifyData error: %v", err))
|
||||
}
|
||||
|
||||
err = srv.multiBiz.Notify(ctx, "qixing_"+wxNotifyData.PlainText.StockCreatorMchid, wxNotifyData)
|
||||
err = srv.multiBiz.Notify(ctx, ip, "qixing_"+wxNotifyData.PlainText.StockCreatorMchid, wxNotifyData)
|
||||
if err != nil {
|
||||
log.Errorf("qixing notify run err ip:%s,error:%v,body:%s", ip, err, string(bodyBytes))
|
||||
return srv.ResponseErr(ctx, err.Error())
|
||||
|
|
|
|||
Loading…
Reference in New Issue