Browse Source

更新涨价

shish 6 years ago
parent
commit
8de8cb7f36
1 changed files with 23 additions and 0 deletions
  1. 23 0
      app/business/controllers/GoodsController.php

+ 23 - 0
app/business/controllers/GoodsController.php

@@ -9,6 +9,7 @@
 namespace business\controllers;
 
 use biz\goods\services\GoodsSettingService;
+use biz\saas\services\FestRiseService;
 use Yii;
 use common\components\util;
 use biz\goods\services\GoodsService;
@@ -111,4 +112,26 @@ class GoodsController extends BaseController
 		util::success($return);
 	}
 	
+	//更新涨价 shish 2019.12.9
+	public function actionUpdateRise()
+	{
+		$post = Yii::$app->request->post();
+		$festIdList = isset($post['festIdList']) && !empty($post['festIdList']) ? $post['festIdList'] : [];
+		unset($post['festIdList']);
+		$riseSwitch = isset($post['riseSwitch']) && is_numeric($post['riseSwitch']) ? $post['riseSwitch'] : 1;
+		if ($riseSwitch == 1) {
+			if (empty($festIdList)) {
+				util::fail('请选择节日');
+			}
+			FestRiseService::deleteByCondition(['merchantId' => $this->merchantId]);
+			$add = [];
+			foreach ($festIdList as $festId) {
+				$add[] = ['merchantId' => $this->merchantId, 'festId' => $festId];
+			}
+			FestRiseService::batchAdd($add);
+		}
+		GoodsSettingService::updateByCondition(['merchantId' => $this->merchantId], $post);
+		util::ok('提交成功');
+	}
+	
 }