From 8a02b254c772e86d1c70d78b3753de1969b5c4bc Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期六, 26 八月 2023 13:08:00 +0800 Subject: [PATCH] bug --- ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java index fea4303..1b8986b 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/console/ShopController.java @@ -1,8 +1,11 @@ package com.ruoyi.shop.controller.console; +import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.bean.BeanUtils; +import com.ruoyi.common.redis.service.RedisService; +import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication; import com.ruoyi.shop.domain.pojo.shop.ShopProportion; import com.ruoyi.shop.domain.pojo.shop.ShopRelUser; @@ -69,6 +72,8 @@ @Resource private ShopProportionService shopProportionService; + @Resource + private RedisService redisService; /** * 企业微信H5登录 * @param qwUserDetail @@ -85,6 +90,12 @@ Long userId = shopStaff.getUserId(); SysUser sysUser = remoteUserService.getSysUser(userId).getData(); Optional.ofNullable(sysUser).orElseThrow(() -> new ServiceException("登录失败,未查询到用户")); + Shop shop = shopService.getByShopId(shopStaff.getShopId()); + if(shop.getFrozenFlag()==1){ + String userKey = SecurityUtils.getUserKey(); + redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY+userKey); + throw new ServiceException("商户已被冻结",401); + } // 构造登录返回信息 QwH5LoginVo qwH5LoginVo = new QwH5LoginVo(); qwH5LoginVo.setUserid(qwUserDetail.getUserid()); @@ -139,10 +150,10 @@ @PostMapping("/getShopByBelongUserId") public R<ShopRelUserVo> getShopByBelongUserId(@RequestBody Long userId) { - Shop shop = shopService.getShopByBelongUserId(userId); - Optional.ofNullable(shop).orElseThrow(() -> new ServiceException("未查询到商户信息")); + List<Shop> shopList = shopService.getShopByBelongUserId(userId); + Optional.ofNullable(shopList.get(0)).orElseThrow(() -> new ServiceException("未查询到商户信息")); ShopRelUserVo shopRelUserVo = new ShopRelUserVo(); - shopRelUserVo.setShopId(shop.getShopId()); + shopRelUserVo.setShopId(shopList.get(0).getShopId()); return R.ok(shopRelUserVo); } @@ -348,4 +359,5 @@ shopService.authShop(); return R.ok(); } + } -- Gitblit v1.7.1