shish 6 rokov pred
rodič
commit
9a4fb500c3

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

@@ -62,4 +62,29 @@ class GoodsController extends BaseController
 		util::success();
 	}
 	
+	//上下架 shish 2019.12.8
+	public function actionChangeStatus()
+	{
+		$get = Yii::$app->request->get();
+		$id = isset($get['id']) ? $get['id'] : 0;
+		$status = isset($get['status']) ? $get['status'] : 1;
+		GoodsService::valid($id, $this->merchantId);
+		GoodsService::changeStatus($id, $status);
+		util::ok();
+	}
+
+	//发送短链接到手机上 shish 2019.12.8
+	public function actionSendShortUrl()
+	{
+		$id = Yii::$app->request->get('id');
+		util::ok();
+	}
+
+	//查看商品短链接 shish 2019.12.8
+	public function actionShortUrl()
+	{
+		$id = Yii::$app->request->get('id');
+		util::success(['shortUrl' => 'https://w.url.cn/s/A8iQlgr']);
+	}
+
 }

+ 7 - 0
biz/goods/classes/GoodsClass.php

@@ -149,4 +149,11 @@ class GoodsClass extends BaseClass
 		self::updateById($id, $data);
 	}
 	
+	//产品上下架 shish 2019.12.8
+	public static function changeStatus($id, $status)
+	{
+		self::updateById($id, ['status' => $status]);
+		GoodsCategoryClass::updateByCondition(['gId' => $id], ['status' => $status]);
+	}
+
 }

+ 6 - 0
biz/goods/services/GoodsService.php

@@ -68,4 +68,10 @@ class GoodsService extends BaseService
 		}
 	}
 
+	//上下架 shish 2019.12.8
+	public static function changeStatus($id, $status)
+	{
+		GoodsClass::changeStatus($id, $status);
+	}
+
 }

+ 1 - 0
sql.txt

@@ -18,6 +18,7 @@ categoryId INT NOT NULL DEFAULT 0 COMMENT '分类id'
 ALTER TABLE xhPic ADD inTurn INT NOT NULL DEFAULT 0 COMMENT '排序' AFTER `name`;
 ALTER TABLE xhPicCategory ADD inTurn INT NOT NULL DEFAULT 0 COMMENT '排序' AFTER categoryId;
 ALTER TABLE xhPicCategory CHANGE pictureId picId INT NOT NULL DEFAULT 0 COMMENT '图片id';
+ALTER TABLE xhGoodsCategory ADD `status` TINYINT NOT NULL DEFAULT 1 COMMENT '上下架状态 0下架 1正常' AFTER `merchantId`;
 
 shizhongqi 2019.12.7
 ALTER TABLE xhAd ADD `status` TINYINT NOT NULL DEFAULT 0 COMMENT '启用状态 0 未启用 1 启用' AFTER `adName`;