Browse Source

节日增删改查

shish 6 years ago
parent
commit
a673f1ff0e

+ 5 - 3
app/business/controllers/GoodsController.php

@@ -21,10 +21,12 @@ class GoodsController extends BaseController
 	public function actionList()
 	{
 		$where = ['merchantId' => $this->merchantId];
-		$list = GoodsService::getGoodsList($where);
-		util::success($list);
+		$data = GoodsService::getGoodsList($where);
+		$asset = $this->merchantAsset;
+		$data['MerchantAsset'] = $asset;
+		util::success($data);
 	}
-	
+
 	//添加商品 shish 2019.12.7
 	public function actionAdd()
 	{

+ 46 - 0
app/saas/controllers/FestController.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace saas\controllers;
+
+use biz\saas\services\FestService;
+use Yii;
+use common\components\util;
+
+
+class FestController extends BaseController
+{
+	
+	//节日列表 shish 2019.12.8
+	public function actionList()
+	{
+		$fest = FestService::getAllByCondition([], null, '*');
+		util::success($fest);
+	}
+	
+	//添加节日 shish 2019.12.21
+	public function actionAdd()
+	{
+		$post = Yii::$app->request->post();
+		$return = FestService::add($post);
+		util::success($return);
+	}
+	
+	//修改节日 shish 2019.12.21
+	public function actionUpdate()
+	{
+		$post = Yii::$app->request->post();
+		$id = $post['id'];
+		unset($post['id']);
+		FestService::updateById($id, $post);
+		util::ok();
+	}
+	
+	//节日详情 shish 2019.12.21
+	public function actionDetail()
+	{
+		$id = Yii::$app->request->get('id');
+		$fest = FestService::getById($id);
+		util::success($fest);
+	}
+
+}

+ 18 - 40
app/saas/controllers/GoodsController.php

@@ -1,46 +1,24 @@
 <?php
+
 namespace saas\controllers;
+
+use biz\goods\services\GoodsService;
+use biz\retail\services\RetailAssetService;
 use Yii;
-use yii\helpers\Json;
-use common\services\xhGoodsSettingService;
-use common\components\configDict;
-use common\services\xhRecommendService;
 use common\components\util;
-use common\components\qrCodeUtil;
-use common\models\xhGoods;
-use common\services\xhGoodsService;
-use common\services\xhGoodsPriceService;
-use common\services\xhTMessageService;
-use common\services\xhCategoryService;
-use common\components\page;
-use common\services\xhAdminToMerchantService;
-use common\services\xhWxOpenService;
-class GoodsController extends PlatformController
+
+
+class GoodsController extends BaseController
 {
-    /**
-     * 商品列表
-     */
-    public function actionList()
-    {
-    	$get			= Yii::$app->request->get();
-    	$query			= xhGoods::find();
-    	$status 		= isset($get['status']) ? $get['status'] : -1;
-		if(isset($get['status']) && $get['status'] != -1){
-			$query->andWhere(['status' => $get['status']]);
-		}
-		$query->andWhere(['delStatus' => 0]);
-		if(isset($get['goodsName']) && !empty($get['goodsName'])){
-			$query->andWhere(['like', 'goodsName', $get['goodsName']]);
-		}
-    	$query->orderBy('id desc');
-	    $countQuery		= clone $query;
-	    $count			= $countQuery->count();
-	    $page			= isset($get['page']) ? $get['page'] : 1;
-	    $pageSize		= 20;
-	    $offset			= ($page - 1) * $pageSize;
-	    $models			= $query->offset($offset)->limit($pageSize)->asArray()->all();
-	    $page			= new page($count,$page,$pageSize);
-	    $paging 		= $page->fpage();
-	    return $this->render('list', ['models' => $models,'paging' => $paging,'status' => $status,]);
-    }
+
+	//商品列表 shish 2019.12.7
+	public function actionList()
+	{
+		$where = [];
+		$data = GoodsService::getGoodsList($where);
+		$asset = RetailAssetService::getAsset();
+		$data['RetailAsset'] = $asset;
+		util::success($data);
+	}
+
 }

+ 6 - 0
sql.txt

@@ -26,6 +26,12 @@ CREATE TABLE IF NOT EXISTS `xhRetailAsset` (
   `totalExpend` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '累计消费',
   `addTime` INT NOT NULL DEFAULT 0 COMMENT '添加时间'
 ) COMMENT='平台零售业资产';
+ALTER TABLE `xhRetailAsset` ADD onGoods INT NOT NULL DEFAULT 0 COMMENT '上架商品数' AFTER `totalGoods`;
+ALTER TABLE `xhRetailAsset` ADD offGoods INT NOT NULL DEFAULT 0 COMMENT '下架商品数' AFTER `totalGoods`;
+ALTER TABLE `xhMerchantAsset` ADD onGoods INT NOT NULL DEFAULT 0 COMMENT '上架商品数' AFTER `totalGoods`;
+ALTER TABLE `xhMerchantAsset` ADD offGoods INT NOT NULL DEFAULT 0 COMMENT '下架商品数' AFTER `totalGoods`;
+ALTER TABLE `xhFest` CHANGE `date` `month` TINYINT NOT NULL DEFAULT 1 COMMENT '月份';
+ALTER TABLE `xhFest` ADD `day` TINYINT NOT NULL DEFAULT 1 COMMENT '日期' AFTER `month`;
 
 2019.12.19 15:22 小程序相关
 ALTER TABLE `xhMerchantExtend` ADD miniVersion INT NOT NULL DEFAULT 0 COMMENT '小程序当前版本' AFTER `miniRefreshToken`;