mysql
This commit is contained in:
parent
6113645400
commit
06c43184e1
|
|
@ -70,18 +70,18 @@ func (v *VoucherBiz) CmbQuery(ctx context.Context, orderNo string) (resp *v1.Cmb
|
||||||
|
|
||||||
err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error {
|
err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error {
|
||||||
|
|
||||||
order, err := v.OrderRepo.GetByOrderNo(ctx, orderNo)
|
order, err3 := v.OrderRepo.GetByOrderNo(ctx, orderNo)
|
||||||
if err != nil {
|
if err3 != nil {
|
||||||
return err
|
return err3
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = v.Query(ctx, order); err != nil {
|
if err = v.Query(ctx, order); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
status, err := order.Status.GetCmbStatusText()
|
status, err3 := order.Status.GetCmbStatusText()
|
||||||
if err != nil {
|
if err3 != nil {
|
||||||
return err
|
return err3
|
||||||
}
|
}
|
||||||
|
|
||||||
resp = &v1.CmbQueryReply{
|
resp = &v1.CmbQueryReply{
|
||||||
|
|
@ -157,9 +157,9 @@ func (v *VoucherBiz) CmbProductQuery(ctx context.Context, productNo string) (rep
|
||||||
availableStock := *wechatResp.StockUseRule.MaxCoupons - *wechatResp.DistributedCoupons
|
availableStock := *wechatResp.StockUseRule.MaxCoupons - *wechatResp.DistributedCoupons
|
||||||
reps.AvailableStock = fmt.Sprintf("%d", availableStock)
|
reps.AvailableStock = fmt.Sprintf("%d", availableStock)
|
||||||
|
|
||||||
availableType, err := product.AvailableType.GetCmbAvailableType()
|
availableType, err3 := product.AvailableType.GetCmbAvailableType()
|
||||||
if err != nil {
|
if err3 != nil {
|
||||||
return err
|
return err3
|
||||||
}
|
}
|
||||||
|
|
||||||
reps.AvailableType = availableType.GetValue()
|
reps.AvailableType = availableType.GetValue()
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,9 @@ func (v *VoucherBiz) registerNotifyTag(ctx context.Context, stockCreatorMchID, s
|
||||||
return lock.NewMutex(v.rdb.Rdb, cl.TTL).Lock(ctx, cl.Key, func(ctx context.Context) error {
|
return lock.NewMutex(v.rdb.Rdb, cl.TTL).Lock(ctx, cl.Key, func(ctx context.Context) error {
|
||||||
// 二次获取,判定处理,以免获取锁后又执行了一次
|
// 二次获取,判定处理,以免获取锁后又执行了一次
|
||||||
|
|
||||||
cacheValue, err := v.rdb.Rdb.Get(ctx, c.Key).Result()
|
cacheValue, err3 := v.rdb.Rdb.Get(ctx, c.Key).Result()
|
||||||
|
|
||||||
if err != nil && err != redis.Nil {
|
if err3 != nil && err3 != redis.Nil {
|
||||||
return fmt.Errorf(fmt.Sprintf("二次获取redis缓存%s异常:%v", c.Key, err))
|
return fmt.Errorf(fmt.Sprintf("二次获取redis缓存%s异常:%v", c.Key, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,9 +105,9 @@ func (v *VoucherBiz) registerNotifyTag(ctx context.Context, stockCreatorMchID, s
|
||||||
return nil // 有直接返回
|
return nil // 有直接返回
|
||||||
}
|
}
|
||||||
|
|
||||||
wechatNotifyTag, err := v.WechatNotifyRegisterTagRepo.GetByStockIdAndMchId(ctx, stockCreatorMchID, stockID)
|
wechatNotifyTag, err3 := v.WechatNotifyRegisterTagRepo.GetByStockIdAndMchId(ctx, stockCreatorMchID, stockID)
|
||||||
if err != nil && !err2.IsDbNotFound(err) {
|
if err3 != nil && !err2.IsDbNotFound(err3) {
|
||||||
return err
|
return err3
|
||||||
}
|
}
|
||||||
|
|
||||||
if wechatNotifyTag != nil {
|
if wechatNotifyTag != nil {
|
||||||
|
|
@ -119,9 +119,9 @@ func (v *VoucherBiz) registerNotifyTag(ctx context.Context, stockCreatorMchID, s
|
||||||
return v.setCache(ctx, c, wechatNotifyTag)
|
return v.setCache(ctx, c, wechatNotifyTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
wechatNotifyTag, err = v.createWechatNotifyRegisterTag(ctx, stockCreatorMchID, stockID)
|
wechatNotifyTag, err3 = v.createWechatNotifyRegisterTag(ctx, stockCreatorMchID, stockID)
|
||||||
if err != nil {
|
if err3 != nil {
|
||||||
return err
|
return err3
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = v.WechatCpnRepo.RegisterNotifyTag(ctx, stockID); err != nil {
|
if err = v.WechatCpnRepo.RegisterNotifyTag(ctx, stockID); err != nil {
|
||||||
|
|
@ -194,9 +194,9 @@ func (v *VoucherBiz) alarm(ctx context.Context, order *bo.OrderBo, errMsg string
|
||||||
return lock.NewMutex(v.rdb.Rdb, cl.TTL).Lock(ctx, cl.Key, func(ctx context.Context) error {
|
return lock.NewMutex(v.rdb.Rdb, cl.TTL).Lock(ctx, cl.Key, func(ctx context.Context) error {
|
||||||
// 二次获取,判定处理,以免获取锁后又执行了一次
|
// 二次获取,判定处理,以免获取锁后又执行了一次
|
||||||
|
|
||||||
cacheValue, err := v.rdb.Rdb.Get(ctx, c.Key).Result()
|
cacheValue, err3 := v.rdb.Rdb.Get(ctx, c.Key).Result()
|
||||||
|
|
||||||
if err != nil && err != redis.Nil {
|
if err3 != nil && err3 != redis.Nil {
|
||||||
return fmt.Errorf(fmt.Sprintf("alarm 二次获取redis缓存%s异常:%v", c.Key, err))
|
return fmt.Errorf(fmt.Sprintf("alarm 二次获取redis缓存%s异常:%v", c.Key, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue