Przeglądaj źródła

账户授权结果处理

shensong00 2 miesięcy temu
rodzic
commit
c20df96f14
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      app/Services/CallbackService.php

+ 6 - 1
app/Services/CallbackService.php

@@ -128,8 +128,9 @@ class CallbackService
128 128
         ];
129 129
 
130 130
         $response = HttpService::httpPost($requestUrl, json_encode($params), true);
131
-        if(empty($response) && $retry < 5) {
131
+        if(empty($response) && $retry < 3) {
132 132
             $retry++;
133
+            sleep(1);
133 134
             return self::getApprovalList($juxingConf, $userAuthorize, $retry);
134 135
         }
135 136
 
@@ -140,6 +141,10 @@ class CallbackService
140 141
         $response = json_decode($response, 1);
141 142
         if(isset($response['code']) && 1 == $response['code']) {
142 143
             return $response['data']['details'] ?? '';
144
+        } else if (isset($response['code']) && in_array($response['code'], ['30020001']) && $retry < 3) {
145
+            sleep(1);
146
+            $retry++;
147
+            return self::getApprovalList($juxingConf, $userAuthorize, $retry);
143 148
         }
144 149
 
145 150
         EmailQueue::rPush('获取token授权的广告账户列表异常', json_encode(['user_authorize' => $userAuthorize, 'response' => $response]),