ソースを参照

零售商品分类优化

shish 4 年 前
コミット
2b444d6d17

+ 6 - 1
app-hd/controllers/CategoryController.php

@@ -68,7 +68,7 @@ class CategoryController extends BaseController
         $category = CategoryService::getById($categoryId);
         CategoryService::valid($category, $this->sjId);
         if ($category['goodsNum'] > 0) {
-            util::fail('删除失败,该分类已被商品使用');
+            util::fail('分类下还有商品');
         }
         $count = CategoryService::deleteCategory($categoryId);
         if (!$count) {
@@ -92,6 +92,11 @@ class CategoryController extends BaseController
         $where['sjId'] = $this->sjId;
         $where['cId'] = $categoryId;
         $where['delStatus'] = 0;
+
+        $status = Yii::$app->request->get('status', '');
+        if (is_numeric($status)) {
+            $where['status'] = $status;
+        }
         $data = GoodsCategoryService::getGoodsList($where);
         util::success($data);
     }

+ 4 - 3
biz-hd/goods/services/CategoryService.php

@@ -23,10 +23,11 @@ class CategoryService extends BaseService
         if (empty($cat)) {
             return [];
         }
-        //处理图片
-        $prefix = imgUtil::getPrefix();
         foreach ($cat as $key => $info) {
-            $cat[$key]['img'] = $prefix . $info['img'];
+            $img = $info['img'] ?? '';
+            $cat[$key]['img'] = imgUtil::groupImg($img) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
+            $cat[$key]['bigImg'] = imgUtil::groupImg($img) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+            $cat[$key]['shortImg'] = $img;
         }
         return $cat;
     }