key_func.go 5.45 KB
Newer Older
chenweijian's avatar
chenweijian committed
1 2 3 4 5
package rediskey

import (
	"fmt"
	"git.hilo.cn/hilo-common/utils"
chenweijian's avatar
chenweijian committed
6
	"strings"
chenweijian's avatar
chenweijian committed
7 8 9
	"time"
)

chenweijian's avatar
chenweijian committed
10
func GetSlotFruitDailyTimes(userId uint64, nowTime time.Time) string {
chenweijian's avatar
chenweijian committed
11
	var cstZone = time.FixedZone("CST", 3*3600) // 东三区,沙特时间
chenweijian's avatar
chenweijian committed
12
	return fmt.Sprintf(SlotFruitWeeklyDailyTask, nowTime.In(cstZone).Format(utils.DATE_FORMAT), userId)
chenweijian's avatar
chenweijian committed
13 14
}

chenweijian's avatar
chenweijian committed
15 16 17 18 19
func GetGameSlotDailyTimes(userId uint64, nowTime time.Time) string {
	var cstZone = time.FixedZone("CST", 3*3600) // 东三区,沙特时间
	return fmt.Sprintf(GameSlotWeeklyDailyTask, nowTime.In(cstZone).Format(utils.DATE_FORMAT), userId)
}

chenweijian's avatar
chenweijian committed
20 21
func GetOpenRamadanChargeAwardTimes(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanChargeAwardTimes, actId, userId)
chenweijian's avatar
chenweijian committed
22
}
chenweijian's avatar
chenweijian committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

func GetOpenRamadanTaskTimesMic(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanTaskTimesMic, actId, time.Now().Format(utils.DATE_FORMAT), userId)
}

func GetOpenRamadanTaskTimesLudo(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanTaskTimesLudo, actId, time.Now().Format(utils.DATE_FORMAT), userId)
}

func GetOpenRamadanTaskTimesFruit(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanTaskTimesFruit, actId, time.Now().Format(utils.DATE_FORMAT), userId)
}

func GetOpenRamadanTaskTimesSlot(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanTaskTimesSlot, actId, time.Now().Format(utils.DATE_FORMAT), userId)
}

func GetOpenRamadanTaskTimesEnter(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanTaskTimesEnter, actId, time.Now().Format(utils.DATE_FORMAT), userId)
}

func GetOpenRamadanTaskTimesRoom(actId, userId, roomId uint64) string {
	return fmt.Sprintf(OpenRamadanTaskTimesRoom, actId, time.Now().Format(utils.DATE_FORMAT), userId, roomId)
}
chenweijian's avatar
chenweijian committed
47 48 49 50

func GetOpenRamadanFruitBet(actId, userId uint64, round uint, date string) string {
	return fmt.Sprintf(OpenRamadanFruitBet, actId, date, userId, round)
}
chenweijian's avatar
chenweijian committed
51 52 53 54

func GetConvertToTRTCNum() string {
	return fmt.Sprintf(ConvertToTRTCNum, time.Now().Format(utils.DATE_FORMAT))
}
chenweijian's avatar
chenweijian committed
55 56 57 58

func GetUserTmpActId(relateId, userId uint64) string {
	return fmt.Sprintf(TmpActUserActId, relateId, userId)
}
chenweijian's avatar
chenweijian committed
59 60 61 62 63 64 65

func GetActChargeDiamond(userId, actId uint64) string {
	if actId > 500 {
		return fmt.Sprintf(ActIdChargeDiamond, actId, time.Now().Format(utils.DATE_FORMAT), userId)
	}
	return fmt.Sprintf(ActChargeDiamond, time.Now().Format(utils.DATE_FORMAT), userId)
}
chenweijian's avatar
chenweijian committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

func GetActChargeGetPoint(userId, actId uint64, dollar int64) string {
	if actId > 500 {
		return fmt.Sprintf(ActIdChargeGetPoint, actId, time.Now().Format(utils.DATE_FORMAT), dollar, userId)
	}
	return fmt.Sprintf(ActChargeGetPoint, time.Now().Format(utils.DATE_FORMAT), dollar, userId)
}

func GetMonthChargeTimes(userId uint64) string {
	var cstZone = time.FixedZone("CST", 3*3600) // 东三区,沙特时间
	return fmt.Sprintf(MonthChargeTimes, time.Now().In(cstZone).Format(utils.MONTH_FORMAT), userId)
}

func GetRamadanDailyTaskGet(actId, userId uint64, nowTime time.Time) string {
	return fmt.Sprintf(RamadanDailyTaskGet, nowTime.Format(utils.DATE_FORMAT), actId, userId)
}

func GetRamadanGetDailyLottery(actId, userId uint64) string {
	return fmt.Sprintf(RamadanGetDailyLottery, time.Now().Format(utils.DATE_FORMAT), actId, userId)
}

func GetCronLockKey(subKey string) string {
	return strings.Replace(cronLock, "{subKey}", subKey, -1)
}
chenweijian's avatar
chenweijian committed
90

chenweijian's avatar
chenweijian committed
91 92
func GetActIpAwardTimesKey(actId uint64, awardType, level int, ip string) string {
	return fmt.Sprintf(ActIpGetAwardTimes, actId, awardType, level, ip)
chenweijian's avatar
chenweijian committed
93 94
}

chenweijian's avatar
chenweijian committed
95 96
func GetActImeiAwardTimesKey(actId uint64, awardType, level int, device string) string {
	return fmt.Sprintf(ActImeiGetAwardTimes, actId, awardType, level, device)
chenweijian's avatar
chenweijian committed
97
}
chenweijian's avatar
chenweijian committed
98 99 100 101

func GetExchangePinkCostDiamond(userId uint64) string {
	return fmt.Sprintf(ExchangePinkCostDiamond, time.Now().Format(utils.DATE_FORMAT), userId)
}
chenweijian's avatar
chenweijian committed
102 103 104 105

func GetOpenRamadanSendGiftLeftDiamond(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanSendGiftLeftDiamond, actId, userId)
}
chenweijian's avatar
chenweijian committed
106 107 108 109

func GetAutoMathEnterRoom(userId uint64, imGroupId string) string {
	return fmt.Sprintf(GameAutoMathEnterRoom, userId, imGroupId)
}
chenweijian's avatar
chenweijian committed
110

chenweijian's avatar
chenweijian committed
111 112
func GetGame1V1EnterRoom(txGroupId string) string {
	return fmt.Sprintf(Game1V1EnterRoom, txGroupId)
chenweijian's avatar
chenweijian committed
113
}
chenweijian's avatar
chenweijian committed
114 115 116 117

func GetGame1V1GameChannel(imGroupId string) string {
	return fmt.Sprintf(Game1V1GameChannel, imGroupId)
}
chenweijian's avatar
chenweijian committed
118

chenweijian's avatar
chenweijian committed
119 120
func GetGame1V1ResetGameRoom(txGroupId string) string {
	return fmt.Sprintf(Game1V1ResetGameRoom, txGroupId)
chenweijian's avatar
chenweijian committed
121
}
chenweijian's avatar
chenweijian committed
122 123 124 125

func GetGame1V1RoomRobot(txGroupId string) string {
	return fmt.Sprintf(Game1V1RoomRobot, txGroupId)
}
chenweijian's avatar
chenweijian committed
126 127 128 129 130 131 132 133

func GetGame1V1GameTimesRecord(userId1, userId2 uint64, gameId int) string {
	return fmt.Sprintf(Game1V1GameTimesRecord, time.Now().Format(utils.COMPACT_DATE_FORMAT), userId1, gameId, userId2)
}

func GetGame1V1GameWinTimesRecord(userId1, userId2 uint64, gameId int) string {
	return fmt.Sprintf(Game1V1GameWinTimesRecord, time.Now().Format(utils.COMPACT_DATE_FORMAT), userId1, gameId, userId2)
}
chenweijian's avatar
chenweijian committed
134

chenweijian's avatar
chenweijian committed
135 136
func GetGroupSupportConsumeSummary(period string) string {
	return fmt.Sprintf(GroupSupportConsumeSummary, period)
chenweijian's avatar
chenweijian committed
137 138
}

chenweijian's avatar
chenweijian committed
139 140
func GetGroupSupportCountSupporter(period, imGroupId string) string {
	return fmt.Sprintf(GroupSupportCountSupporter, period, imGroupId)
chenweijian's avatar
chenweijian committed
141
}
chenweijian's avatar
chenweijian committed
142 143 144 145

func GetPrefixRoomVisitCount() string {
	return RoomVisitCount
}
chenweijian's avatar
chenweijian committed
146 147 148 149

func GetGroupCountrySortList(country string) string {
	return fmt.Sprintf(GroupCountrySortList, country)
}
chenweijian's avatar
chenweijian committed
150

chenweijian's avatar
chenweijian committed
151
func GetActTemplateRanking(actId, teamId uint64, rankType int) string {
chenweijian's avatar
chenweijian committed
152
	return fmt.Sprintf(ActTemplateRanking, actId, rankType, teamId)
chenweijian's avatar
chenweijian committed
153
}
chenweijian's avatar
chenweijian committed
154 155 156 157

func GetActOldUserAllCharge(actId, userId uint64) string {
	return fmt.Sprintf(ActOldUserAllCharge, actId, userId)
}