Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-common
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
without authentication
meibuyu-common
Commits
8d52771f
Commit
8d52771f
authored
Mar 01, 2023
by
zhangdongying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 代码优化
parent
eca564a1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
AppOperateLogService.php
src/GlobalLog/AppOperateLogService.php
+29
-18
No files found.
src/GlobalLog/AppOperateLogService.php
View file @
8d52771f
...
...
@@ -39,6 +39,17 @@ class AppOperateLogService
$this
->
operateLogService
=
$container
->
get
(
OperateLogService
::
class
);
}
/**
* 将数组转换成JSON
*
* @param array $array 数组
* @return string
*/
public
static
function
encodeArrayToJson
(
array
$array
)
:
string
{
return
json_encode
(
$array
,
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
}
/**
* 获取客户端IP
*
...
...
@@ -69,9 +80,9 @@ class AppOperateLogService
* @param string $tableName 表名
* @param string $recordId 记录ID
* @param string $operateType 操作类型
* @param string $param 参数
* @param string $before 修改之前数据
* @param string $after 修改之后数据
* @param string
|array
$param 参数
* @param string
|array
$before 修改之前数据
* @param string
|array
$after 修改之后数据
* @param string $remark 备注
* @return bool
* @throws \Exception
...
...
@@ -80,9 +91,9 @@ class AppOperateLogService
string
$tableName
,
string
$recordId
,
string
$operateType
,
string
$param
,
string
$before
,
string
$after
,
$param
,
$before
,
$after
,
string
$remark
=
''
)
:
bool
{
...
...
@@ -96,9 +107,9 @@ class AppOperateLogService
$tableName
,
$recordId
,
$operateType
,
$param
,
$before
,
$after
,
is_array
(
$param
)
?
self
::
encodeArrayToJson
(
$param
)
:
(
string
)
$param
,
is_array
(
$before
)
?
self
::
encodeArrayToJson
(
$before
)
:
(
string
)
$before
,
is_array
(
$after
)
?
self
::
encodeArrayToJson
(
$after
)
:
(
string
)
$after
,
$remark
);
}
...
...
@@ -110,9 +121,9 @@ class AppOperateLogService
* @param string $tableName 表名
* @param string $recordId 记录ID
* @param string $operateType 操作类型
* @param string $param 参数
* @param string $before 修改之前数据
* @param string $after 修改之后数据
* @param string
|array
$param 参数
* @param string
|array
$before 修改之前数据
* @param string
|array
$after 修改之后数据
* @param string $remark 备注
* @return bool
* @throws \Exception
...
...
@@ -122,9 +133,9 @@ class AppOperateLogService
string
$tableName
,
string
$recordId
,
string
$operateType
,
string
$param
,
string
$before
,
string
$after
,
$param
,
$before
,
$after
,
string
$remark
=
''
)
:
bool
{
...
...
@@ -138,9 +149,9 @@ class AppOperateLogService
$tableName
,
$recordId
,
$operateType
,
$param
,
$before
,
$after
,
is_array
(
$param
)
?
self
::
encodeArrayToJson
(
$param
)
:
(
string
)
$param
,
is_array
(
$before
)
?
self
::
encodeArrayToJson
(
$before
)
:
(
string
)
$before
,
is_array
(
$after
)
?
self
::
encodeArrayToJson
(
$after
)
:
(
string
)
$after
,
$remark
);
}
...
...
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