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
96cb5dc3
Commit
96cb5dc3
authored
Mar 14, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/family' into feature/3.5
parents
09d28573
e678d573
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
13 deletions
+49
-13
group.go
cv/group_cv/group.go
+4
-4
user.go
cv/user_cv/user.go
+45
-9
No files found.
cv/group_cv/group.go
View file @
96cb5dc3
...
...
@@ -62,9 +62,9 @@ type MemberListInfo struct {
}
type
GroupPower
struct
{
Id
uint64
`json:"
groupPowerI
d"`
// 群主所在的势力ID
Name
string
`json:"
groupPowerN
ame"`
// 群主所在的势力的名称
Nameplate
string
`json:"
groupPowerN
ameplate"`
// 势力铭牌
Id
uint64
`json:"
i
d"`
// 群主所在的势力ID
Name
string
`json:"
n
ame"`
// 群主所在的势力的名称
Nameplate
string
`json:"
n
ameplate"`
// 势力铭牌
Grade
groupPower_e
.
GroupPowerGrade
`json:"grade"`
// 等级
}
...
...
cv/user_cv/user.go
View file @
96cb5dc3
...
...
@@ -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,6 +836,12 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID,
CurrentRoom
:
room
,
MyGroupPower
:
power
,
MyGroupPowerName
:
powerName
,
GroupPower
:
GroupPower
{
Id
:
power
,
Name
:
powerName
,
Nameplate
:
powerNameplate
,
Grade
:
grade
.
Grade
,
},
PhoneInfo
:
phoneInfo
,
ThirdList
:
thirdList
,
CountryManager
:
countryManager
,
...
...
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