Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
1cfccb42
Commit
1cfccb42
authored
Jan 26, 2024
by
Bright1996
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户行为审计调整
parent
de712f7c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/service/log_management.go
src/service/log_management.go
+9
-8
No files found.
src/service/log_management.go
View file @
1cfccb42
...
@@ -246,7 +246,7 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis
...
@@ -246,7 +246,7 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis
Select
(
`u.id,
Select
(
`u.id,
u.system_account,
u.system_account,
u.phone,
u.phone,
u
.name,
org
.name,
u.organization_id,
u.organization_id,
u.last_access_time,
u.last_access_time,
case u.pwd_level when 1 then '弱' when 2 then '中' when 3 then '强' end as pwd_level,
case u.pwd_level when 1 then '弱' when 2 then '中' when 3 then '强' end as pwd_level,
...
@@ -255,9 +255,10 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis
...
@@ -255,9 +255,10 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis
u.created_time `
)
u.created_time `
)
// 条件查询
// 条件查询
modelObj
.
Where
(
"u.is_deleted = 0"
)
if
params
.
Search
!=
""
{
if
params
.
Search
!=
""
{
keyword
:=
util
.
SpecialEscape
(
params
.
Search
)
keyword
:=
util
.
SpecialEscape
(
params
.
Search
)
modelObj
.
Where
(
"
system_account like ? or phone like ? or
NAME like ?"
,
"%"
+
keyword
+
"%"
,
"%"
+
keyword
+
"%"
,
"%"
+
keyword
+
"%"
)
modelObj
.
Where
(
"
u.system_account like ? or u.phone like ? or org.
NAME like ?"
,
"%"
+
keyword
+
"%"
,
"%"
+
keyword
+
"%"
,
"%"
+
keyword
+
"%"
)
}
}
// 上次访问时间
// 上次访问时间
if
params
.
StartAt
!=
""
&&
params
.
EndAt
!=
""
{
if
params
.
StartAt
!=
""
&&
params
.
EndAt
!=
""
{
...
@@ -267,24 +268,24 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis
...
@@ -267,24 +268,24 @@ func (s *LogManagement) LogUserAccountAuditList(params *request.LogManagementLis
return
nil
,
0
,
resp
.
DbSelectError
.
ErrorDetail
(
timeErr
)
return
nil
,
0
,
resp
.
DbSelectError
.
ErrorDetail
(
timeErr
)
}
}
EndAt
:=
applyEndTime
.
AddDate
(
0
,
0
,
1
)
.
Format
(
jsontime
.
LocalDateFormat
)
EndAt
:=
applyEndTime
.
AddDate
(
0
,
0
,
1
)
.
Format
(
jsontime
.
LocalDateFormat
)
modelObj
.
Where
(
"
last_access_time >= ? and
last_access_time < ?"
,
params
.
StartAt
,
EndAt
)
modelObj
.
Where
(
"
u.last_access_time >= ? and u.
last_access_time < ?"
,
params
.
StartAt
,
EndAt
)
}
}
// 活跃度 1: 低 2:中 3: 高
// 活跃度 1: 低 2:中 3: 高
if
params
.
Active
!=
0
{
if
params
.
Active
!=
0
{
switch
params
.
Active
{
switch
params
.
Active
{
case
1
:
case
1
:
modelObj
.
Where
(
"last_access_time <= now()-interval '1 month'"
)
modelObj
.
Where
(
"
u.
last_access_time <= now()-interval '1 month'"
)
case
2
:
case
2
:
modelObj
.
Where
(
"
last_access_time < now()-interval '1 week'"
)
.
And
(
"
last_access_time > now()-interval '1 month'"
)
modelObj
.
Where
(
"
u.last_access_time < now()-interval '1 week'"
)
.
And
(
"u.
last_access_time > now()-interval '1 month'"
)
case
3
:
case
3
:
modelObj
.
Where
(
"last_access_time >= now()-interval '1 week'"
)
modelObj
.
Where
(
"
u.
last_access_time >= now()-interval '1 week'"
)
}
}
}
}
// 密码强度
// 密码强度
if
params
.
PwdLevel
!=
0
{
if
params
.
PwdLevel
!=
0
{
modelObj
.
Where
(
"pwd_level = ? "
,
params
.
PwdLevel
)
modelObj
.
Where
(
"
u.
pwd_level = ? "
,
params
.
PwdLevel
)
}
}
count
,
err
:=
modelObj
.
OrderBy
(
"last_access_time desc"
)
.
Limit
(
params
.
GetPageSize
(),
params
.
GetOffset
())
.
FindAndCount
(
&
logManagementRep
)
count
,
err
:=
modelObj
.
OrderBy
(
"
u.
last_access_time desc"
)
.
Limit
(
params
.
GetPageSize
(),
params
.
GetOffset
())
.
FindAndCount
(
&
logManagementRep
)
if
err
!=
nil
{
if
err
!=
nil
{
conf
.
Logger
.
Error
(
"查询用户账户审计列表失败"
,
zap
.
Error
(
err
))
conf
.
Logger
.
Error
(
"查询用户账户审计列表失败"
,
zap
.
Error
(
err
))
err
=
resp
.
DbSelectError
.
ErrorDetail
(
errors
.
New
(
"查询用户账户审计列表失败"
))
err
=
resp
.
DbSelectError
.
ErrorDetail
(
errors
.
New
(
"查询用户账户审计列表失败"
))
...
...
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