Browse Source

完善功能

gorden 8 months ago
parent
commit
e1620ce03b
2 changed files with 30 additions and 25 deletions
  1. 30 0
      app/functions.php
  2. 0 25
      support/helpers.php

+ 30 - 0
app/functions.php

@@ -33,4 +33,34 @@ if (!function_exists('month_12')){
 
         return $months;
     }
+}
+
+
+/**
+ * @Desc 管理员操作日志
+ * @Author Gorden
+ * @Date 2024/3/29 17:07
+ *
+ * adminId = 1001 充值
+ *
+ *
+ * @param $name
+ * @param $operation
+ * @return void
+ */
+
+if (!function_exists('_syslog')) {
+    function _syslog($name, $operation, $operationData = false, $requestParams = false, $adminId = false)
+    {
+        $logAdminId = $adminId ? $adminId : \Tinywan\Jwt\JwtToken::getCurrentId();
+        $model = new \app\model\SysLog();
+        $model->log_admin_id = $logAdminId;
+        $model->log_name = $name;
+        $model->log_route = \request()->uri() ?? \request()->route->getPath();
+        $model->log_operation = $operation;
+        $model->log_ip = \request()->getRealIp();
+        $model->log_request_params = $requestParams ? json_encode($requestParams) : json_encode(\request()->all());
+        $model->log_operation_data = $operationData ? json_encode($operationData) : null;
+        $model->save();
+    }
 }

+ 0 - 25
support/helpers.php

@@ -624,31 +624,6 @@ function chinese_week($week)
     return '周' . $weekArray[$week];
 }
 
-/**
- * @Desc 管理员操作日志
- * @Author Gorden
- * @Date 2024/3/29 17:07
- * 
- * adminId = 1001 充值
- *
- *
- * @param $name
- * @param $operation
- * @return void
- */
-function _syslog($name, $operation, $operationData = false, $requestParams = false, $adminId = false)
-{
-    $logAdminId = $adminId ? $adminId : \Tinywan\Jwt\JwtToken::getCurrentId();
-    $model = new \app\model\SysLog();
-    $model->log_admin_id = $logAdminId;
-    $model->log_name = $name;
-    $model->log_route = \request()->uri() ?? \request()->route->getPath();
-    $model->log_operation = $operation;
-    $model->log_ip = \request()->getRealIp();
-    $model->log_request_params = $requestParams ? json_encode($requestParams) : json_encode(\request()->all());
-    $model->log_operation_data = $operationData ? json_encode($operationData) : null;
-    $model->save();
-}
 
 
 /**