Browse Source

广告管理更新

shishao-home 6 years ago
parent
commit
c89e3f8551
3 changed files with 17 additions and 24 deletions
  1. 4 4
      app/business/controllers/AdController.php
  2. 10 2
      app/business/controllers/BaseController.php
  3. 3 18
      sql.txt

+ 4 - 4
app/business/controllers/AdController.php

@@ -19,7 +19,7 @@ class AdController extends BaseController
 		parent::actionList('*', $where);
 	}
 	
-	public function actionDetail()
+	/*public function actionDetail()
 	{
 		$data = Yii::$app->request->get();
 		if (isset($data['is_view']) && $data['is_view'] == 1) {
@@ -28,7 +28,7 @@ class AdController extends BaseController
 		}
 		
 		parent::actionDetail();
-	}
+	}*/
 	
 	public function actionAdd()
 	{
@@ -41,11 +41,11 @@ class AdController extends BaseController
 		$data = Yii::$app->request->post();
 		
 		$id = $data['firstAd'];
-		$updateData = ['order' => $data['secondOrder']];
+		$updateData = ['inTurn' => $data['secondOrder']];
 		AdService::updateById($id, $updateData);
 		
 		$id = $data['secondAd'];
-		$updateData = ['order' => $data['firstOrder']];
+		$updateData = ['inTurn' => $data['firstOrder']];
 		AdService::updateById($id, $updateData);
 		
 		$tempOrder = $data['firstOrder'];

+ 10 - 2
app/business/controllers/BaseController.php

@@ -100,7 +100,11 @@ class BaseController extends PublicController
         $id = Yii::$app->request->get('id');
         $service = $this->service;
         $data = $service::getById($id);
-        util::success($data);
+        if(!empty($data)){
+            util::success($data);
+        }
+
+        util::fail('');
     }
 
     public function actionUpdate()
@@ -109,7 +113,11 @@ class BaseController extends PublicController
         $id = $data['id'];
         $service = $this->service;
         $re = $service::updateById($id, $data);
-        util::success($re);
+        if($re['status'] === true){
+            util::success($re);
+        }
+
+        util::fail();
     }
 
     public function actionDelete()

+ 3 - 18
sql.txt

@@ -1,20 +1,3 @@
-2019.12.8 14:57 shish
-DROP TABLE IF EXISTS `xhFest`;
-CREATE TABLE xhFest(
-id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-`name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '节日名称',
-`date` CHAR(6) NOT NULL DEFAULT '' COMMENT '日期',
-`inTurn` INT NOT NULL DEFAULT 0 COMMENT '排序'
-)COMMENT='节日';
-ALTER TABLE xhMerchantExtend ADD riseType TINYINT NOT NULL DEFAULT 0 COMMENT '涨价方式 0百分比 1金额' AFTER `generalMerchant`;
-ALTER TABLE xhMerchantExtend ADD riseAmount INT NOT NULL DEFAULT 0 COMMENT '涨价比例,涨价金额' AFTER `riseType`;
-drop table if exists `xhFestRise`;
-CREATE TABLE IF NOT EXISTS xhFestRise(
-id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-merchantId INT NOT NULL DEFAULT 0 COMMENT '商家id',
-festId INT NOT NULL DEFAULT 0 COMMENT '节日'
-)COMMENT='涨价节日';
-
 2019.12.8 shish
 DROP TABLE IF EXISTS xhPic;
 CREATE TABLE IF NOT EXISTS xhPic(
@@ -38,8 +21,10 @@ ALTER TABLE xhPicCategory CHANGE pictureId picId INT NOT NULL DEFAULT 0 COMMENT
 
 shizhongqi 2019.12.7
 ALTER TABLE xhAd ADD `status` TINYINT NOT NULL DEFAULT 0 COMMENT '启用状态 0 未启用 1 启用' AFTER `adName`;
-ALTER TABLE xhAd ADD `order` INT NOT NULL DEFAULT 0 COMMENT '排序' AFTER `status`;
+ALTER TABLE xhAd ADD `inTurn` INT NOT NULL DEFAULT 0 COMMENT '排序' AFTER `status`;
 ALTER TABLE xhAd ADD `viewTimes` INT NOT NULL DEFAULT 0 COMMENT '点击次数' AFTER `adImg`;
+ALTER TABLE `huahuibao`.`xhAd` CHANGE `startTime` `startTime` DATETIME NULL COMMENT '开始时间', CHANGE `endTime` `endTime` DATETIME NULL COMMENT '结束时间';
+ALTER TABLE xhAd ADD `forever` TINYINT NOT NULL DEFAULT 0 COMMENT '永久有效:0 未启用 1 永久有效' AFTER `goodsId`;
 
 2019.12.6 shish
 增加xhRegion表结构和数据!!