key_func.go 3.84 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)
}