(string)$output]); } return $output; } catch (\Exception $e) { \support\Log::info('模拟请求失败:', ['msg' => $e->getMessage()]); } } } if (!function_exists('month_12')) { function month_12() { $months = []; for ($i = 0; $i < 12; $i++) { $months[$i] = date('Y/m', strtotime(date('Y-m-01') . "-" . $i . "month")); } 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) { try { $adminId = $adminId ? $adminId : \Tinywan\Jwt\JwtToken::getCurrentId(); } catch (\Exception $e) { $adminId = 1001; } $logAdminId = $adminId; $model = new \app\model\SysLog(); $model->log_admin_id = $logAdminId; $model->log_name = $name; $model->log_route = \request() && \request()->uri() ? \request()->uri() : (\request() && \request()->route && \request()->route->getPath() ? \request()->route->getPath() : ''); $model->log_operation = $operation; $model->log_ip = \request() && \request()->getRealIp() ? \request()->getRealIp() : '0.0.0.0'; $model->log_request_params = $requestParams ? json_encode($requestParams) : ($adminId == 1001 ? '[]' : json_encode(\request()->all())); $model->log_operation_data = $operationData ? json_encode($operationData) : null; $model->save(); } } if (!function_exists('json_throw')) { function json_throw($code, $message, $data = '', $options = JSON_UNESCAPED_UNICODE) { $return = [ 'code' => $code, 'message' => $message, 'data' => $data, ]; return new \support\Response(200, ['Content-Type' => 'application/json'], json_encode($return, $options)); } }