Commit f7058748 authored by zhangdongying's avatar zhangdongying

feat: 代码优化

parent bb946e8e
...@@ -115,19 +115,18 @@ class AppOperateLogService ...@@ -115,19 +115,18 @@ class AppOperateLogService
string $remark = '' string $remark = ''
): bool ): bool
{ {
return $this->operateLogService->addOperateLog( return $this->addOperateLog(
make(RequestInterface::class)->header('hwq-request-id', ''), make(RequestInterface::class)->header('hwq-request-id', ''),
$this->config->get('app_name'),
Auth::id() ?? 0, Auth::id() ?? 0,
Auth::user()['name'] ?? '', Auth::user()['name'] ?? '',
$this->getClientIp(), $this->getClientIp(),
make(RequestInterface::class)->url(), make(RequestInterface::class)->url(),
$tableName, $tableName,
(string)$recordId, $recordId,
$operateType, $operateType,
$this->formatSourceData($param), $param,
$this->formatSourceData($before), $before,
$this->formatSourceData($after), $after,
$remark $remark
); );
} }
...@@ -157,14 +156,63 @@ class AppOperateLogService ...@@ -157,14 +156,63 @@ class AppOperateLogService
string $remark = '' string $remark = ''
): bool ): bool
{ {
return $this->operateLogService->addOperateLog( return $this->addOperateLog(
'', '',
$this->config->get('app_name'),
0, 0,
'system', 'system',
'', '',
$action, $action,
$tableName, $tableName,
$recordId,
$operateType,
$param,
$before,
$after,
$remark
);
}
/**
* 添加系统操作日志
*
* @param string $requestId 请求ID
* @param string|int $operatorId 操作人ID
* @param string $operatorName 操作人名称
* @param string $clientIp 请求IP
* @param string $url 请求URL或者请求方法
* @param string $tableName 表名
* @param string|int $recordId 记录ID
* @param string $operateType 操作类型,例如:物流运单推送物流服务商
* @param string|array|Model $param 参数
* @param string|array|Model $before 修改之前数据
* @param string|array|Model $after 修改之后数据
* @param string $remark 备注
* @return bool
* @throws \Exception
*/
public function addOperateLog(
string $requestId,
$operatorId,
string $operatorName,
string $clientIp,
string $url,
string $tableName,
$recordId,
string $operateType,
$param,
$before,
$after,
string $remark
): bool
{
return $this->operateLogService->addOperateLog(
$requestId,
$this->config->get('app_name'),
(int)$operatorId,
$operatorName,
$clientIp,
$url,
$tableName,
(string)$recordId, (string)$recordId,
$operateType, $operateType,
$this->formatSourceData($param), $this->formatSourceData($param),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment