Commit 96cb5dc3 authored by hujiebin's avatar hujiebin

Merge branch 'feature/family' into feature/3.5

parents 09d28573 e678d573
......@@ -62,10 +62,10 @@ type MemberListInfo struct {
}
type GroupPower struct {
Id uint64 `json:"groupPowerId"` // 群主所在的势力ID
Name string `json:"groupPowerName"` // 群主所在的势力的名称
Nameplate string `json:"groupPowerNameplate"` // 势力铭牌
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级
Id uint64 `json:"id"` // 群主所在的势力ID
Name string `json:"name"` // 群主所在的势力的名称
Nameplate string `json:"nameplate"` // 势力铭牌
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级
}
type GroupInfo struct {
......
......@@ -7,6 +7,7 @@ import (
"git.hilo.cn/hilo-common/rpc"
. "git.hilo.cn/hilo-common/utils"
"gorm.io/gorm"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/user_e"
"hilo-group/cv/country_cv"
......@@ -61,12 +62,20 @@ type CvUserDetail struct {
CurrentRoom string `json:"currentRoom"` // 当前用户所在房间(产品叫“群组”)
MyGroupPower uint64 `json:"myGroupPower"` // 当前用户所在势力
MyGroupPowerName string `json:"myGroupPowerName"` // 当前用户所在势力绑定群组的名称
GroupPower GroupPower `json:"groupPower"` // 当前用户势力信息
GroupId string `json:"groupId"` // 当前用户拥有的群组id(产品叫“群组”),如果没有则为空,拥有多个,返回第一个
PhoneInfo *user_m.UserPhoneInfo `json:"phoneInfo"` // 用户绑定的手机信息
ThirdList []int8 `json:"thirdList"` // 用户绑定的第三方平台列表;类型 1:phone, 2:google, 3:facebook 4:apple 5:wechat" Enums(1,2,3,4,5)
CountryManager *country_cv.CVCountryManager `json:"countryManager,omitempty"` // 国家管理员
}
type GroupPower struct {
Id uint64 `json:"id"` // 群主所在的势力ID
Name string `json:"name"` // 群主所在的势力的名称
Nameplate string `json:"nameplate"` // 势力铭牌
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级
}
type CvUserTiny struct {
Id uint64 `json:"id,omitempty"`
ExternalId string `json:"externalId"`
......@@ -290,6 +299,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
}
model.Log.Infof("getUserDetails: %+v", rooms)
// userId->groupPowerId
groupPowers, err := groupPower_m.GetGroupPowerMap(mysql.Db, userIds)
if err != nil {
return nil, err
......@@ -303,9 +313,21 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
if err != nil {
return nil, err
}
groupPowerInfoMap, err := groupPower_m.MGetGroupPowerInfoMap(model, gpIds)
if err != nil {
return nil, err
}
groupPowerGradeMap, err := groupPower_m.MGetGroupPowerGrade(model, gpIds)
if err != nil {
return nil, err
}
groupPowerNames := make(map[mysql.ID]string, 0)
for i, g := range groupPowers {
groupPowerNames[i] = powerNames[g]
groupPowerInfos := make(map[mysql.ID]groupPower_m.GroupPowerInfo)
groupPowerGrades := make(map[mysql.ID]groupPower_m.GroupPowerGrade)
for uid, gid := range groupPowers {
groupPowerNames[uid] = powerNames[gid]
groupPowerInfos[uid] = groupPowerInfoMap[gid]
groupPowerGrades[uid] = groupPowerGradeMap[gid]
}
up := user_m.UserProperty{}
......@@ -350,7 +372,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
cvUserDetail, err := userToDetail(users[i], myUserId, userTradeUnion, likeMap, likeMeMap, rels,
vips[users[i].ID] != nil, vips[users[i].ID], svips[users[i].ID], headwear, ride,
wealthGradeMap, charmGradeMap, activeGradeMap, medals, medalInfo, rooms, groupPowers, groupPowerNames, nobles, superManagerMap)
wealthGradeMap, charmGradeMap, activeGradeMap, medals, medalInfo, rooms, groupPowers, groupPowerNames, groupPowerInfos, groupPowerGrades, nobles, superManagerMap)
if err != nil {
return nil, err
}
......@@ -370,7 +392,7 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U
likeMeMap map[mysql.ID]bool, hvMap map[mysql.ID]Relation, isVip bool, vipExpireTime *int64, svip rpc.CvSvip, headwear *headwear_cv.CvHeadwear, ride property_cv.CvProperty,
wealthGradeMap map[mysql.ID]uint32, charmGradeMap map[mysql.ID]uint32, actityGradeMap map[mysql.ID]uint32,
medals map[uint64][]uint32, medalInfo map[uint64][]medal_cv.CvMedal, rooms map[mysql.ID]string,
powers map[mysql.ID]uint64, powerNames map[mysql.ID]string, nobles map[mysql.ID]noble_m.UserNoble, superManagerMap map[uint64]bool) (*CvUserDetail, error) {
powers map[mysql.ID]uint64, powerNames map[mysql.ID]string, groupPowerInfos map[mysql.ID]groupPower_m.GroupPowerInfo, powerGrades map[mysql.ID]groupPower_m.GroupPowerGrade, nobles map[mysql.ID]noble_m.UserNoble, superManagerMap map[uint64]bool) (*CvUserDetail, error) {
cvUserDetail := &CvUserDetail{
CvUserBase: CvUserBase{
Id: &user.ID,
......@@ -510,6 +532,12 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U
cvUserDetail.CurrentRoom = rooms[user.ID]
cvUserDetail.MyGroupPower = powers[user.ID]
cvUserDetail.MyGroupPowerName = powerNames[user.ID]
cvUserDetail.GroupPower = GroupPower{
Id: groupPowerInfos[user.ID].ID,
Name: groupPowerInfos[user.ID].Name,
Nameplate: groupPowerInfos[user.ID].Nameplate,
Grade: powerGrades[user.ID].Grade,
}
if n, ok := nobles[user.ID]; ok && n.Level > 0 {
cvUserDetail.Noble = noble_cv.CvNoble{
Level: n.Level,
......@@ -670,6 +698,8 @@ func GetUserDetail(model *domain.Model, userId mysql.ID, myUserId mysql.ID) (*Cv
}
powers := map[mysql.ID]uint64{userId: groupPowerId}
powerNames := map[mysql.ID]string{userId: groupPowerName}
groupPowerInfos, err := groupPower_m.MGetGroupPowerInfoMap(model, []mysql.ID{groupPowerId})
groupPowerGrades, err := groupPower_m.MGetGroupPowerGrade(model, []mysql.ID{groupPowerId})
up := user_m.UserProperty{}
rides, err := up.BatchGet(mysql.Db, []uint64{userId})
......@@ -759,14 +789,14 @@ func GetUserDetail(model *domain.Model, userId mysql.ID, myUserId mysql.ID) (*Cv
return userToDetailOne(model, &user, myUserId, userTradeUnion, likeN > 0, likeMe > 0,
rel, isVip, expireTime, svip, headwear, ride, wealthUserScore.Grade, charmUserScore.Grade,
activityUserScore.Grade, medals[userId], medalInfo[userId], rooms[userId], powers[userId], powerNames[userId],
activityUserScore.Grade, medals[userId], medalInfo[userId], rooms[userId], powers[userId], powerNames[userId], groupPowerInfos[groupPowerId].Nameplate, groupPowerGrades[groupPowerId],
noble, superManagerMap[userId], myGroups, phoneInfo, thirdList, cvCountryManager)
}
// 单用户版,简化参数
func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.UserTradeUnion, isLike bool, likeMe bool, hvMap map[mysql.ID]Relation,
isVip bool, vipExpireTime *int64, svip rpc.CvSvip, headwear *headwear_cv.CvHeadwear, ride property_cv.CvProperty, wealthGrade uint32, charmGrade uint32, activityGrade uint32,
medals []uint32, medalInfo []medal_cv.CvMedal, room string, power uint64, powerName string, noble *noble_m.UserNoble, isOfficialStaff bool,
medals []uint32, medalInfo []medal_cv.CvMedal, room string, power uint64, powerName string, powerNameplate string, grade groupPower_m.GroupPowerGrade, noble *noble_m.UserNoble, isOfficialStaff bool,
myGroups []group_m.GroupInfo, phoneInfo *user_m.UserPhoneInfo, thirdList []int8, countryManager *country_cv.CVCountryManager) (*CvUserDetail, error) {
room, err := group_m.ToTxGroupId(model, room)
......@@ -806,9 +836,15 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID,
CurrentRoom: room,
MyGroupPower: power,
MyGroupPowerName: powerName,
PhoneInfo: phoneInfo,
ThirdList: thirdList,
CountryManager: countryManager,
GroupPower: GroupPower{
Id: power,
Name: powerName,
Nameplate: powerNameplate,
Grade: grade.Grade,
},
PhoneInfo: phoneInfo,
ThirdList: thirdList,
CountryManager: countryManager,
}
if noble != nil {
cvUserDetail.Noble = noble_cv.CvNoble{
......
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