|
|
@@ -2,7 +2,6 @@
|
|
|
|
|
|
namespace console\controllers;
|
|
|
|
|
|
-
|
|
|
use biz\item\classes\PtItemClass;
|
|
|
use biz\product\classes\ProductClass;
|
|
|
use biz\product\models\Product;
|
|
|
@@ -12,6 +11,32 @@ use Yii;
|
|
|
class ProductController extends Controller
|
|
|
{
|
|
|
|
|
|
+ //更新纯彩花艺的价格 ./yii product/update-price shish 20211020
|
|
|
+ public function actionUpdatePrice()
|
|
|
+ {
|
|
|
+ $list = ProductClass::getAllByCondition(['shopId' => 10], null, '*', null, true);
|
|
|
+ if (!empty($list)) {
|
|
|
+ foreach ($list as $key => $item) {
|
|
|
+ $price = $item->price ?? 0;
|
|
|
+ $addPrice = $item->addPrice ?? 0;
|
|
|
+ $skAddPrice = $item->skAddPrice ?? 0;
|
|
|
+ $hjAddPrice = $item->hjAddPrice ?? 0;
|
|
|
+ $zsAddPrice = $item->zsAddPrice ?? 0;
|
|
|
+
|
|
|
+ $skDiff = bcsub($addPrice, $skAddPrice, 2);
|
|
|
+ $skPrice = bcsub($price, $skDiff, 2);
|
|
|
+ $hjDiff = bcsub($addPrice, $hjAddPrice, 2);
|
|
|
+ $hkPrice = bcsub($price, $hjDiff, 2);
|
|
|
+ $zsDiff = bcsub($addPrice, $zsAddPrice, 2);
|
|
|
+ $zsPrice = bcsub($price, $zsDiff, 2);
|
|
|
+ $item->skPrice = $skPrice;
|
|
|
+ $item->hjPrice = $hkPrice;
|
|
|
+ $item->zsPrice = $zsPrice;
|
|
|
+ $item->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// ./yii product/reset-cover
|
|
|
public function actionResetCover()
|
|
|
{
|