Sfoglia il codice sorgente

唯微宝数据拉取调整

xialei 1 anno fa
parent
commit
d3b9cb6896
1 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 5 2
      app/controller/api/douhuomall/Take.php

+ 5 - 2
app/controller/api/douhuomall/Take.php

@@ -94,8 +94,9 @@ class Take
94
             $this->remove($goodsIds);
94
             $this->remove($goodsIds);
95
             return 'sussess';
95
             return 'sussess';
96
         } catch (Exception $e) {
96
         } catch (Exception $e) {
97
-            Log::error('同步数据失败:' . $e->getMessage());
97
+            Log::error('供应链拉取数据:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】');
98
             echo '供应链拉取数据:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】';
98
             echo '供应链拉取数据:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】';
99
+            Db::name('log')->insert(['data' => '供应链拉取数据:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
99
             return 'error';
100
             return 'error';
100
         }
101
         }
101
     }
102
     }
@@ -124,9 +125,11 @@ class Take
124
         if (!is_dir($targetDir)) {
125
         if (!is_dir($targetDir)) {
125
             mkdir($targetDir, 0777, true); // 第二个参数是权限,第三个参数是递归创建
126
             mkdir($targetDir, 0777, true); // 第二个参数是权限,第三个参数是递归创建
126
         }
127
         }
128
+
129
+        ini_set("max_execution_time", 2);
127
         
130
         
128
         // 获取远程图片内容
131
         // 获取远程图片内容
129
-        $imageContent = file_get_contents($remoteImageUrl);
132
+        $imageContent = @file_get_contents($remoteImageUrl);
130
         
133
         
131
         // 检查是否成功获取内容
134
         // 检查是否成功获取内容
132
         if ($imageContent !== false) {
135
         if ($imageContent !== false) {