Commit 6f1f34e18052d20bd0f90d631f3456cdc22277dd
1 parent
8455ee89
Exists in
master
1. 校验接口请求调整。
Showing
1 changed file
with
6 additions
and
13 deletions
Show diff stats
common/helpers/CheckActiveHelper.php
... | ... | @@ -48,15 +48,9 @@ class CheckActiveHelper |
48 | 48 | 'fileName' => $fileName, |
49 | 49 | 'token' => $token |
50 | 50 | ); |
51 | - if (class_exists('\CURLFile')) { | |
52 | - curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true); | |
53 | - $post_data['img'] = new \CURLFile(realpath($saveFilePath), '', $fileName);//>=5.5 | |
54 | - } else { | |
55 | - if (defined('CURLOPT_SAFE_UPLOAD')) { | |
56 | - curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false); | |
57 | - } | |
58 | - $post_data['img'] = '@' . realpath($saveFilePath);//<=5.5 | |
59 | - } | |
51 | + $file = realpath($saveFilePath); | |
52 | + $post_data['img'] = file_get_contents($file); | |
53 | + Log::DEBUG("请求checkAppQrv参数:" . json_encode($post_data)); | |
60 | 54 | curl_setopt($curl, CURLOPT_HEADER, 0); |
61 | 55 | // 如果是https协议 |
62 | 56 | if (stripos(self::CHECK_URL, "https://") !== FALSE) { |
... | ... | @@ -68,10 +62,9 @@ class CheckActiveHelper |
68 | 62 | // 通过POST方式提交 |
69 | 63 | curl_setopt($curl, CURLOPT_POST, true); |
70 | 64 | curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); |
71 | - | |
72 | 65 | // 超时时间 |
73 | - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 180); | |
74 | - curl_setopt($curl, CURLOPT_TIMEOUT, 180); | |
66 | + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30); | |
67 | + curl_setopt($curl, CURLOPT_TIMEOUT, 30); | |
75 | 68 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
76 | 69 | // 返回内容 |
77 | 70 | $callbcak = curl_exec($curl); |
... | ... | @@ -82,7 +75,7 @@ class CheckActiveHelper |
82 | 75 | return ""; |
83 | 76 | // 关闭,释放资源 |
84 | 77 | curl_close($curl); |
85 | - @unlink($saveFilePath); | |
78 | + //@unlink($saveFilePath); | |
86 | 79 | //返回内容JSON_DECODE |
87 | 80 | return json_decode($callbcak, true); |
88 | 81 | } catch (Exception $e) { | ... | ... |