Initial commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package consts
|
||||
|
||||
type RunMod string
|
||||
|
||||
const (
|
||||
RunModeDev RunMod = "dev"
|
||||
RunModeTest RunMod = "test"
|
||||
RunModRelease RunMod = "release"
|
||||
)
|
||||
const (
|
||||
ShowMagic int = 8564
|
||||
)
|
||||
|
||||
var StatusDesc = map[bool]string{
|
||||
true: "打开",
|
||||
false: "关闭",
|
||||
}
|
||||
|
||||
var IsShowDesc = map[bool]string{
|
||||
true: "展示",
|
||||
false: "不展示",
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package redisconst
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
visitLogFmt = "visitlog:%s:%d"
|
||||
AvSearchPre = "yc_av_search_cache:%s:%d"
|
||||
PostSearchPre = "yc_post_search_cache:%s:%d"
|
||||
//SpCache = "sp_cache"
|
||||
FiveMVisit = "yc_visitFmt:%s"
|
||||
BloomUser = "yc_bloom_user:%d"
|
||||
AppUserToken = "yc_app_user_token:%d"
|
||||
H5AppUserToken = "yc_h5app_user_token:%d"
|
||||
captchaKey = "yc_captcha_mobile_%s"
|
||||
CaptchaExpire = 5 * time.Minute
|
||||
|
||||
traderChatCacheFmt = "trader:cache:%d"
|
||||
TraderChatCacheExpire = 2 * time.Minute
|
||||
|
||||
mediaM3U8Fmt = "m3u8cache:%s"
|
||||
MediaM3U8CacheExpire = time.Hour * 24 * 7
|
||||
|
||||
//禁止登陆设置
|
||||
userForbit = "userForbit:%d"
|
||||
ipForbit = "ipForbit:%s"
|
||||
|
||||
//用户关注限制
|
||||
careLimitKey = "carelimit:%d"
|
||||
CareLimitKeyExpire = 15 * time.Second
|
||||
|
||||
//用户发帖限制
|
||||
commentLimitKey = "commentlimit:%d"
|
||||
CommentLimitKeyExpire = 15 * time.Second
|
||||
//用户firstVipGiftCheck
|
||||
firstVipGiftCheck = "gameVipCheck:%d"
|
||||
|
||||
//每用户访问次数限制
|
||||
userCallLimit = "userCall:%d"
|
||||
ipCallLimit = "ipCall:%s"
|
||||
CallLimitExpire = time.Second * 10
|
||||
|
||||
//游戏orderkey
|
||||
gameOrderKey = "gameOrderKey:%s"
|
||||
GameOrderKeyExpire = time.Second * 10
|
||||
)
|
||||
|
||||
func BloomUserKey(userId int64) string {
|
||||
return fmt.Sprintf(BloomUser, userId)
|
||||
}
|
||||
|
||||
func FiveMVisitKey(time string) string {
|
||||
return fmt.Sprintf(FiveMVisit, time)
|
||||
}
|
||||
|
||||
func UserVisitLogKey(uid int64, t time.Time) string {
|
||||
return fmt.Sprintf(visitLogFmt, t.Format("20060102"), uid)
|
||||
}
|
||||
|
||||
func AvSearchCacheKey(keyword string, skip int64) string {
|
||||
return fmt.Sprintf(AvSearchPre, keyword, skip)
|
||||
}
|
||||
|
||||
func PostSearchCacheKey(keyword string, skip int64) string {
|
||||
return fmt.Sprintf(PostSearchPre, keyword, skip)
|
||||
}
|
||||
|
||||
func MobileCaptchaKey(mobile string) string {
|
||||
return fmt.Sprintf(captchaKey, mobile)
|
||||
}
|
||||
|
||||
func AppUserTokenKey(userId int64) string {
|
||||
return fmt.Sprintf(AppUserToken, userId)
|
||||
}
|
||||
func H5AppUserTokenKey(userId int64) string {
|
||||
return fmt.Sprintf(H5AppUserToken, userId)
|
||||
}
|
||||
|
||||
func TraderChatCacheKey(uid uint64) string {
|
||||
return fmt.Sprintf(traderChatCacheFmt, uid)
|
||||
}
|
||||
|
||||
func MediaM3U8Key(name string) string {
|
||||
return fmt.Sprintf(mediaM3U8Fmt, name)
|
||||
}
|
||||
func UserForbitKey(userId int64) string {
|
||||
return fmt.Sprintf(userForbit, userId)
|
||||
}
|
||||
|
||||
func CareLimitKey(userId int64) string {
|
||||
return fmt.Sprintf(careLimitKey, userId)
|
||||
}
|
||||
|
||||
func CommentLimitKey(userId int64) string {
|
||||
return fmt.Sprintf(commentLimitKey, userId)
|
||||
}
|
||||
|
||||
func FirstVipGiftCheck(userId int64) string {
|
||||
return fmt.Sprintf(firstVipGiftCheck, userId)
|
||||
}
|
||||
|
||||
func UserCallLimitKey(userId int64) string {
|
||||
return fmt.Sprintf(userCallLimit, userId)
|
||||
}
|
||||
|
||||
func IpCallLimitKey(ip string) string {
|
||||
return fmt.Sprintf(ipCallLimit, ip)
|
||||
}
|
||||
|
||||
func IpForbitKey(ip string) string {
|
||||
ip = strings.ReplaceAll(ip, ":", "-")
|
||||
return fmt.Sprintf(ipForbit, ip)
|
||||
}
|
||||
|
||||
func GameOrderKey(orderId string) string {
|
||||
return fmt.Sprintf(gameOrderKey, orderId)
|
||||
}
|
||||
Reference in New Issue
Block a user