From cd54b1ed1e98746df3eb4537fc88e466e9ca56cb Mon Sep 17 00:00:00 2001 From: ljl Date: Wed, 25 Oct 2023 17:29:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Common/Api/GameApi.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Application/Common/Api/GameApi.class.php b/Application/Common/Api/GameApi.class.php index 2dfe4f829..82396b5a7 100644 --- a/Application/Common/Api/GameApi.class.php +++ b/Application/Common/Api/GameApi.class.php @@ -101,13 +101,20 @@ class GameApi { protected function post($param,$url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); + $this->logApi('url: ' . $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($param)); + $this->logApi('request: ' . http_build_query($param)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//要求结果为字符串且输出到屏幕上 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);//设置等待时间 $data = curl_exec($ch); + $this->logApi('response: ' . $data); curl_close($ch); return $data; } + public function logApi($message, $level = 'info') { + $destination = C('LOG_PATH'). 'game_api/' . date('y_m_d').'.log'; + \Think\Log::write($message, $level, '', $destination); + } } \ No newline at end of file