|
|
@@ -47,22 +47,24 @@ class ProductController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //更新重量 ./yii product/update-weight
|
|
|
- public function actionUpdateWeight()
|
|
|
+ //更新价格 ./yii product/update-price
|
|
|
+ public function actionUpdatePrice()
|
|
|
{
|
|
|
$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);
|
|
|
+ $ptItemId = $product->itemId ?? 0;
|
|
|
$weight = $product->weight ?? 0;
|
|
|
- if (!empty($weight)) {
|
|
|
- $preWeight = $ptItem->weight ?? 0;
|
|
|
- $ptItem->weight = $weight;
|
|
|
- $ptItem->save();
|
|
|
- echo "平台花材{$ptItem->id} 重量由{$preWeight}更新为{$weight} \n";
|
|
|
+ $addPrice = $product->addPrice ?? 0;
|
|
|
+ $p = ProductClass::getByCondition(['shopId' => 214, 'itemId' => $ptItemId], true);
|
|
|
+ if (!empty($p)) {
|
|
|
+ $p->addPrice = $addPrice;
|
|
|
+ $p->weight = $weight;
|
|
|
+ $p->save();
|
|
|
+ echo "productId {$p->id} 加价改成了:{$addPrice} 重量改成了:{$weight} \n";
|
|
|
+ exit();
|
|
|
}
|
|
|
}
|
|
|
}
|