shish 6 years ago
parent
commit
6c2ec8c7fc

+ 3 - 2
app/shop/controllers/GoodsController.php

@@ -79,18 +79,19 @@ class GoodsController extends BaseController
     public function actionSort()
     {
         $id = Yii::$app->request->get('id', 0);
-        $cId = Yii::$app->request->get('cId', -1);
+        $cId = Yii::$app->request->get('cId', 0);
         $inTurn = Yii::$app->request->get('inTurn', 0);
         //验证商品
         $info = GoodsService::getById($id);
         GoodsService::valid($info, $this->merchantId);
-        if ($cId != -1) {
+        if ($cId != 0) {
             //验证分类
             $category = CategoryService::getById($cId);
             CategoryService::valid($category, $this->merchantId);
             GoodsCategoryService::updateByCondition(['cId' => $cId, 'gId' => $id], ['inTurn' => $inTurn]);
         } else {
             GoodsService::updateById($id, ['inTurn' => $inTurn]);
+	        GoodsCategoryService::updateByCondition(['gId' => $id], ['inTurn' => $inTurn]);
         }
         util::complete('操作成功');
     }

+ 3 - 0
console/controllers/UpgradeController.php

@@ -1463,6 +1463,9 @@ UPDATE `xhUserAsset` SET `member`=0 WHERE `member`=-1;";
 		$sql = "UPDATE `xhSetMeal` SET price=3980;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 
+		$sql = "ALTER TABLE `xhGoodsCategory` MODIFY `inTurn` INT NOT NULL DEFAULT 0 COMMENT '排序';";
+		Yii::$app->db->createCommand($sql)->execute($sql);
+
 	}
 
 	//数据迁移 shish 2020.1.12