From cb5ce456ac57ef25af3e82fe98806d375bb66575 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 20 Mar 2023 15:49:58 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv/user_cv/user.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/cv/user_cv/user.go b/cv/user_cv/user.go index 402ee33..3a2762d 100644 --- a/cv/user_cv/user.go +++ b/cv/user_cv/user.go @@ -732,6 +732,28 @@ func GetUserDetail(model *domain.Model, userId mysql.ID, myUserId mysql.ID) (*Cv 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}) + groupPowerUsers, err := groupPower_m.MGetGroupPowerUsers(model, []mysql.ID{groupPowerId}) + var memberMax int + grade := groupPowerGrades[groupPowerId].Grade + if grade >= groupPower_e.GroupPowerGrade0 && grade <= groupPower_e.GroupPowerGradeMax { + if grade == groupPower_e.GroupPowerGrade0 { + memberMax = 300 + } + if grade == groupPower_e.GroupPowerGrade1 { + memberMax = 500 + } + if grade == groupPower_e.GroupPowerGrade2 { + memberMax = 800 + } + if grade == groupPower_e.GroupPowerGrade3 { + memberMax = 1200 + } + } + memberNum := len(groupPowerUsers[groupPowerId]) + if memberNum > memberMax { + memberMax = memberNum + } + groupPowerMembers := [2]int{memberNum, memberMax} // 0->memberNum 1->memberLimit up := user_m.UserProperty{} rides, err := up.BatchGet(mysql.Db, []uint64{userId}) @@ -821,14 +843,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], groupPowerInfos[groupPowerId].Nameplate, groupPowerGrades[groupPowerId], + activityUserScore.Grade, medals[userId], medalInfo[userId], rooms[userId], powers[userId], powerNames[userId], groupPowerInfos[groupPowerId].Nameplate, groupPowerGrades[groupPowerId], groupPowerMembers, 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, powerNameplate string, grade groupPower_m.GroupPowerGrade, noble *noble_m.UserNoble, isOfficialStaff bool, + medals []uint32, medalInfo []medal_cv.CvMedal, room string, power uint64, powerName string, powerNameplate string, grade groupPower_m.GroupPowerGrade, members [2]int, 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) @@ -873,6 +895,8 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, Name: powerName, Nameplate: powerNameplate, Grade: grade.Grade, + MemberNum: mysql.Num(members[0]), + MemberMax: mysql.Num(members[1]), }, PhoneInfo: phoneInfo, ThirdList: thirdList, -- 2.22.0