Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-group
Commits
1a803f49
Commit
1a803f49
authored
Jul 28, 2023
by
chenweijian
Committed by
hujiebin
Jul 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.0.5 接口优化
parent
d2e3fc55
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
33 deletions
+165
-33
billboard.go
cv/billboard_cv/billboard.go
+27
-3
group.go
cv/group_cv/group.go
+29
-22
user.go
cv/user_cv/user.go
+94
-0
group_info.go
route/group_r/group_info.go
+2
-1
group_list.go
route/group_r/group_list.go
+7
-7
group_op.go
route/group_r/group_op.go
+6
-0
No files found.
cv/billboard_cv/billboard.go
View file @
1a803f49
...
...
@@ -22,7 +22,15 @@ type BillboardUserInfo struct {
Num
uint64
`json:"num"`
}
func
GetGroupTop3Consume
(
model
*
domain
.
Model
,
groupId
string
,
myUserId
uint64
)
([]
BillboardUserInfo
,
error
)
{
//榜单中用户信息
type
GroupTop3ConsumeUser
struct
{
//用户基本信息
UserBase
user_cv
.
TopConsumersUser
`json:"userBase"`
//数值
Num
uint64
`json:"num"`
}
func
GetGroupTop3Consume
(
model
*
domain
.
Model
,
groupId
string
,
myUserId
uint64
)
([]
GroupTop3ConsumeUser
,
error
)
{
now
:=
time
.
Now
()
period
:=
now
.
Format
(
utils
.
COMPACT_MONTH_FORMAT
)
data
,
err
:=
getGroupTop3Consume
(
period
,
groupId
)
...
...
@@ -59,7 +67,15 @@ func GetGroupTop3Consume(model *domain.Model, groupId string, myUserId uint64) (
ret
,
err
:=
saveGroupTop3Consume
(
period
,
groupId
,
diamonds
)
model
.
Log
.
Infof
(
"GetGroupTop3Consume SAVE ret = %d, err: %v"
,
ret
,
err
)
return
result
,
nil
list
:=
make
([]
GroupTop3ConsumeUser
,
0
,
len
(
result
))
for
_
,
v
:=
range
result
{
list
=
append
(
list
,
GroupTop3ConsumeUser
{
UserBase
:
user_cv
.
TopConsumersUser
{
Id
:
v
.
UserBase
.
Id
,
Avatar
:
v
.
UserBase
.
Avatar
,
ExternalId
:
v
.
UserBase
.
ExternalId
,
Nick
:
v
.
UserBase
.
Nick
},
})
}
return
list
,
nil
}
userIds
:=
make
([]
uint64
,
0
)
...
...
@@ -86,7 +102,15 @@ func GetGroupTop3Consume(model *domain.Model, groupId string, myUserId uint64) (
})
}
}
return
result
,
nil
list
:=
make
([]
GroupTop3ConsumeUser
,
0
,
len
(
result
))
for
_
,
v
:=
range
result
{
list
=
append
(
list
,
GroupTop3ConsumeUser
{
UserBase
:
user_cv
.
TopConsumersUser
{
Id
:
v
.
UserBase
.
Id
,
Avatar
:
v
.
UserBase
.
Avatar
,
ExternalId
:
v
.
UserBase
.
ExternalId
,
Nick
:
v
.
UserBase
.
Nick
},
})
}
return
list
,
nil
}
func
getGroupTop3Consume
(
period
string
,
groupId
string
)
(
map
[
string
]
string
,
error
)
{
...
...
cv/group_cv/group.go
View file @
1a803f49
...
...
@@ -123,6 +123,13 @@ type MemberDetail struct {
InRoom
bool
`json:"inRoom"`
// 是否在房间内
}
type
GroupVisitorsDetail
struct
{
user_cv
.
CvGroupMember
Role
group_e
.
GroupRoleType
`json:"role"`
OnlineStatus
online_e
.
OnlineStatusType
`json:"onlineStatus"`
// IM在线状态
InRoom
bool
`json:"inRoom"`
// 是否在房间内
}
type
GroupDetail
struct
{
GroupBasicInfo
...
...
@@ -133,14 +140,14 @@ type GroupDetail struct {
ThemeId
uint64
`json:"themeId"`
ThemeUrl
string
`json:"themeUrl"`
// 1:官方 2:自定义
ThemeType
uint8
`json:"themeType"`
Role
group_e
.
GroupRoleType
`json:"role"`
MsgStatus
uint8
`json:"msgStatus"`
// 消息提醒状态
WelcomeText
string
`json:"welcomeText"`
// 新成员入群欢迎语
TotalConsume
uint64
`json:"totalConsume"`
// 群内消费总额
TopConsumers
[]
billboard_cv
.
BillboardUserInfo
`json:"topConsumers"`
// 月最高消费三甲
DiceNum
uint16
`json:"diceNum"`
// 骰子游戏的数量
DiceType
uint16
`json:"diceType"`
// 骰子游戏的数字点数
ThemeType
uint8
`json:"themeType"`
Role
group_e
.
GroupRoleType
`json:"role"`
MsgStatus
uint8
`json:"msgStatus"`
// 消息提醒状态
WelcomeText
string
`json:"welcomeText"`
// 新成员入群欢迎语
TotalConsume
uint64
`json:"totalConsume"`
// 群内消费总额
TopConsumers
[]
billboard_cv
.
GroupTop3ConsumeUser
`json:"topConsumers"`
// 月最高消费三甲
DiceNum
uint16
`json:"diceNum"`
// 骰子游戏的数量
DiceType
uint16
`json:"diceType"`
// 骰子游戏的数字点数
// "AppDefinedData": 群组维度的自定义字段 【暂时不用】
RoleMembers
[]
RoleMemberInfo
`json:"role_members"`
Owner
*
user_cv
.
CvUserDetail
`json:"owner"`
// 群主信息
...
...
@@ -166,20 +173,20 @@ type RoomInfo struct {
ThemeId
uint64
`json:"themeId"`
ThemeUrl
string
`json:"themeUrl"`
// 1:官方 2:自定义
ThemeType
uint8
`json:"themeType"`
Role
group_e
.
GroupRoleType
`json:"role"`
DiceNum
uint16
`json:"diceNum"`
// 骰子游戏的数量
DiceType
uint16
`json:"diceType"`
// 骰子游戏类型
RoleMembers
[]
SimpleRoleInfo
`json:"roleMembers"`
WelcomeText
string
`json:"welcomeText"`
// 新成员入群欢迎语
Banners
[]
BannerElement
`json:"banners"`
LuckyWheel
LuckyWheelState
`json:"luckyWheel"`
TotalConsume
uint64
`json:"totalConsume"`
GameConfig
*
game_m
.
GameConfig
`json:"gameConfig"`
Owner
*
user_cv
.
CvUserDetail
`json:"owner"`
EntryEffectType
int
`json:"entryEffectType"`
// 进场特效类型 1: CP 2:神秘人 3:贵族 4:vip
CpUserAvatar
string
`json:"cpUserAvatar"`
// cp对象头像
CpLevel
int
`json:"cpLevel"`
// cp等级
ThemeType
uint8
`json:"themeType"`
Role
group_e
.
GroupRoleType
`json:"role"`
DiceNum
uint16
`json:"diceNum"`
// 骰子游戏的数量
DiceType
uint16
`json:"diceType"`
// 骰子游戏类型
RoleMembers
[]
SimpleRoleInfo
`json:"roleMembers"`
WelcomeText
string
`json:"welcomeText"`
// 新成员入群欢迎语
Banners
[]
BannerElement
`json:"banners"`
LuckyWheel
LuckyWheelState
`json:"luckyWheel"`
TotalConsume
uint64
`json:"totalConsume"`
GameConfig
*
game_m
.
GameConfig
`json:"gameConfig"`
Owner
*
user_cv
.
RoomInfoOwner
`json:"owner"`
EntryEffectType
int
`json:"entryEffectType"`
// 进场特效类型 1: CP 2:神秘人 3:贵族 4:vip
CpUserAvatar
string
`json:"cpUserAvatar"`
// cp对象头像
CpLevel
int
`json:"cpLevel"`
// cp等级
}
type
SupportPageDetail
struct
{
...
...
cv/user_cv/user.go
View file @
1a803f49
package
user_cv
import
(
"encoding/json"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/mysql"
...
...
@@ -69,6 +70,25 @@ type CvUserDetail struct {
CountryManager
*
country_cv
.
CVCountryManager
`json:"countryManager,omitempty"`
// 国家管理员
}
type
RoomInfoOwner
struct
{
//头像,不存在为nil
Avatar
*
string
`json:"avatar"`
//用户对外ID
ExternalId
*
string
`json:"externalId"`
//昵称,不存在为nil
Nick
*
string
`json:"nick"`
IsPrettyCode
bool
`json:"isPrettyCode"`
// 是否靓号
//是否VIP用户
IsVip
bool
`json:"isVip"`
Svip
rpc
.
CvSvip
`json:"svip"`
// svip结构,等级+权限
Medals
[]
uint32
`json:"medals"`
// 勋章列表
Noble
noble_cv
.
CvNoble
`json:"noble"`
// 当前的
WealthUserGrade
uint32
`json:"wealthUserGrade"`
//财富等级
CharmUserGrade
uint32
`json:"charmUserGrade"`
//魅力等级
MyGroupPowerName
string
`json:"myGroupPowerName"`
// 当前用户所在势力绑定群组的名称
GroupPower
GroupPower
`json:"groupPower"`
// 当前用户势力信息
}
type
GroupPower
struct
{
Id
uint64
`json:"id"`
// 群主所在的势力ID
Icon
string
`json:"icon"`
// 家族头像
...
...
@@ -150,6 +170,45 @@ type CvUserExtend struct {
ActiveGrade
uint32
`json:"activityUserGrade"`
}
type
CvGroupMember
struct
{
//不会有返回值
Id
*
mysql
.
ID
`json:"id,omitempty"`
//是否默认头像 true:是 false:不是
DefaultAvatar
*
bool
`json:"defaultAvatar"`
//头像,不存在为nil
Avatar
*
string
`json:"avatar"`
//用户对外ID
ExternalId
*
string
`json:"externalId"`
//昵称,不存在为nil
Nick
*
string
`json:"nick"`
//签名,不存在为nil
Description
*
string
`json:"description"`
Birthday
*
uint64
`json:"birthday"`
//邀请码
Code
*
string
`json:"code"`
//国家,不存在为nil
Country
*
string
`json:"country"`
//国旗图标,不存在为nil
CountryIcon
*
string
`json:"countryIcon"`
Sex
*
uint8
`json:"sex"`
//是否代理管理员, 只有自己查自己的时候才有值,其他情况为nil
IsAgentMgr
*
bool
`json:"isAgentMgr"`
//是否展示年龄, 是本人才有数据,看其他用户均为nil
IsShowAge
*
uint8
`json:"isShowAge"`
//是否工会成员, 只有是自己查自己,这个才有值,其它全为nil, 20220329 数据开放:原因:产品1对1视频聊天中,公会用户视频需要送礼物。改为: 全部人可以知道是否是公会用户。
IsTradeUnion
*
bool
`json:"isTradeUnion"`
//工会成员,是否开启了,匹配通知,只有 isTradeUnion值为true,这里才有值,
IsTradeUnionMatchNotification
*
bool
`json:"isTradeUnionMatchNotification"`
//是否VIP用户
IsVip
bool
`json:"isVip"`
Ride
property_cv
.
CvProperty
`json:"ride"`
// 当前使用的座驾
Noble
noble_cv
.
CvNoble
`json:"noble"`
// 当前的
Svip
rpc
.
CvSvip
`json:"svip"`
// svip结构,等级+权限
WealthGrade
uint32
`json:"wealthUserGrade"`
CharmGrade
uint32
`json:"charmUserGrade"`
ActiveGrade
uint32
`json:"activityUserGrade"`
}
// 批量获取用户tiny信息
func
GetUserTinyMap
(
userIds
[]
mysql
.
ID
)
(
map
[
mysql
.
ID
]
CvUserTiny
,
error
)
{
userTinys
,
_
,
err
:=
GetUserTinys
(
userIds
)
...
...
@@ -1288,3 +1347,38 @@ func getMedalInfo(db *gorm.DB, medals []uint32) ([]uint32, []medal_cv.CvMedal, e
}
return
validMedals
,
medalInfo
,
nil
}
func
UserDetailToRoomInfoOwner
(
user
*
CvUserDetail
)
*
RoomInfoOwner
{
return
&
RoomInfoOwner
{
Avatar
:
user
.
Avatar
,
ExternalId
:
user
.
ExternalId
,
Nick
:
user
.
Nick
,
IsPrettyCode
:
user
.
IsPrettyCode
,
IsVip
:
user
.
IsVip
,
Svip
:
user
.
Svip
,
Medals
:
user
.
Medals
,
Noble
:
user
.
Noble
,
WealthUserGrade
:
user
.
WealthUserGrade
,
CharmUserGrade
:
user
.
CharmUserGrade
,
MyGroupPowerName
:
user
.
MyGroupPowerName
,
GroupPower
:
user
.
GroupPower
,
}
}
type
TopConsumersUser
struct
{
//不会有返回值
Id
*
mysql
.
ID
`json:"id,omitempty"`
//头像,不存在为nil
Avatar
*
string
`json:"avatar"`
//用户对外ID
ExternalId
*
string
`json:"externalId"`
//昵称,不存在为nil
Nick
*
string
`json:"nick"`
}
func
CvUserExtendToCvGroupMember
(
detail
CvUserExtend
)
CvGroupMember
{
jData
,
_
:=
json
.
Marshal
(
detail
)
res
:=
CvGroupMember
{}
_
=
json
.
Unmarshal
(
jData
,
&
res
)
return
res
}
route/group_r/group_info.go
View file @
1a803f49
...
...
@@ -604,7 +604,8 @@ func GetRoomInfo(c *gin.Context) (*mycontext.MyContext, error) {
model
.
Log
.
Infof
(
"GetRoomInfo: GetLuckWheelState: %s"
,
err
.
Error
())
}
// 群主的详情
result
.
Owner
,
err
=
user_cv
.
GetUserDetail
(
model
,
groupInfo
.
Owner
,
userId
)
owner
,
err
:=
user_cv
.
GetUserDetail
(
model
,
groupInfo
.
Owner
,
userId
)
result
.
Owner
=
user_cv
.
UserDetailToRoomInfoOwner
(
owner
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetRoomInfo: GetUserBase: %s"
,
err
.
Error
())
}
...
...
route/group_r/group_list.go
View file @
1a803f49
...
...
@@ -796,7 +796,7 @@ func GetMyGroup(c *gin.Context) (*mycontext.MyContext, error) {
// @Param groupId path string true "群ID"
// @Param pageSize query int false "分页大小 默认:10" default(10)
// @Param pageIndex query int false "第几个分页,从1开始 默认:1" default(1)
// @Success 200 {object} G
roupMembe
rsRsp
// @Success 200 {object} G
etGroupVisito
rsRsp
// @Router /v1/imGroup/visitors/{groupId} [get]
func
GetGroupVisitors
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
...
...
@@ -847,7 +847,7 @@ func GetGroupVisitors(c *gin.Context) (*mycontext.MyContext, error) {
}
model
.
Log
.
Infof
(
"GetGroupVisitors %s: memberNum = %d, user size = %d"
,
groupId
,
len
(
rows
),
len
(
userIds
))
result
:=
G
roupMembe
rsRsp
{
Total
:
uint
(
len
(
userIds
))}
result
:=
G
etGroupVisito
rsRsp
{
Total
:
uint
(
len
(
userIds
))}
beginPos
:=
pageSize
*
(
pageIndex
-
1
)
if
uint
(
beginPos
)
<
result
.
Total
{
...
...
@@ -961,11 +961,11 @@ func GetGroupVisitors(c *gin.Context) (*mycontext.MyContext, error) {
if
_
,
ok
:=
roomUserMap
[
u
];
ok
{
inRoom
=
true
}
result
.
Members
=
append
(
result
.
Members
,
group_cv
.
Member
Detail
{
Cv
UserExtend
:
userExtends
[
u
]
,
Role
:
roles
[
u
],
OnlineStatus
:
statusMap
[
users
[
u
]
.
ExternalId
],
InRoom
:
inRoom
,
result
.
Members
=
append
(
result
.
Members
,
group_cv
.
GroupVisitors
Detail
{
Cv
GroupMember
:
user_cv
.
CvUserExtendToCvGroupMember
(
userExtends
[
u
])
,
Role
:
roles
[
u
],
OnlineStatus
:
statusMap
[
users
[
u
]
.
ExternalId
],
InRoom
:
inRoom
,
})
}
}
...
...
route/group_r/group_op.go
View file @
1a803f49
...
...
@@ -1238,6 +1238,12 @@ type GroupMembersRsp struct {
Total
uint
`json:"total"`
}
type
GetGroupVisitorsRsp
struct
{
Members
[]
group_cv
.
GroupVisitorsDetail
`json:"members"`
Online
uint
`json:"online"`
// 在线人数
Total
uint
`json:"total"`
}
// @Tags 群组
// @Summary 获取永久成员列表
// @Accept application/x-www-form-urlencoded
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment