|
|
@@ -89,7 +89,7 @@ class CategoryController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$categoryId = isset($get['categoryId']) ? $get['categoryId'] : 0;
|
|
|
$category = CategoryClass::getById($categoryId);
|
|
|
- CategoryService::valid($category, $this->mainId);
|
|
|
+ util::validMainId($category, $this->mainId);
|
|
|
|
|
|
if ($category['goodsNum'] > 0) {
|
|
|
$goodsCateObjs = GoodsCategoryClass::getAllByCondition(['mainId' => $this->mainId, 'cId' => $categoryId]);
|
|
|
@@ -108,7 +108,7 @@ class CategoryController extends BaseController
|
|
|
$defaultCategoryId = $defaultCategory['id'];
|
|
|
foreach ($goodsCateObjs as $gcObj) {
|
|
|
// 先判断商品是否也在其它分类下
|
|
|
- $goodsOtherCateCount = GoodsCategoryClass::getCount(['mainId' => $this->mainId, 'gId' => $gcObj['gId'], 'delStatus' => 0]);
|
|
|
+ $goodsOtherCateCount = GoodsCategoryClass::getCount(['mainId' => $this->mainId, 'gId' => $gcObj['gId']]);
|
|
|
if ($goodsOtherCateCount == 1) {
|
|
|
// 如果商品仅在此分类下,则归到默认分类
|
|
|
GoodsCategoryClass::updateById($gcObj['id'], ['cId' => $defaultCategoryId, 'delStatus' => 0]);
|