Commit c5d3146d authored by hujiebin's avatar hujiebin

Merge branch 'feature/family' into feature/3.5

parents 7888f2b4 909900f0
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/utils" "git.hilo.cn/hilo-common/utils"
"hilo-group/_const/enum/game_e" "hilo-group/_const/enum/game_e"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/_const/enum/group_e" "hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/online_e" "hilo-group/_const/enum/online_e"
"hilo-group/cv/billboard_cv" "hilo-group/cv/billboard_cv"
...@@ -60,6 +61,13 @@ type MemberListInfo struct { ...@@ -60,6 +61,13 @@ type MemberListInfo struct {
// AppMemberDefinedData": [ // 群成员自定义字段 【暂时不用】 // AppMemberDefinedData": [ // 群成员自定义字段 【暂时不用】
} }
type GroupPower struct {
Id uint64 `json:"groupPowerId"` // 群主所在的势力ID
Name string `json:"groupPowerName"` // 群主所在的势力的名称
Nameplate string `json:"groupPowerNameplate"` // 势力铭牌
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级
}
type GroupInfo struct { type GroupInfo struct {
GroupBasicInfo GroupBasicInfo
...@@ -69,6 +77,7 @@ type GroupInfo struct { ...@@ -69,6 +77,7 @@ type GroupInfo struct {
GroupPowerId uint64 `json:"groupPowerId"` // 群主所在的势力ID GroupPowerId uint64 `json:"groupPowerId"` // 群主所在的势力ID
GroupPowerName string `json:"groupPowerName"` // 群主所在的势力的名称 GroupPowerName string `json:"groupPowerName"` // 群主所在的势力的名称
GroupPowerNameplate string `json:"groupPowerNameplate"` // 势力铭牌 GroupPowerNameplate string `json:"groupPowerNameplate"` // 势力铭牌
GroupPower GroupPower `json:"groupPower"` // 势力信息
// "AppDefinedData": 群组维度的自定义字段 【暂时不用】 // "AppDefinedData": 群组维度的自定义字段 【暂时不用】
MemberList []MemberListInfo MemberList []MemberListInfo
...@@ -313,7 +322,7 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [ ...@@ -313,7 +322,7 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
for _, i := range groupIds { for _, i := range groupIds {
owners = append(owners, groupInfo[i].Owner) owners = append(owners, groupInfo[i].Owner)
} }
powerIds, powerNames, powerNameplates, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }
...@@ -393,6 +402,12 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [ ...@@ -393,6 +402,12 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
GroupPowerId: powerIds[g.Owner], GroupPowerId: powerIds[g.Owner],
GroupPowerName: powerNames[g.Owner], GroupPowerName: powerNames[g.Owner],
GroupPowerNameplate: powerNameplates[g.Owner], GroupPowerNameplate: powerNameplates[g.Owner],
GroupPower: GroupPower{
Id: powerIds[g.Owner],
Name: powerNames[g.Owner],
Nameplate: powerNameplates[g.Owner],
Grade: powerGrades[g.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i]), RoomUserCount: uint(roomCount[i]),
......
...@@ -234,13 +234,13 @@ func GetCvGroupPowerUsers(groupPowerId uint64) ([]mysql.ID, error) { ...@@ -234,13 +234,13 @@ func GetCvGroupPowerUsers(groupPowerId uint64) ([]mysql.ID, error) {
} }
// return userId->powerId userId->powerName userId->powerNameplate // return userId->powerId userId->powerName userId->powerNameplate
func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[uint64]string, map[uint64]string, error) { func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[uint64]string, map[uint64]string, map[uint64]groupPower_e.GroupPowerGrade, error) {
if len(userIds) <= 0 { if len(userIds) <= 0 {
return nil, nil, nil, nil return nil, nil, nil, nil, nil
} }
groupPowers, err := groupPower_m.GetGroupPowerMap(db, userIds) groupPowers, err := groupPower_m.GetGroupPowerMap(db, userIds)
if err != nil { if err != nil {
return nil, nil, nil, err return nil, nil, nil, nil, err
} }
gpIds := make([]uint64, 0) gpIds := make([]uint64, 0)
...@@ -249,15 +249,21 @@ func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[u ...@@ -249,15 +249,21 @@ func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[u
} }
powerNames, powerNameplates, err := groupPower_m.GetGroupPowerNames(db, gpIds) powerNames, powerNameplates, err := groupPower_m.GetGroupPowerNames(db, gpIds)
if err != nil { if err != nil {
return nil, nil, nil, err return nil, nil, nil, nil, err
}
groupPowerGrade, err := groupPower_m.MGetGroupPowerGrade(domain.CreateModelNil(), gpIds)
if err != nil {
return nil, nil, nil, nil, err
} }
groupPowerNames := make(map[mysql.ID]string, 0) groupPowerNames := make(map[mysql.ID]string, 0)
groupPowerNameplates := make(map[mysql.ID]string, 0) groupPowerNameplates := make(map[mysql.ID]string, 0)
groupPowerGrades := make(map[mysql.ID]groupPower_e.GroupPowerGrade, 0)
for i, g := range groupPowers { for i, g := range groupPowers {
groupPowerNames[i] = powerNames[g] groupPowerNames[i] = powerNames[g]
groupPowerNameplates[i] = powerNameplates[g] groupPowerNameplates[i] = powerNameplates[g]
groupPowerGrades[i] = groupPowerGrade[g].Grade
} }
return groupPowers, groupPowerNames, groupPowerNameplates, nil return groupPowers, groupPowerNames, groupPowerNameplates, groupPowerGrades, nil
} }
//获取国家势力的所有用户数量 //获取国家势力的所有用户数量
......
...@@ -377,7 +377,7 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -377,7 +377,7 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId) groupIds = append(groupIds, i.ImGroupId)
owners = append(owners, i.Owner) owners = append(owners, i.Owner)
} }
powerIds, powerNames, powerNameplates, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -493,6 +493,12 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -493,6 +493,12 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[i.Owner], GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[i.Owner], GroupPowerName: powerNames[i.Owner],
GroupPowerNameplate: powerNameplates[i.Owner], GroupPowerNameplate: powerNameplates[i.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[i.Owner],
Name: powerNames[i.Owner],
Nameplate: powerNameplates[i.Owner],
Grade: powerGrades[i.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i.ImGroupId]), RoomUserCount: uint(roomCount[i.ImGroupId]),
......
...@@ -133,7 +133,7 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -133,7 +133,7 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
} }
model.Log.Info("GetTheirGroups: theirRoles - ", theirRoles) model.Log.Info("GetTheirGroups: theirRoles - ", theirRoles)
powerIds, powerNames, powerNameplates, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -276,6 +276,12 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -276,6 +276,12 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[gi.Owner], GroupPowerId: powerIds[gi.Owner],
GroupPowerName: powerNames[gi.Owner], GroupPowerName: powerNames[gi.Owner],
GroupPowerNameplate: powerNameplates[gi.Owner], GroupPowerNameplate: powerNameplates[gi.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[gi.Owner],
Name: powerNames[gi.Owner],
Nameplate: powerNameplates[gi.Owner],
Grade: powerGrades[gi.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i.GroupId]), RoomUserCount: uint(roomCount[i.GroupId]),
......
...@@ -246,7 +246,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -246,7 +246,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId) groupIds = append(groupIds, i.ImGroupId)
owners = append(owners, i.Owner) owners = append(owners, i.Owner)
} }
powerIds, powerNames, powerNameplates, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -342,6 +342,12 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -342,6 +342,12 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[i.Owner], GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[i.Owner], GroupPowerName: powerNames[i.Owner],
GroupPowerNameplate: powerNameplates[i.Owner], GroupPowerNameplate: powerNameplates[i.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[i.Owner],
Name: powerNames[i.Owner],
Nameplate: powerNameplates[i.Owner],
Grade: powerGrades[i.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i.ImGroupId]), RoomUserCount: uint(roomCount[i.ImGroupId]),
...@@ -469,7 +475,7 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -469,7 +475,7 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
for _, group := range groupInfos { for _, group := range groupInfos {
owners = append(owners, group.Owner) owners = append(owners, group.Owner)
} }
powerIds, powerNames, powerNameplates, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -560,6 +566,12 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -560,6 +566,12 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[group.Owner], GroupPowerId: powerIds[group.Owner],
GroupPowerName: powerNames[group.Owner], GroupPowerName: powerNames[group.Owner],
GroupPowerNameplate: powerNameplates[group.Owner], GroupPowerNameplate: powerNameplates[group.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[group.Owner],
Name: powerNames[group.Owner],
Nameplate: powerNameplates[group.Owner],
Grade: powerGrades[group.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[group.ImGroupId]), RoomUserCount: uint(roomCount[group.ImGroupId]),
...@@ -1291,7 +1303,7 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -1291,7 +1303,7 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId) groupIds = append(groupIds, i.ImGroupId)
owners = append(owners, i.Owner) owners = append(owners, i.Owner)
} }
powerIds, powerNames, powerNameplates, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -1375,6 +1387,12 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -1375,6 +1387,12 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[i.Owner], GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[i.Owner], GroupPowerName: powerNames[i.Owner],
GroupPowerNameplate: powerNameplates[i.Owner], GroupPowerNameplate: powerNameplates[i.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[i.Owner],
Name: powerNames[i.Owner],
Nameplate: powerNameplates[i.Owner],
Grade: powerGrades[i.Owner],
},
}, },
MicUsers: []user_cv.CvUserTiny{}, MicUsers: []user_cv.CvUserTiny{},
RoomUserCount: uint(roomCount[i.ImGroupId]), RoomUserCount: uint(roomCount[i.ImGroupId]),
......
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