From b14c103507c604a83d0e4811287c6e86cb3efb19 Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Tue, 13 Jun 2023 16:21:53 +0800 Subject: [PATCH] redis key --- _const/rediskey/key.go | 3 +++ _const/rediskey/key_func.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/_const/rediskey/key.go b/_const/rediskey/key.go index 2bd5757..8172ad0 100644 --- a/_const/rediskey/key.go +++ b/_const/rediskey/key.go @@ -42,4 +42,7 @@ const ( // 定时任务的互斥锁 cronLock = "cronLock:{subKey}" + + ActIpGetAwardTimes = "act:ipAwardTimes:%d:%d:%s" // 一个ip在活动中的领奖次数 活动id:领奖类型:ip地址 + ActDeviceGetAwardTimes = "act:deviceAwardTimes:%d:%d:%s" // 一个设备在活动中的领奖次数 活动id:领奖类型:设备号 ) diff --git a/_const/rediskey/key_func.go b/_const/rediskey/key_func.go index b704c10..150cfa3 100644 --- a/_const/rediskey/key_func.go +++ b/_const/rediskey/key_func.go @@ -82,3 +82,11 @@ func GetRamadanGetDailyLottery(actId, userId uint64) string { func GetCronLockKey(subKey string) string { return strings.Replace(cronLock, "{subKey}", subKey, -1) } + +func GetActIpGetAwardTimesKey(actId uint64, awardType int, ip string) string { + return fmt.Sprintf(ActIpGetAwardTimes, actId, awardType, ip) +} + +func GetActDeviceGetAwardTimesKey(actId uint64, awardType int, device string) string { + return fmt.Sprintf(ActDeviceGetAwardTimes, actId, awardType, device) +} -- 2.22.0