Commit b14c1035 authored by chenweijian's avatar chenweijian

redis key

parent 3c6078f2
...@@ -42,4 +42,7 @@ const ( ...@@ -42,4 +42,7 @@ const (
// 定时任务的互斥锁 // 定时任务的互斥锁
cronLock = "cronLock:{subKey}" cronLock = "cronLock:{subKey}"
ActIpGetAwardTimes = "act:ipAwardTimes:%d:%d:%s" // 一个ip在活动中的领奖次数 活动id:领奖类型:ip地址
ActDeviceGetAwardTimes = "act:deviceAwardTimes:%d:%d:%s" // 一个设备在活动中的领奖次数 活动id:领奖类型:设备号
) )
...@@ -82,3 +82,11 @@ func GetRamadanGetDailyLottery(actId, userId uint64) string { ...@@ -82,3 +82,11 @@ func GetRamadanGetDailyLottery(actId, userId uint64) string {
func GetCronLockKey(subKey string) string { func GetCronLockKey(subKey string) string {
return strings.Replace(cronLock, "{subKey}", subKey, -1) 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)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment