info($action.': '.$request); if (200 === $resultArr['code']) { Log::channel('tencent')->info($action.': '.$resultArr['msg']); } else { $statusInfo = 'error'; Log::channel('tencent')->error($action.': '.$resultArr['msg']); } if (!config('tencent.tencent_log')) { return; } // 回调会使用,此时没有用户信息 $userId = 0; $username = 'system'; if (auth('api')->user()) { $userId = auth('api')->user()->id; $username = auth('api')->user()->name; } TencentRequest::query()->create([ 'server' => $server, 'action' => $action, 'u_id' => $userId, 'request' => $request, 'username' => $username, 'msg' => $resultArr['msg'], 'status_info' => $statusInfo, 'response' => json_encode($resultArr['data']), ]); } }