Beispiel #1
0
 public function getInterfaceData($epi_curl_manager)
 {
     $response = $epi_curl_manager->getResponse();
     $temp = false;
     if ($response['code'] == 200) {
         $response_data = json_decode($response['data'], true);
         if ($response_data['rtn'] === 0) {
             $temp = isset($response_data['data']) ? $response_data['data'] : '';
             if ($response['time'] > 0.2) {
                 // 记录慢查询接口
                 Log::notice("CURL REQUEST ERROR : HTTP_CODE=" . $response['code'] . '; TOTAL_TIME=' . $response['time'] . "; EFFECTIVE_URL=" . $response['url'] . '; Data :' . $response['data']);
             }
         } else {
             // 记录接口返回错误数据
             $this->errorCode = $response_data['rtn'];
             $this->serviceErrorInfo = $response_data;
             Log::warn("CURL REQUEST ERROR : HTTP_CODE=" . $response['code'] . '; TOTAL_TIME=' . $response['time'] . "; EFFECTIVE_URL=" . $response['url'] . '; Data :' . $response['data']);
             return false;
         }
     } else {
         // 记录接口请求错误
         Log::error("CURL REQUEST ERROR : HTTP_CODE=" . $response['code'] . '; TOTAL_TIME=' . $response['time'] . "; EFFECTIVE_URL=" . $response['url'] . '; Data :' . $response['data']);
         return false;
     }
     return $temp;
 }
Beispiel #2
0
 public function execModelCreateSql($sql)
 {
     $sqls = $this->sql_split($sql);
     if (is_array($sqls)) {
         foreach ($sqls as $sql) {
             if (trim($sql) != '') {
                 if ($this->execute($sql) === false) {
                     \Lib\Log::error('sql 执行失败: ' . $sql);
                     return false;
                 }
             }
         }
     } else {
         if ($this->execute($sqls) === false) {
             \Lib\Log::error('sqls 执行失败: ' . $sqls);
             return false;
         }
     }
     return true;
 }