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
9abe6c52
Commit
9abe6c52
authored
Aug 31, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GetGroupVisitorsV2:用批量看看
parent
82b87ac2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
user.go
domain/model/user_m/user.go
+17
-2
group_list.go
route/group_r/group_list.go
+1
-1
No files found.
domain/model/user_m/user.go
View file @
9abe6c52
...
...
@@ -155,9 +155,24 @@ func GetUserExternalIds(model *domain.Model, userIds []mysql.ID) ([]string, map[
return
res
,
m
,
c
}
var
users
[]
User
if
err
:=
model
.
DB
()
.
Model
(
User
{})
.
Where
(
"id in (?)"
,
userIds
)
.
Select
(
"id,external_id"
)
.
Find
(
&
users
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetUserExternalIds fail:%v"
,
err
)
total
:=
len
(
userIds
)
const
NUM
=
500
start
,
end
:=
0
,
NUM
for
start
<
total
{
if
end
>
total
{
end
=
total
}
var
tmp
[]
User
tmpUserId
:=
userIds
[
start
:
end
]
if
err
:=
model
.
DB
()
.
Model
(
User
{})
.
Where
(
"id in (?)"
,
tmpUserId
)
.
Select
(
"id,external_id,code"
)
.
Find
(
&
tmp
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetUserExternalIds fail:%v"
,
err
)
}
else
if
len
(
tmp
)
>
0
{
users
=
append
(
users
,
tmp
...
)
}
start
+=
NUM
end
+=
NUM
}
for
_
,
user
:=
range
users
{
res
=
append
(
res
,
user
.
ExternalId
)
m
[
user
.
ID
]
=
user
.
ExternalId
...
...
route/group_r/group_list.go
View file @
9abe6c52
...
...
@@ -1039,7 +1039,7 @@ func GetGroupVisitorsV2(c *gin.Context) (*mycontext.MyContext, error) {
beginPos
:=
pageSize
*
(
pageIndex
-
1
)
if
uint
(
beginPos
)
<
result
.
Total
{
// 取在线状态
extIds
,
userExtIdMap
,
userCodeMap
:=
user_
c
.
GetUserExternalIds
(
model
,
userIds
)
extIds
,
userExtIdMap
,
userCodeMap
:=
user_
m
.
GetUserExternalIds
(
model
,
userIds
)
statusMap
,
err
:=
tim_m
.
GetOnlineStatus
(
model
,
extIds
)
if
err
!=
nil
{
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