From 2ca169c85f61256fb5185c078dba1bfef2be5066 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期三, 11 六月 2025 22:34:11 +0800
Subject: [PATCH] 小程序鉴权处理

---
 seller-api/src/main/java/cn/lili/controller/goods/CategoryStoreController.java |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/seller-api/src/main/java/cn/lili/controller/goods/CategoryStoreController.java b/seller-api/src/main/java/cn/lili/controller/goods/CategoryStoreController.java
index 362d46b..04efa8a 100644
--- a/seller-api/src/main/java/cn/lili/controller/goods/CategoryStoreController.java
+++ b/seller-api/src/main/java/cn/lili/controller/goods/CategoryStoreController.java
@@ -1,12 +1,16 @@
 package cn.lili.controller.goods;
 
 import cn.lili.common.enums.ResultUtil;
+import cn.lili.common.security.AuthUser;
 import cn.lili.common.security.context.UserContext;
+import cn.lili.common.utils.StringUtils;
 import cn.lili.common.vo.ResultMessage;
 import cn.lili.modules.goods.entity.vos.CategoryBrandVO;
 import cn.lili.modules.goods.entity.vos.CategoryVO;
 import cn.lili.modules.goods.service.CategoryBrandService;
 import cn.lili.modules.goods.service.CategoryService;
+import cn.lili.modules.member.entity.dos.Clerk;
+import cn.lili.modules.member.service.ClerkService;
 import cn.lili.modules.store.service.StoreDetailService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -49,11 +53,19 @@
      */
     @Autowired
     private StoreDetailService storeDetailService;
+    @Autowired
+    private ClerkService clerkService;
 
     @ApiOperation(value = "鑾峰彇搴楅摵缁忚惀鐨勫垎绫�")
     @GetMapping(value = "/all")
     public ResultMessage<List<CategoryVO>> getListAll() {
+
         String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
+        if (StringUtils.isEmpty(storeId)) {
+            Clerk clerk = clerkService.getClerkByMemberId(UserContext.getCurrentUserId());
+            storeId = clerk.getStoreId();
+        }
+
         //鑾峰彇搴楅摵缁忚惀鑼冨洿
         String goodsManagementCategory = storeDetailService.getStoreDetail(storeId).getGoodsManagementCategory();
         return ResultUtil.data(this.categoryService.getStoreCategory(goodsManagementCategory.split(",")));

--
Gitblit v1.8.0