风险判定

This commit is contained in:
ziming 2025-05-16 17:53:40 +08:00
parent 6b9e51ffed
commit fb4b094aed
3 changed files with 17 additions and 17 deletions

View File

@ -1,6 +1,9 @@
package bo package bo
import "time" import (
"time"
"voucher/internal/biz/vo"
)
// WechatNotifyRegisterTagBo 领域实体Bo结构字段和模型字段保持一致 // WechatNotifyRegisterTagBo 领域实体Bo结构字段和模型字段保持一致
type WechatNotifyRegisterTagBo struct { type WechatNotifyRegisterTagBo struct {
@ -8,7 +11,7 @@ type WechatNotifyRegisterTagBo struct {
StockID string StockID string
StockCreatorMchID string StockCreatorMchID string
Tag string Tag string
Status uint8 Status vo.WechatNotifyRegisterTagStatus
Remark string Remark string
CreateTime *time.Time CreateTime *time.Time
UpdateTime *time.Time UpdateTime *time.Time

View File

@ -106,18 +106,19 @@ func (v *VoucherBiz) registerNotifyTag(ctx context.Context, stockCreatorMchID, s
} }
if wechatNotifyTag != nil { if wechatNotifyTag != nil {
if wechatNotifyTag.Tag != v.bc.WechatNotifyMQ.Tag { if wechatNotifyTag.Tag != v.bc.WechatNotifyMQ.Tag {
return fmt.Errorf("tag不一致请检查tag配置:%s", wechatNotifyTag.Tag) return fmt.Errorf("tag不一致请检查tag配置:%s", wechatNotifyTag.Tag)
} }
if wechatNotifyTag.Status.IsSuccess() {
return v.setCache(ctx, c, wechatNotifyTag) return v.setCache(ctx, c, wechatNotifyTag)
} }
} else {
wechatNotifyTag, err3 = v.createWechatNotifyRegisterTag(ctx, stockCreatorMchID, stockID) wechatNotifyTag, err3 = v.createWechatNotifyRegisterTag(ctx, stockCreatorMchID, stockID)
if err3 != nil { if err3 != nil {
return err3 return err3
} }
}
if err = v.WechatCpnRepo.RegisterNotifyTag(ctx, stockID); err != nil { if err = v.WechatCpnRepo.RegisterNotifyTag(ctx, stockID); err != nil {
@ -150,12 +151,10 @@ func (v *VoucherBiz) setCache(ctx context.Context, c *vo.Cache, wechatNotifyTag
} }
func (v *VoucherBiz) ing(ctx context.Context, id uint64) error { func (v *VoucherBiz) ing(ctx context.Context, id uint64) error {
return v.OrderRepo.Ing(ctx, id) return v.OrderRepo.Ing(ctx, id)
} }
func (v *VoucherBiz) success(ctx context.Context, order *bo.OrderBo, voucherNo string) error { func (v *VoucherBiz) success(ctx context.Context, order *bo.OrderBo, voucherNo string) error {
return v.OrderRepo.Success(ctx, order.ID, voucherNo) return v.OrderRepo.Success(ctx, order.ID, voucherNo)
} }
@ -164,8 +163,8 @@ func (v *VoucherBiz) fail(ctx context.Context, order *bo.OrderBo, remark string)
if err := v.OrderRepo.Fail(ctx, order.ID, remark); err != nil { if err := v.OrderRepo.Fail(ctx, order.ID, remark); err != nil {
return err return err
} }
return nil
return v.alarm(ctx, order, remark) //return v.alarm(ctx, order, remark)
} }
func (v *VoucherBiz) alarm(ctx context.Context, order *bo.OrderBo, errMsg string) error { func (v *VoucherBiz) alarm(ctx context.Context, order *bo.OrderBo, errMsg string) error {

View File

@ -72,7 +72,6 @@ func (p *WechatNotifyRegisterTagRepoImpl) Success(ctx context.Context, id int32)
res := p.DB(ctx). res := p.DB(ctx).
Where(model.WechatNotifyRegisterTag{ Where(model.WechatNotifyRegisterTag{
ID: id, ID: id,
Status: vo.WechatNotifyRegisterTagStatusWait.GetValue(),
}). }).
Updates(model.WechatNotifyRegisterTag{ Updates(model.WechatNotifyRegisterTag{
Status: vo.WechatNotifyRegisterTagStatusSuccess.GetValue(), Status: vo.WechatNotifyRegisterTagStatusSuccess.GetValue(),
@ -100,7 +99,6 @@ func (p *WechatNotifyRegisterTagRepoImpl) Fail(ctx context.Context, id int32, re
res := p.DB(ctx). res := p.DB(ctx).
Where(model.WechatNotifyRegisterTag{ Where(model.WechatNotifyRegisterTag{
ID: id, ID: id,
Status: vo.WechatNotifyRegisterTagStatusWait.GetValue(),
}). }).
Updates(model.WechatNotifyRegisterTag{ Updates(model.WechatNotifyRegisterTag{
Status: vo.WechatNotifyRegisterTagStatusFail.GetValue(), Status: vo.WechatNotifyRegisterTagStatusFail.GetValue(),