Pārlūkot izejas kodu

门店添加修改

shish 6 gadi atpakaļ
vecāks
revīzija
43d8094094

+ 12 - 0
app/business/controllers/ShopController.php

@@ -14,6 +14,8 @@ class ShopController extends BaseController
 	public function actionList()
 	{
 		$where = [];
+		$where['merchantId'] = $this->merchantId;
+		$where['delStatus'] = 0;
 		$list = ShopService::getShopList($where);
 		util::success($list);
 	}
@@ -85,4 +87,14 @@ class ShopController extends BaseController
 		readfile($file);
 	}
 	
+	//删除门店 shish 2020.3.1
+	public function actionDelete()
+	{
+		$id = Yii::$app->request->get('id', 0);
+		$shop = ShopService::getById($id);
+		ShopService::valid($shop, $this->merchantId);
+		ShopService::deleteShop($shop);
+		util::ok();
+	}
+	
 }

+ 11 - 1
biz/merchant/classes/ShopClass.php

@@ -50,7 +50,7 @@ class ShopClass extends BaseClass
 		}
 		return self::updateById($id, $data);
 	}
-
+	
 	//取商家所有门店 shish 2020.2.29
 	public static function getAllShop($merchantId)
 	{
@@ -68,4 +68,14 @@ class ShopClass extends BaseClass
 		}
 	}
 	
+	//删除门店 shish 2020.3.1
+	public static function deleteShop($shop)
+	{
+		if (isset($shop['default']) && $shop['default'] == 1) {
+			util::fail('默认门店不允许删除');
+		}
+		$id = $shop['id'];
+		self::updateById($id, ['delStatus' => 1]);
+	}
+	
 }

+ 6 - 0
biz/merchant/services/ShopService.php

@@ -71,5 +71,11 @@ class ShopService extends BaseService
 	{
 		return ShopClass::updateShop($id, $data);
 	}
+
+	//删除门店 shish 2020.3.1
+	public static function deleteShop($shop)
+	{
+		return ShopClass::deleteShop($shop);
+	}
 	
 }

+ 7 - 0
console/controllers/UpgradeController.php

@@ -1130,6 +1130,13 @@ ALTER TABLE `xhUser` ADD `store` TINYINT NOT NULL DEFAULT 0 COMMENT '门店订
 ALTER TABLE `xhShop` ADD `totalIncome` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '累计收入' AFTER `applyMemberCode`;";
 		Yii::$app->db->createCommand($sql)->execute();
 
+		//门店相关修改
+		$sql = "ALTER TABLE `xhShop` ADD `avatar` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '门店照片;门店头像' AFTER `id`;
+ALTER TABLE `xhShop` ADD `status` TINYINT NOT NULL DEFAULT 1 COMMENT '门店状态 0停用 1正常' AFTER `totalIncome`;
+ALTER TABLE `xhShop` ADD `delStatus` TINYINT NOT NULL DEFAULT 0 COMMENT '删除状态 0没有删除 1已删除' AFTER `totalIncome`;
+ALTER TABLE `xhShop` ADD `default` TINYINT NOT NULL DEFAULT 0 COMMENT '默认门店 0不是 1是,默认门店不能删除' AFTER `totalIncome`;";
+		Yii::$app->db->createCommand($sql)->execute();
+
 	}
 	
 	//重新拉取并保存国兰客户的头像和图片 shish 2020.1.12