Commit fd939999 authored by hujiebin's avatar hujiebin

feat:称号翻译

parent c89a1938
......@@ -38,6 +38,14 @@ var (
CpLevel4: "icon4.png",
CpLevel5: "icon5.png",
}
// cp等级称号
CpLevelTitle = map[CpLevel]uint{
CpLevel1: 252,
CpLevel2: 253,
CpLevel3: 254,
CpLevel4: 255,
CpLevel5: 256,
}
// cp特权名称
CpPrivilegeNameMsgId = map[CpPrivilege]uint{
CpPrivilegeSpace: 234,
......
......@@ -28,6 +28,7 @@ type CvCpLevel struct {
ExpireAtUnix int64 `json:"expireAtUnix,omitempty"` // 有效期,时间戳
SettlementDate string `json:"settlementDate"` // 等级过期时间
MaxLevel cp_e.CpLevel `json:"maxLevel"` // cp最大的等级
Title string `json:"title,omitempty"` // 称号翻译
}
// 资源等级
......
......@@ -95,12 +95,14 @@ func GetUserBagId(c *gin.Context) (*mycontext.MyContext, error) {
}
type GetUserCpReq struct {
Id mysql.ID `form:"id" binding:"required"`
Id mysql.ID `form:"id" binding:"required"`
Language string `form:"language"`
}
// @Tags 用户-内部
// @Summary 获取用户cp
// @Param id query int true "用户id"
// @Param language query string true "语言"
// @Success 200 {object} cp_cv.CvCp
// @Router /inner/user/cp [get]
func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
......@@ -151,10 +153,16 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
return myContext, err
}
// 返回值
title := ""
if msgId, ok := cp_e.CpLevelTitle[level.Level]; ok {
title = cp_cv.GetTranslate(msgId, req.Language)
}
response = cp_cv.CvCp{
CpUserInfo: userBases[cpUserId],
CpLevel: cp_cv.CvCpLevel{
Level: cpLevel,
Level: cpLevel,
Points: cp_e.CpLevelPoints[cpLevel] + level.Points,
Title: title,
},
MyPrivilegeList: myPrivilegeList,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment