key_func.go 3.01 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 15 16
}

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

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
42 43 44 45

func GetOpenRamadanFruitBet(actId, userId uint64, round uint, date string) string {
	return fmt.Sprintf(OpenRamadanFruitBet, actId, date, userId, round)
}
chenweijian's avatar
chenweijian committed
46 47 48 49

func GetConvertToTRTCNum() string {
	return fmt.Sprintf(ConvertToTRTCNum, time.Now().Format(utils.DATE_FORMAT))
}
chenweijian's avatar
chenweijian committed
50 51 52 53

func GetUserTmpActId(relateId, userId uint64) string {
	return fmt.Sprintf(TmpActUserActId, relateId, userId)
}
chenweijian's avatar
chenweijian committed
54 55 56 57 58 59 60

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
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

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)
}