Browse Source

api接口日志

lizhen_gitee 7 months ago
parent
commit
2679f65788

+ 2 - 2
application/api/library/ExceptionHandle.php

@@ -32,9 +32,9 @@ class ExceptionHandle extends Handle
         $result = ['code' => $code, 'msg' => $msg, 'time' => time(), 'data' => null];
 
         //记录app异常返回结果
-        /*if(defined('API_REQUEST_ID')) { //记录app正常返回结果
+        if(defined('API_REQUEST_ID')) { //记录app正常返回结果
             db('api_request_log')->where('id',API_REQUEST_ID)->update(['result'=>json_encode($result)]);
-        }*/
+        }
 
         return json($result, $statuscode);
     }

+ 2 - 2
application/common/controller/Api.php

@@ -79,7 +79,7 @@ class Api
         // 控制器初始化
         $this->_initialize();
         //日志
-        //$this->request_log();
+        $this->request_log();
         //用户活跃
         $this->user_active();
 
@@ -234,7 +234,7 @@ class Api
         ];
 
         //日志
-        //$this->request_log_update($result);
+        $this->request_log_update($result);
 
         // 如果未设置类型则自动判断
         $type = $type ? $type : ($this->request->param(config('var_jsonp_handler')) ? 'jsonp' : $this->responseType);