diff --git a/internal/biz/notify_retry_consume.go b/internal/biz/notify_retry_consume.go index e516739..d5880f8 100644 --- a/internal/biz/notify_retry_consume.go +++ b/internal/biz/notify_retry_consume.go @@ -35,10 +35,10 @@ func (v *VoucherBiz) NotifyRetryConsume(ctx context.Context, orderNotifyId uint6 var ( err error orderNotify *bo.OrderNotifyBo - cache = vo.NotifyRetryConsume.BuildCacheUint64([]uint64{orderNotifyId}) + c = vo.NotifyRetryConsume.BuildCacheUint64([]uint64{orderNotifyId}) ) - err = lock.NewMutex(v.rdb.Rdb, cache.TTL).Lock(ctx, cache.Key, func(ctx context.Context) error { + err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error { orderNotify, err = v.OrderNotifyRepo.GetByID(ctx, orderNotifyId) if err != nil { diff --git a/internal/biz/vo/cache.go b/internal/biz/vo/cache.go index 2fa2ea0..e2b5120 100644 --- a/internal/biz/vo/cache.go +++ b/internal/biz/vo/cache.go @@ -58,10 +58,10 @@ func (s CacheKey) GetValue() string { func (s CacheKey) BuildCache(strArr []string) *Cache { - k := "" + k := s.GetValue() if len(strArr) > 0 { - k = helper.BuildStr(s.GetValue(), strArr) + k = helper.BuildStr(k, strArr) } c := &Cache{ @@ -80,10 +80,10 @@ func (s CacheKey) BuildCache(strArr []string) *Cache { func (s CacheKey) BuildCacheUint64(ids []uint64) *Cache { - k := "" + k := s.GetValue() if len(ids) > 0 { - k = helper.BuildStr(s.GetValue(), ids) + k = helper.BuildStr(k, ids) } c := &Cache{