duqinya лет назад: 6
Родитель
Сommit
da0b388125
1 измененных файлов с 18 добавлено и 0 удалено
  1. 18 0
      app/Helper/helper.php

+ 18 - 0
app/Helper/helper.php

@@ -46,3 +46,21 @@ function verifySign($sign, $params, $secret_key)
 
 }
 
+
+function http($url, $param, $method = 'post')
+{
+    try {
+        $client = new \GuzzleHttp\Client();
+        $response = $client->request($method, $url, $param);
+        $result = json_decode($response->getBody()->getContents(), true);
+        if ($result['code'] == 0) {
+            return $result['data'];
+        } else {
+            return [];
+        }
+    } catch (\Exception $exception) {
+        return [];
+    }
+
+}
+