From fd7b8fb7c89832c28a838b0449bbb8a392433ee2 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 22 四月 2025 14:33:02 +0800 Subject: [PATCH] 将华为云短信替换成阿里云短信 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java | 52 +++++++++++++++++----------------------------------- 1 files changed, 17 insertions(+), 35 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java index f3639bb..69ce0bd 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java @@ -12,6 +12,7 @@ import com.ruoyi.account.vo.vip.VipLevel; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.exception.ServiceException; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.*; @@ -87,29 +88,27 @@ VipLevel vipLevel = new VipLevel(); List<Level> levelList = new ArrayList<>(); - // 批量获取 goodsVip 和 vipGoods - List<Integer> vipIds = vipSettingList.stream().map(VipSetting::getId).collect(Collectors.toList()); - Map<Integer, R<List<VipGood>>> vipGoodsMap = getVipGoods(vipIds); - vipSettingList.forEach(vipSetting -> { Level level = new Level(); level.setName(vipSetting.getVipName()); BeanUtils.copyBeanProp(level, vipSetting); level.setVipDesc(baseSetting.getContent()); - R<List<VipGood>> vipGoodR = vipGoodsMap.get(vipSetting.getId()); - if (R.isError(vipGoodR)) { - throw new ServiceException("会员商品获取失败"); + + List<String> goodsNames = new ArrayList<>(); + if (StringUtils.isNotEmpty(vipSetting.getGoodIds())){ + String[] goodsIds = vipSetting.getGoodIds().split(","); + List<Goods> goodsList = goodsClient.getGoodsById(goodsIds).getData(); + if (goodsList != null) { + for (Goods goods : goodsList) { + if (goods.getDelFlag().equals(0)){ + goodsNames.add(goods.getName()); + } + } + } } - List<VipGood> vipGoodList = vipGoodR.getData(); - if (vipGoodList != null && !vipGoodList.isEmpty()) { - List<String> goodsNames = new ArrayList<>(); - vipGoodList.forEach(vipGood -> { - Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class); - goodsNames.add(goods.getName()); - }); - level.setGoodsNames(goodsNames); - } + + level.setGoodsNames(goodsNames); levelList.add(level); }); @@ -136,21 +135,11 @@ @GetMapping("/check") @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"}) public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) { - return R.ok(vipCenterService.check(type)); + return R.ok(vipCenterService.checkEligibility(type)); } - - - private Map<Integer, R<GoodsVip>> getGoodsVips(List<Integer> vipIds) { - Map<Integer, R<GoodsVip>> result = new HashMap<>(); - for (Integer vipId : vipIds) { - R<GoodsVip> goodsVipR = goodsVipClient.getGoodsVip(null, vipId); - result.put(vipId, goodsVipR); - } - return result; - } private Map<Integer, R<List<VipGood>>> getVipGoods(List<Integer> vipIds) { Map<Integer, R<List<VipGood>>> result = new HashMap<>(); @@ -161,13 +150,6 @@ return result; } - private boolean isValidJson(String json) { - try { - JSONObject.parseObject(json); - return true; - } catch (Exception e) { - return false; - } - } + } -- Gitblit v1.7.1