|
|
@@ -2,6 +2,9 @@
|
|
|
|
|
|
namespace console\controllers;
|
|
|
|
|
|
+
|
|
|
+use biz\item\classes\PtItemClass;
|
|
|
+use biz\product\classes\ProductClass;
|
|
|
use biz\product\models\Product;
|
|
|
use yii\console\Controller;
|
|
|
use Yii;
|
|
|
@@ -15,7 +18,16 @@ class ProductController extends Controller
|
|
|
$sql = "SELECT * FROM `" . Product::tableName() . "` WHERE cover not like '%.%'";
|
|
|
$command = Yii::$app->db->createCommand($sql);
|
|
|
$data = $command->queryAll();
|
|
|
- print_r($data);
|
|
|
+ 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";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|