Browse Source

删除报错

shish 6 years ago
parent
commit
1185a2b683

+ 1 - 0
app/business/controllers/CategoryController.php

@@ -85,6 +85,7 @@ class CategoryController extends BaseController
 		$where = [];
 		$where['merchantId'] = $this->merchantId;
 		$where['cId'] = $categoryId;
+		$where['delStatus'] = 0;
 		$data = GoodsCategoryService::getGoodsList($where);
 		util::success($data);
 	}

+ 1 - 1
app/business/controllers/GoodsController.php

@@ -87,7 +87,7 @@ class GoodsController extends BaseController
 	{
 		$id = Yii::$app->request->get('id', 0);
 		GoodsService::deleteGoods($id, $this->admin);
-		util::success();
+		util::ok();
 	}
 	
 	//上下架 shish 2019.12.8

+ 5 - 4
biz/goods/services/GoodsService.php

@@ -5,6 +5,7 @@ namespace biz\goods\services;
 use biz\admin\services\AdminService;
 use biz\base\services\BaseService;
 
+use biz\goods\classes\GoodsCategoryClass;
 use biz\goods\classes\GoodsClass;
 use common\components\util;
 use Yii;
@@ -43,8 +44,8 @@ class GoodsService extends BaseService
 		if ($goods['merchantId'] != $admin['merchantId']) {
 			util::fail('您没有权限删除');
 		}
-		GoodsClass::deleteById($id);
-		GoodsCategoryService::deleteByCondition(['gId' => $id]);
+		GoodsClass::updateById($id, ['delStatus' => 1]);
+		GoodsCategoryClass::updateByCondition(['gId' => $id], ['delStatus' => 1]);
 	}
 	
 	//添加商品 shish 2019.12.7
@@ -58,7 +59,7 @@ class GoodsService extends BaseService
 	{
 		return GoodsClass::updateGoods($id, $data);
 	}
-
+	
 	//验证对此商品的操作权限 shish 2019.12.7
 	public static function valid($info, $merchantId)
 	{
@@ -66,7 +67,7 @@ class GoodsService extends BaseService
 			util::fail('您没有权限操作');
 		}
 	}
-
+	
 	//上下架 shish 2019.12.8
 	public static function changeStatus($id, $status)
 	{