Commit 573400b0 authored by hujiebin's avatar hujiebin

Merge branch 'feature/cp-new' into feature/3.9.0

parents e7c02473 acad438a
package cp_cv
import "hilo-user/cv/user_cv"
// cp信息
type CvCp struct {
CpInfo CvCpInfo `json:"cpInfo"` // cp信息
CpLevel CvCpLevel `json:"cpLevel"` // cp等级
PrivilegeList []CvPrivilege `json:"privilegeList"` // 等级特权
CpInfo CvCpInfoAll `json:"cpInfo"` // cp信息
CpLevel CvCpLevel `json:"cpLevel"` // cp等级
MyPrivilegeList []CvPrivilege `json:"myPrivilegeList"` // 等级特权
}
type CvCpInfoAll struct {
UserInfo *user_cv.CvUserBase `json:"userInfo"` // 用户信息
CpUserInfo *user_cv.CvUserBase `json:"cpUserInfo"` // cp用户信息
}
......@@ -111,17 +111,12 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
return myContext, err
}
userId := req.Id
userInfo, err := user_m.GetUser(model, userId)
if err != nil {
return myContext, err
}
var response cp_cv.CvCp
cpLevel := cp_e.CpLevel0
cpRelation, exists := cp_m.GetCpRelation(model, userId)
if !exists {
resp.ResponseOk(c, response)
}
var cpUserInfo *user_m.User
var myPrivilegeList []cp_cv.CvPrivilege
level := cp_m.GetCpLevel(model, cpRelation.ID)
if level.ExpireAt.Before(time.Now()) {
......@@ -132,10 +127,6 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
if cpUserId == userId {
cpUserId = cpRelation.UserId1
}
cpUserInfo, err = user_m.GetUser(model, cpUserId)
if err != nil {
return myContext, err
}
userPrivileges, err := cp_m.MGetUserSvipPrivilege(model, []uint64{userId})
if err != nil {
return myContext, err
......@@ -154,16 +145,20 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
myPrivilegeList = append(myPrivilegeList, privilegeList[i])
}
}
userBases, err := user_cv.GetUserBaseMap([]uint64{cpUserId}, userId)
if err != nil {
return myContext, err
}
// 返回值
response = cp_cv.CvCp{
CpInfo: cp_cv.CvCpInfo{
UserInfo: user_cv.UserToTiny(*userInfo),
CpUserInfo: user_cv.UserToTiny(*cpUserInfo),
CpInfo: cp_cv.CvCpInfoAll{
//UserInfo: userBases[userId],
CpUserInfo: userBases[cpUserId],
},
CpLevel: cp_cv.CvCpLevel{
Level: cpLevel,
},
PrivilegeList: myPrivilegeList,
MyPrivilegeList: myPrivilegeList,
}
resp.ResponseOk(c, response)
return myContext, nil
......
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