无关风月
2024-06-19 5feb2085f70f764d2a44dff707a3f57fa5fb306f
bug修改
2个文件已修改
19 ■■■■ 已修改文件
ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/TGoodsServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/TGoodsServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.study.api.domain.TUser;
import com.ruoyi.study.api.feignClient.StudyClient;
import com.ruoyi.study.api.vo.UserPersonalCenterVO;
import com.ruoyi.system.api.model.LoginUserParent;
import org.redisson.api.RSemaphore;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;
@@ -163,12 +164,15 @@
        if (null == good) {
            return R.exchangeError("商品不存在,请稍后重试!");
        }
        LoginUserParent loginUser1 = tokenService.getLoginUser1();
        if (null == loginUser1){
            return R.tokenError("登录失效");
        }
        // 校验用户积分是否足够兑换
        UserPersonalCenterVO userPersonalCenter = studyClient.userInfo().getData();
        if (null == userPersonalCenter) {
        TUser user = studyClient.userInfoParent().getData();
        if (null == user) {
            throw new GlobalException("用户信息获取失败!");
        }
        TUser user = userPersonalCenter.getUser();
        int needIntegral = good.getIntegral() * number;
        if (user.getIntegral() < needIntegral) {
            return R.exchangeError("兑换失败,当前剩余积分不足!");
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java
@@ -722,6 +722,15 @@
        Integer totalStudy = userStudy.getTotalStudy();
        userStudy.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600));
        return R.ok(new UserPersonalCenterVO(user, userStudy));
    }@GetMapping("/userInfoParent")
    @ApiOperation(value = "用户详情", tags = {"家长端-用户详情"})
    public R<TUser> userInfoParent() {
        LoginUserParent loginUserStudy = tokenService.getLoginUser1();
        if (null == loginUserStudy) {
            return R.tokenError("登录失效!");
        }
        TUser byId = userService.getById(loginUserStudy.getUserid());
        return R.ok(byId);
    }
    @PostMapping("/deleteUser")