Commit c5d3146d authored by hujiebin's avatar hujiebin

Merge branch 'feature/family' into feature/3.5

parents 7888f2b4 909900f0
......@@ -4,6 +4,7 @@ import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/utils"
"hilo-group/_const/enum/game_e"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/online_e"
"hilo-group/cv/billboard_cv"
......@@ -60,15 +61,23 @@ type MemberListInfo struct {
// 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 {
GroupBasicInfo
// hilo业务
EntryLevel uint32 `json:"entryLevel"` // obsolete
HasOnMic bool `json:"hasOnMic"` // 房间麦上是否有人
GroupPowerId uint64 `json:"groupPowerId"` // 群主所在的势力ID
GroupPowerName string `json:"groupPowerName"` // 群主所在的势力的名称
GroupPowerNameplate string `json:"groupPowerNameplate"` // 势力铭牌
EntryLevel uint32 `json:"entryLevel"` // obsolete
HasOnMic bool `json:"hasOnMic"` // 房间麦上是否有人
GroupPowerId uint64 `json:"groupPowerId"` // 群主所在的势力ID
GroupPowerName string `json:"groupPowerName"` // 群主所在的势力的名称
GroupPowerNameplate string `json:"groupPowerNameplate"` // 势力铭牌
GroupPower GroupPower `json:"groupPower"` // 势力信息
// "AppDefinedData": 群组维度的自定义字段 【暂时不用】
MemberList []MemberListInfo
......@@ -313,7 +322,7 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
for _, i := range groupIds {
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 {
return nil, 0, err
}
......@@ -393,6 +402,12 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
GroupPowerId: powerIds[g.Owner],
GroupPowerName: powerNames[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,
RoomUserCount: uint(roomCount[i]),
......
......@@ -234,13 +234,13 @@ func GetCvGroupPowerUsers(groupPowerId uint64) ([]mysql.ID, error) {
}
// 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 {
return nil, nil, nil, nil
return nil, nil, nil, nil, nil
}
groupPowers, err := groupPower_m.GetGroupPowerMap(db, userIds)
if err != nil {
return nil, nil, nil, err
return nil, nil, nil, nil, err
}
gpIds := make([]uint64, 0)
......@@ -249,15 +249,21 @@ func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[u
}
powerNames, powerNameplates, err := groupPower_m.GetGroupPowerNames(db, gpIds)
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)
groupPowerNameplates := make(map[mysql.ID]string, 0)
groupPowerGrades := make(map[mysql.ID]groupPower_e.GroupPowerGrade, 0)
for i, g := range groupPowers {
groupPowerNames[i] = powerNames[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) {
groupIds = append(groupIds, i.ImGroupId)
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 {
return myContext, err
}
......@@ -493,6 +493,12 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[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,
RoomUserCount: uint(roomCount[i.ImGroupId]),
......
......@@ -133,7 +133,7 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
}
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 {
return myContext, err
}
......@@ -276,6 +276,12 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[gi.Owner],
GroupPowerName: powerNames[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,
RoomUserCount: uint(roomCount[i.GroupId]),
......
......@@ -246,7 +246,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId)
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 {
return myContext, err
}
......@@ -342,6 +342,12 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[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,
RoomUserCount: uint(roomCount[i.ImGroupId]),
......@@ -469,7 +475,7 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
for _, group := range groupInfos {
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 {
return myContext, err
}
......@@ -560,6 +566,12 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[group.Owner],
GroupPowerName: powerNames[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,
RoomUserCount: uint(roomCount[group.ImGroupId]),
......@@ -1291,7 +1303,7 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId)
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 {
return myContext, err
}
......@@ -1375,6 +1387,12 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[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{},
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