|
|
@@ -47,4 +47,23 @@ class ProductController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //更新重量 ./yii product/update-weight
|
|
|
+ public function actionUpdateWeight()
|
|
|
+ {
|
|
|
+ $list = ProductClass::getAllByCondition(['shopId' => 10], null, '*', null, true);
|
|
|
+ if (empty($list)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ foreach ($list as $product) {
|
|
|
+ $itemId = $product->itemId ?? 0;
|
|
|
+ $ptItem = PtItemClass::getById($itemId, true);
|
|
|
+ $weight = $product->weight ?? 0;
|
|
|
+ if (!empty($weight)) {
|
|
|
+ $ptItem->weight = $weight;
|
|
|
+ $ptItem->save();
|
|
|
+ echo "平台花材{$ptItem->id} 重量已更新为{$weight} \n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|