Commit 75d3afc5 authored by hujiebin's avatar hujiebin

等级特权

parent 7fdd9d66
......@@ -47,10 +47,10 @@ type CvPrivilege struct {
// cp空间页
type CvSpace struct {
CpInfo CvCpInfo `json:"cpInfo"` // cp信息
CpLevel CvCpLevel `json:"cpLevel"` // cp等级
ResLevelList []CvResLevel `json:"resLevelList"` // 资源等级列表,无称号/恋爱CP/甜蜜CP/忠诚CP/炽热CP/荣耀CP
PrivilegeList []CvPrivilege `json:"privilegeList"` // 等级特权
CpInfo CvCpInfo `json:"cpInfo"` // cp信息
CpLevel CvCpLevel `json:"cpLevel"` // cp等级
ResLevelList []CvResLevel `json:"resLevelList"` // 资源等级列表,无称号/恋爱CP/甜蜜CP/忠诚CP/炽热CP/荣耀CP
PrivilegeList [][]CvPrivilege `json:"privilegeList"` // 等级特权
}
var CvResLevelList = []CvResLevel{
......
......@@ -77,15 +77,19 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
if cpLevel != cp_e.CpLevelMax {
nextPoints = cp_e.CpLevelPoints[cpLevel+1]
}
privilegeList := cp_cv.CopyCpLevelPrivilegeList(cpLevel, lang)
userPrivileges, err := cp_m.MGetUserSvipPrivilege(model, []uint64{userId})
if err != nil {
return myContext, err
}
for i, v := range privilegeList {
if v.CanSwitch {
privilegeList[i].UserSwitch = userPrivileges[userId][v.Type]
allPrivilegeList := make([][]cp_cv.CvPrivilege, cp_e.CpLevelMax+1)
for level := cp_e.CpLevel0; level <= cp_e.CpLevelMax; level++ {
privilegeList := cp_cv.CopyCpLevelPrivilegeList(level, lang)
for i, v := range privilegeList {
if v.CanSwitch {
privilegeList[i].UserSwitch = userPrivileges[userId][v.Type]
}
}
allPrivilegeList[level] = privilegeList
}
// 返回值
response := cp_cv.CvSpace{
......@@ -98,7 +102,7 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
SettlementDate: settlementDate,
},
ResLevelList: cp_cv.CvResLevelList,
PrivilegeList: privilegeList,
PrivilegeList: allPrivilegeList,
}
response.CpInfo = cp_cv.CvCpInfo{
UserInfo: user_cv.UserToTiny(*userInfo),
......
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