多笔立减金
This commit is contained in:
parent
a1b59c97a9
commit
947c4e5e5c
|
|
@ -93,7 +93,7 @@ func (biz *MultiBiz) Run(ctx context.Context, source string, req *bo.WechatVouch
|
||||||
return fmt.Errorf("批次活动ID为空,不是多笔立减金,请检查")
|
return fmt.Errorf("批次活动ID为空,不是多笔立减金,请检查")
|
||||||
}
|
}
|
||||||
|
|
||||||
mnd, err := biz.MultiNotifyDataRepo.GetByNotifyID(ctx, req.ID)
|
mnd, err := biz.MultiNotifyDataRepo.GetByNotifyID(ctx, source, req.ID)
|
||||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return fmt.Errorf("查询通知数据错误 error: %v", err)
|
return fmt.Errorf("查询通知数据错误 error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -118,6 +118,31 @@ func (biz *MultiBiz) Run(ctx context.Context, source string, req *bo.WechatVouch
|
||||||
return biz.Request(ctx, mnd, nl)
|
return biz.Request(ctx, mnd, nl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (biz *MultiBiz) RetryRunByMultiNotifyDataId(ctx context.Context, multiNotifyDataId int64) error {
|
||||||
|
|
||||||
|
mnd, err := biz.MultiNotifyDataRepo.GetByID(ctx, multiNotifyDataId)
|
||||||
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return fmt.Errorf("查询通知数据错误 error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
order, err := biz.OrderRepo.GetByOrderNo(ctx, mnd.OrderNo)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("订单查询错误 error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var req *bo.WechatVoucherNotifyBo
|
||||||
|
if err = json.Unmarshal([]byte(mnd.OriginalData), &req); err != nil {
|
||||||
|
return fmt.Errorf("通知数据 json unmarshal 错误 error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
nl, err := biz.nlCreate(ctx, req, mnd, order)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("创建通知日志错误 error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return biz.Request(ctx, mnd, nl)
|
||||||
|
}
|
||||||
|
|
||||||
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, source string, req *bo.WechatVoucherNotifyBo, order *bo.OrderBo) (*bo.MultiNotifyDataBo, error) {
|
||||||
|
|
||||||
originalData, err := req.Str()
|
originalData, err := req.Str()
|
||||||
|
|
@ -185,7 +210,7 @@ func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo) (string, error) {
|
||||||
|
|
||||||
bizJsonBytes, err := json.Marshal(req)
|
bizJsonBytes, err := json.Marshal(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", fmt.Errorf("json.Marshal CmbNotifyRequest error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(bizJsonBytes), nil
|
return string(bizJsonBytes), nil
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,6 @@ type MultiNotifyDataRepo interface {
|
||||||
FindNoticeNumZero(ctx context.Context, fun func(ctx context.Context, rows []*bo.MultiNotifyDataBo) error) error
|
FindNoticeNumZero(ctx context.Context, fun func(ctx context.Context, rows []*bo.MultiNotifyDataBo) error) error
|
||||||
Create(ctx context.Context, req *bo.MultiNotifyDataBo) (*bo.MultiNotifyDataBo, error)
|
Create(ctx context.Context, req *bo.MultiNotifyDataBo) (*bo.MultiNotifyDataBo, error)
|
||||||
GetByID(ctx context.Context, id int64) (*bo.MultiNotifyDataBo, error)
|
GetByID(ctx context.Context, id int64) (*bo.MultiNotifyDataBo, error)
|
||||||
GetByNotifyID(ctx context.Context, notifyId string) (*bo.MultiNotifyDataBo, error)
|
GetByNotifyID(ctx context.Context, source, notifyId string) (*bo.MultiNotifyDataBo, error)
|
||||||
AddNoticeNum(ctx context.Context, id int64) error
|
AddNoticeNum(ctx context.Context, id int64) error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,11 @@ func (p *MultiNotifyDataRepoImpl) GetByID(ctx context.Context, id int64) (*bo.Mu
|
||||||
return p.ToBo(&item), nil
|
return p.ToBo(&item), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *MultiNotifyDataRepoImpl) GetByNotifyID(ctx context.Context, notifyId string) (*bo.MultiNotifyDataBo, error) {
|
func (p *MultiNotifyDataRepoImpl) GetByNotifyID(ctx context.Context, source, notifyId string) (*bo.MultiNotifyDataBo, error) {
|
||||||
|
|
||||||
var item model.MultiNotifyDatum
|
var item model.MultiNotifyDatum
|
||||||
|
|
||||||
tx := p.DB(ctx).Where(model.MultiNotifyDatum{NotifyID: notifyId}).First(&item)
|
tx := p.DB(ctx).Where(model.MultiNotifyDatum{Source: source, NotifyID: notifyId}).First(&item)
|
||||||
|
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
return nil, tx.Error
|
return nil, tx.Error
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ func (srv *TripartiteService) QiXingNotify(ctx http.Context) error {
|
||||||
sign := helper.Md5(req.Content + srv.bc.Tripartite.QiXing.AppKey)
|
sign := helper.Md5(req.Content + srv.bc.Tripartite.QiXing.AppKey)
|
||||||
if sign != req.Ciphertext {
|
if sign != req.Ciphertext {
|
||||||
log.Errorf("qixing notify sign err ip:%s,error:%v,body:%s", ip, err, string(bodyBytes))
|
log.Errorf("qixing notify sign err ip:%s,error:%v,body:%s", ip, err, string(bodyBytes))
|
||||||
return srv.ResponseErr(ctx, "sign error")
|
return srv.ResponseErr(ctx, "verify sign error")
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNotifyDataStr, err := base64.StdEncoding.DecodeString(req.Content)
|
wxNotifyDataStr, err := base64.StdEncoding.DecodeString(req.Content)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue