This commit is contained in:
李子铭 2025-03-07 11:29:26 +08:00
parent 50c6f1f995
commit 0c1243419e
6 changed files with 9 additions and 6 deletions

View File

@ -21,7 +21,7 @@ data:
poolSize: 5 #连接池大小不配置或配置为0表示不启用连接池
minIdleConns: 2 #最小空闲连接数
connMaxIdleTime: 30s #每个连接最大空闲时间,如果超过了这个时间会被关闭
db: 1
db: 3
rocketMQ:
addr: "http://rmq-cn-nwy3fn4ex09.cn-chengdu.rmq.aliyuncs.com:8080"

View File

@ -30,7 +30,7 @@ func (v *Cmb) OrderConsume(ctx context.Context, order *bo.OrderBo) (outRequestNo
return
}
if err = v.registerNotifyTag(ctx, orderWechat.StockID); err != nil {
if err = v.registerNotifyTag(ctx, orderWechat.StockCreatorMchid, orderWechat.StockID); err != nil {
return outRequestNo, err
}
@ -46,7 +46,7 @@ func (v *Cmb) OrderConsume(ctx context.Context, order *bo.OrderBo) (outRequestNo
return orderWechat.OutRequestNo, err
}
func (v *Cmb) registerNotifyTag(ctx context.Context, stockID string) error {
func (v *Cmb) registerNotifyTag(ctx context.Context, stockCreatorMchID, stockID string) error {
if err := v.WechatCpnRepo.RegisterNotifyTag(ctx, stockID); err != nil {
return err

View File

@ -6,7 +6,7 @@ import (
)
type WechatNotifyRegisterTagRepo interface {
GetByStockIdAndMchId(ctx context.Context, stockId, stockCreatorMchID string) (*bo.WechatNotifyRegisterTagBo, error)
GetByStockIdAndMchId(ctx context.Context, stockCreatorMchID, stockId string) (*bo.WechatNotifyRegisterTagBo, error)
Create(ctx context.Context, req *bo.WechatNotifyRegisterTagBo) (*bo.WechatNotifyRegisterTagBo, error)
Success(ctx context.Context, id int32) error
Fail(ctx context.Context, id int32, remark string) error

View File

@ -60,6 +60,7 @@ func (p *OrderRepoImpl) GetByOutBizNo(ctx context.Context, outBizNo string) (*bo
if tx.Error != nil {
return nil, tx.Error
}
if tx.RowsAffected == 0 {
return nil, gorm.ErrRecordNotFound
}

View File

@ -32,6 +32,7 @@ func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.Product
if tx.Error != nil {
return nil, tx.Error
}
if tx.RowsAffected == 0 {
return nil, gorm.ErrRecordNotFound
}

View File

@ -27,14 +27,15 @@ func (p *WechatNotifyRegisterTagRepoImpl) DB(ctx context.Context) *gorm.DB {
return p.db.DB(ctx).Model(model.WechatNotifyRegisterTag{})
}
func (p *WechatNotifyRegisterTagRepoImpl) GetByStockIdAndMchId(ctx context.Context, stockId, stockCreatorMchID string) (*bo.WechatNotifyRegisterTagBo, error) {
func (p *WechatNotifyRegisterTagRepoImpl) GetByStockIdAndMchId(ctx context.Context, stockCreatorMchID, stockId string) (*bo.WechatNotifyRegisterTagBo, error) {
info := &model.WechatNotifyRegisterTag{}
tx := p.DB(ctx).Where(model.WechatNotifyRegisterTag{StockID: stockId, StockCreatorMchID: stockCreatorMchID}).Find(&info)
tx := p.DB(ctx).Where(model.WechatNotifyRegisterTag{StockCreatorMchID: stockCreatorMchID, StockID: stockId}).Find(&info)
if tx.Error != nil {
return nil, tx.Error
}
if tx.RowsAffected == 0 {
return nil, gorm.ErrRecordNotFound
}