|
|
@@ -13,6 +13,7 @@ import (
|
|
|
)
|
|
|
|
|
|
const RoleCdkInfo = "cdk_info_"
|
|
|
+const CdkTotal = "cdk_Total_"
|
|
|
|
|
|
// other service
|
|
|
func init() {
|
|
|
@@ -60,6 +61,16 @@ func init() {
|
|
|
gmmodel.SendSocial(res)
|
|
|
return
|
|
|
}
|
|
|
+ if v.Total > 0 {
|
|
|
+ ker := CdkTotal + strconv.Itoa(int(v.Id))
|
|
|
+ num, _ := service.GetRedis().Incr(ker).Result()
|
|
|
+ if num >= int64(v.Total) {
|
|
|
+ res.Error = 1
|
|
|
+ gmmodel.SendSocial(res)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
key := RoleCdkInfo + strconv.FormatUint(uuid, 10)
|
|
|
field := strconv.FormatInt(int64(v.Id), 10)
|
|
|
b, err := service.GetRedis().HExists(key, field).Result()
|