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
01de3f5e
Commit
01de3f5e
authored
Aug 31, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for循环获取 userTiny
parent
cd5586a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
user.go
domain/cache/user_c/user.go
+30
-0
group_list.go
route/group_r/group_list.go
+1
-1
No files found.
domain/cache/user_c/user.go
View file @
01de3f5e
...
@@ -38,6 +38,36 @@ func GetUserTinyById(model *domain.Model, userId mysql.ID) (*user_m.UserTiny, er
...
@@ -38,6 +38,36 @@ func GetUserTinyById(model *domain.Model, userId mysql.ID) (*user_m.UserTiny, er
return
userTiny
,
nil
return
userTiny
,
nil
}
}
// 获取用户简要信息
// param userId 用户id
func
MGetUserTinyById
(
model
*
domain
.
Model
,
userIds
[]
mysql
.
ID
)
[]
*
user_m
.
UserTiny
{
var
users
[]
*
user_m
.
UserTiny
for
_
,
userId
:=
range
userIds
{
if
user
,
_
:=
GetUserTinyById
(
model
,
userId
);
user
!=
nil
{
users
=
append
(
users
,
user
)
}
}
return
users
}
// 获取用户externalIds
// return []externalIds map[userId]extId map[userId]code
func
GetUserExternalIds
(
model
*
domain
.
Model
,
userIds
[]
mysql
.
ID
)
([]
string
,
map
[
uint64
]
string
,
map
[
uint64
]
string
)
{
var
res
[]
string
var
m
=
make
(
map
[
uint64
]
string
)
var
c
=
make
(
map
[
uint64
]
string
)
if
len
(
userIds
)
<=
0
{
return
res
,
m
,
c
}
users
:=
MGetUserTinyById
(
model
,
userIds
)
for
_
,
u
:=
range
users
{
res
=
append
(
res
,
u
.
ExternalId
)
m
[
u
.
ID
]
=
u
.
ExternalId
c
[
u
.
ID
]
=
u
.
Code
}
return
res
,
m
,
c
}
// 获取用户简要信息By ExternalId
// 获取用户简要信息By ExternalId
func
GetUserByExternalId
(
model
*
domain
.
Model
,
externalId
mysql
.
Str
)
(
*
user_m
.
UserTiny
,
error
)
{
func
GetUserByExternalId
(
model
*
domain
.
Model
,
externalId
mysql
.
Str
)
(
*
user_m
.
UserTiny
,
error
)
{
userId
,
err
:=
ToUserId
(
model
,
externalId
)
userId
,
err
:=
ToUserId
(
model
,
externalId
)
...
...
route/group_r/group_list.go
View file @
01de3f5e
...
@@ -1039,7 +1039,7 @@ func GetGroupVisitorsV2(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -1039,7 +1039,7 @@ func GetGroupVisitorsV2(c *gin.Context) (*mycontext.MyContext, error) {
beginPos
:=
pageSize
*
(
pageIndex
-
1
)
beginPos
:=
pageSize
*
(
pageIndex
-
1
)
if
uint
(
beginPos
)
<
result
.
Total
{
if
uint
(
beginPos
)
<
result
.
Total
{
// 取在线状态
// 取在线状态
extIds
,
userExtIdMap
,
userCodeMap
:=
user_
m
.
GetUserExternalIds
(
model
,
userIds
)
extIds
,
userExtIdMap
,
userCodeMap
:=
user_
c
.
GetUserExternalIds
(
model
,
userIds
)
statusMap
,
err
:=
tim_m
.
GetOnlineStatus
(
model
,
extIds
)
statusMap
,
err
:=
tim_m
.
GetOnlineStatus
(
model
,
extIds
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
...
...
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