package rediskey

import (
	"fmt"
	"git.hilo.cn/hilo-common/utils"
	"strings"
	"time"
)

func GetSlotFruitDailyTimes(userId uint64, nowTime time.Time) string {
	var cstZone = time.FixedZone("CST", 3*3600) // 东三区,沙特时间
	return fmt.Sprintf(SlotFruitWeeklyDailyTask, nowTime.In(cstZone).Format(utils.DATE_FORMAT), userId)
}

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

func GetOpenRamadanChargeAwardTimes(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanChargeAwardTimes, actId, userId)
}

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

func GetOpenRamadanFruitBet(actId, userId uint64, round uint, date string) string {
	return fmt.Sprintf(OpenRamadanFruitBet, actId, date, userId, round)
}

func GetConvertToTRTCNum() string {
	return fmt.Sprintf(ConvertToTRTCNum, time.Now().Format(utils.DATE_FORMAT))
}

func GetUserTmpActId(relateId, userId uint64) string {
	return fmt.Sprintf(TmpActUserActId, relateId, userId)
}

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

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

func GetActIpAwardTimesKey(actId uint64, awardType, level int, ip string) string {
	return fmt.Sprintf(ActIpGetAwardTimes, actId, awardType, level, ip)
}

func GetActImeiAwardTimesKey(actId uint64, awardType, level int, device string) string {
	return fmt.Sprintf(ActImeiGetAwardTimes, actId, awardType, level, device)
}

func GetExchangePinkCostDiamond(userId uint64) string {
	return fmt.Sprintf(ExchangePinkCostDiamond, time.Now().Format(utils.DATE_FORMAT), userId)
}

func GetOpenRamadanSendGiftLeftDiamond(actId, userId uint64) string {
	return fmt.Sprintf(OpenRamadanSendGiftLeftDiamond, actId, userId)
}

func GetAutoMathEnterRoom(userId uint64, imGroupId string) string {
	return fmt.Sprintf(GameAutoMathEnterRoom, userId, imGroupId)
}

func GetGame1V1EnterRoom(txGroupId string) string {
	return fmt.Sprintf(Game1V1EnterRoom, txGroupId)
}

func GetGame1V1GameChannel(imGroupId string) string {
	return fmt.Sprintf(Game1V1GameChannel, imGroupId)
}

func GetGame1V1ResetGameRoom(txGroupId string) string {
	return fmt.Sprintf(Game1V1ResetGameRoom, txGroupId)
}

func GetGame1V1RoomRobot(txGroupId string) string {
	return fmt.Sprintf(Game1V1RoomRobot, txGroupId)
}

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

func GetGroupSupportConsumeSummary(period string) string {
	return fmt.Sprintf(GroupSupportConsumeSummary, period)
}

func GetGroupSupportCountSupporter(period, imGroupId string) string {
	return fmt.Sprintf(GroupSupportCountSupporter, period, imGroupId)
}

func GetPrefixRoomVisitCount() string {
	return RoomVisitCount
}

func GetGroupCountrySortList(country string) string {
	return fmt.Sprintf(GroupCountrySortList, country)
}

func GetActTemplateRanking(actId, teamId uint64, rankType int) string {
	return fmt.Sprintf(ActTemplateRanking, actId, rankType, teamId)
}

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