shish 6 år sedan
förälder
incheckning
685475bd5b

+ 3 - 3
app/mall/controllers/MainController.php

@@ -11,11 +11,11 @@ use common\components\util;
 
 class MainController extends BaseController
 {
-
+	
 	//首页 shish 2019.12.2
 	public function actionIndex()
 	{
-		$where = ['merchantId' => $this->merchantId, 'type' => 0, 'status' => 1];
+		$where = ['merchantId' => $this->merchantId, 'type' => 0, 'status' => 1, 'delStatus' => 0];
 		$adRespond = AdService::getAdList($where);
 		$ad = [];
 		if (isset($adRespond['list']) && !empty($adRespond['list'])) {
@@ -28,5 +28,5 @@ class MainController extends BaseController
 		$data = ['ad' => $ad, 'category' => $categoryList, 'columnStyle' => rand(1, 2)];
 		util::success($data);
 	}
-
+	
 }

+ 7 - 19
app/shop/controllers/AdController.php

@@ -8,9 +8,9 @@ use common\components\util;
 
 class AdController extends BaseController
 {
-	//list,detail,create,update,delete
+	
 	protected $service = '\biz\ad\services\AdService';
-
+	
 	//广告列表
 	public function actionList()
 	{
@@ -19,26 +19,14 @@ class AdController extends BaseController
 		$where = [];
 		$where['merchantId'] = $this->merchantId;
 		$where['type'] = $type;
-		//parent::actionList('*', $where);
+		$where['delStatus'] = 0;
 		$list = AdService::getAdList($where);
 		util::success($list);
 	}
 	
-	/*public function actionDetail()
-	{
-		$data = Yii::$app->request->get();
-		if (isset($data['is_view']) && $data['is_view'] == 1) {
-			$id = $data['id'];
-			AdService::counters(['viewTimes' => 1], ['id' => $id]);
-		}
-		parent::actionDetail();
-	}*/
-	
 	//添加广告
 	public function actionAdd()
 	{
-		//$_POST['merchantId'] = $this->merchantId;
-		//parent::actionAdd();
 		$post = Yii::$app->request->post();
 		$post['merchantId'] = $this->merchantId;
 		$ad = AdService::addAd($post);
@@ -92,10 +80,10 @@ class AdController extends BaseController
 		$id = Yii::$app->request->get('id', 0);
 		$info = AdService::getById($id);
 		AdService::valid($info, $this->merchantId);
-		AdService::deleteById($id);
+		AdService::deleteAd($id);
 		util::complete('删除成功');
 	}
-
+	
 	//上下架广告
 	public function actionUpdateStatus()
 	{
@@ -103,7 +91,7 @@ class AdController extends BaseController
 		$status = Yii::$app->request->get('status', 1);
 		$info = AdService::getById($id);
 		AdService::valid($info, $this->merchantId);
-		AdService::updateById($id,['status'=>$status]);
+		AdService::updateById($id, ['status' => $status]);
 		util::complete('操作成功');
 	}
 	
@@ -125,5 +113,5 @@ class AdController extends BaseController
 		AdService::updateById($id, ['inTurn' => $inTurn]);
 		util::complete('操作成功');
 	}
-
+	
 }

+ 6 - 0
biz/ad/classes/AdClass.php

@@ -130,4 +130,10 @@ class AdClass extends BaseClass
 		}
 	}
 	
+	//删除广告 shish 2020.5.21
+	public static function deleteAd($id)
+	{
+		self::updateById($id, ['delStatus' => 1]);
+	}
+	
 }

+ 5 - 0
biz/ad/services/AdService.php

@@ -59,4 +59,9 @@ class AdService extends BaseService
 		return AdClass::updateAd($id, $data);
 	}
 	
+	public static function deleteAd($id)
+	{
+		return AdClass::deleteAd($id);
+	}
+	
 }

+ 3 - 0
console/controllers/UpgradeController.php

@@ -1457,6 +1457,9 @@ UPDATE `xhUserAsset` SET `member`=0 WHERE `member`=-1;";
 		$sql = "ALTER TABLE `xhAd` ADD `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间' AFTER `addTime`;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 
+		$sql = "ALTER TABLE `xhAd` ADD delStatus TINYINT NOT NULL DEFAULT 0 COMMENT '0正常 1删除' AFTER `status`;";
+		Yii::$app->db->createCommand($sql)->execute($sql);
+
 	}
 	
 	//数据迁移 shish 2020.1.12