shish před 4 roky
rodič
revize
1de4115fcc
1 změnil soubory, kde provedl 9 přidání a 8 odebrání
  1. 9 8
      console/controllers/ProductController.php

+ 9 - 8
console/controllers/ProductController.php

@@ -19,14 +19,15 @@ class ProductController extends Controller
         $command = Yii::$app->db->createCommand($sql);
         $data = $command->queryAll();
         if (empty($data)) {
-            foreach ($data as $item) {
-                $id = $item['id'] ?? 0;
-                $ptItemId = $item['itemId'] ?? 0;
-                $ptItem = PtItemClass::getById($ptItemId, true);
-                $cover = $ptItem->cover ?? '';
-                ProductClass::updateById($id, ['cover' => $cover]);
-                echo "productId:" . $id . " 恢复图片:" . $cover . "\n";
-            }
+            return false;
+        }
+        foreach ($data as $item) {
+            $id = $item['id'] ?? 0;
+            $ptItemId = $item['itemId'] ?? 0;
+            $ptItem = PtItemClass::getById($ptItemId, true);
+            $cover = $ptItem->cover ?? '';
+            ProductClass::updateById($id, ['cover' => $cover]);
+            echo "productId:" . $id . " 恢复图片:" . $cover . "\n";
         }
     }