package user_k import ( "fmt" "git.hilo.cn/hilo-common/resource/mysql" "hilo-group/_const/redis_key" ) const ( UserPrefix = "user:" UserTinyInfoStr = UserPrefix + "tiny:${userId}" // value:json(cv.CvUserTiny) UserExternalIdToUIdStr = UserPrefix + "externalId:${externalId}" // value:userId UserCodeToUIdStr = UserPrefix + "code:${externalId}" // value:userId UserTradeUnionIds = "user:trade:union:ids" // type:string,value json(uids) ) // 获取用户简要信息缓存key func GetUserTinyKey(userId mysql.ID) string { return redis_key.ReplaceKey(UserTinyInfoStr, fmt.Sprintf("%d", userId)) } // 获取externalId到userId func GetExternalIdToUidKey(externalId mysql.Str) string { return redis_key.ReplaceKey(UserExternalIdToUIdStr, externalId) } // 获取code到userId func GetCodeToUidKey(code mysql.Str) string { return redis_key.ReplaceKey(UserCodeToUIdStr, code) }