|
@@ -36,4 +36,28 @@ class ProductController extends Controller
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // ./yii product/sk-price
|
|
|
|
|
+ public function actionSkPrice()
|
|
|
|
|
+ {
|
|
|
|
|
+ ini_set('memory_limit', '2045M');
|
|
|
|
|
+ set_time_limit(0);
|
|
|
|
|
+
|
|
|
|
|
+ $list = ProductClass::getAllByCondition([], null, '*', null, true);
|
|
|
|
|
+ if (empty($list)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($list as $key => $item) {
|
|
|
|
|
+ $price = $item->price ?? 0;
|
|
|
|
|
+ $skAddPrice = $item->skAddPrice ?? 0;
|
|
|
|
|
+ $addPrice = $item->addPrice ?? 0;
|
|
|
|
|
+ $diff = bcsub($skAddPrice, $addPrice, 2);
|
|
|
|
|
+ $currentPrice = $price;
|
|
|
|
|
+ if ($diff > 0) {
|
|
|
|
|
+ $currentPrice = bcadd($price, $diff, 2);
|
|
|
|
|
+ }
|
|
|
|
|
+ $item->skPrice = $currentPrice;
|
|
|
|
|
+ $item->save();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|