q 1 рік тому
батько
коміт
79ce88d4f1
1 змінених файлів з 9 додано та 0 видалено
  1. 9 0
      Modules/OpcData/Services/zaoquan/ZQDcsApiService.php

+ 9 - 0
Modules/OpcData/Services/zaoquan/ZQDcsApiService.php

@@ -37,6 +37,11 @@ class ZQDcsApiService
 
         // 发送 HTTP POST 请求
         $response = $this->client->post($apiUrl, [
+            'headers' => [
+                'Authorization' => 'Token appkey_100100',
+                'Content-Type'=>'application/json; charset=utf-8',
+                // 其他头部信息
+            ],
             'PageNum'=>"-1",
             'PointIds' => $pointIds,
         ]);
@@ -44,6 +49,10 @@ class ZQDcsApiService
         // 获取 API 响应的 JSON 数据
         $res = json_decode($response->getBody(), true);
 
+        if($res['Errors']) {
+            return null;
+        }
+
         $transformedData = $this->transformData($res);
 
         return $transformedData;