From 3407c10808d75f2f9340a030f90191ecafa055a2 Mon Sep 17 00:00:00 2001 From: hjl <1657978663@qq.com> Date: 星期五, 07 六月 2024 19:22:35 +0800 Subject: [PATCH] feat: 修复学习端bug --- ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java index 01aa478..2d3f6df 100644 --- a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java +++ b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java @@ -104,6 +104,7 @@ @Autowired private PayMoneyUtil payMoneyUtil; + @PostMapping("/pay") @ApiOperation(value = "购买会员支付操作", tags = {"家长端-个人中心"}) @ApiImplicitParams({ @@ -132,6 +133,7 @@ } return AjaxResult.success(); } + @PostMapping("/order") @ApiOperation(value = "购买会员下单操作", tags = {"家长端-个人中心"}) @ApiImplicitParams({ @@ -461,20 +463,20 @@ .eq("phone", phone)); if (tUser1 != null) { if (tUser1.getState() == 2) { - throw new GlobalException("登录失败,您的账号已被冻结!"); + return R.freeze("登录失败,您的账号已被冻结!"); } } else { // 手机验证码校验 if (!phoneCode.equals("123456")) { Object redisPhoneCode = redisService.getCacheObject(RedisConstants.PHONE_CODE + phone); if (null == redisPhoneCode) { - throw new GlobalException("登录失败,手机验证码已过期!"); + return R.errorCode("登录失败,手机验证码无效!"); } else { // redis 验证码的value 为 code:时间戳 String rCodeAndTime = String.valueOf(redisPhoneCode); String rCode = rCodeAndTime.split(":")[0]; if (!rCode.equalsIgnoreCase(phoneCode)) { - throw new GlobalException("登录失败,手机验证码输入有误!"); + return R.errorCode("登录失败,手机验证码无效!"); } else { tUser1 = getUser(phone); userService.save(tUser1); @@ -592,7 +594,7 @@ @ApiImplicitParams({ @ApiImplicitParam(value = "手机号", name = "phone", dataType = "string", required = true), }) - public R<?> sendPhoneCode(@RequestParam String phone) { + public R<?> sendPhoneCode(@RequestParam String phone) throws Exception { return userService.phoneCode(phone) ? R.ok() : R.fail(); } @@ -661,9 +663,10 @@ */ @GetMapping("/userInfo") @ApiOperation(value = "用户详情", tags = {"学习端-用户详情"}) - public R<TUser> userInfo() { - - return R.ok(userService.lambdaQuery().eq(TUser::getId, tokenService.getLoginUserStudy().getUserid()).one()); + public R<UserPersonalCenterVO> userInfo() { + TUser user = userService.lambdaQuery().eq(TUser::getId, tokenService.getLoginUserStudy().getUserid()).one(); + TUserStudy userStudy = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, user.getId()).eq(TUserStudy::getDisabled, 0).one(); + return R.ok(new UserPersonalCenterVO(user, userStudy)); } @PostMapping("/deleteUser") -- Gitblit v1.7.1