From f0d8f535a4c09dee9d786d8fb13c9b9918addaa9 Mon Sep 17 00:00:00 2001
From: hjl <1657978663@qq.com>
Date: 星期二, 21 五月 2024 14:11:26 +0800
Subject: [PATCH] feat: 接口初始化

---
 ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java |  247 +++++++++++++++++++++++++++++++------------------
 1 files changed, 157 insertions(+), 90 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 8fd56b1..5f1a93d 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
@@ -3,8 +3,8 @@
 
 import com.alipay.api.AlipayApiException;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.common.core.constant.RedisConstants;
 import com.ruoyi.common.core.domain.R;
-import com.ruoyi.common.core.utils.JwtUtils;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.PageInfo;
 import com.ruoyi.common.redis.service.RedisService;
@@ -21,25 +21,22 @@
 import com.ruoyi.study.domain.TVipOrder;
 import com.ruoyi.study.dto.AppUserQuery;
 import com.ruoyi.study.dto.UserInfoQuery;
+import com.ruoyi.study.request.RegisterPhoneRequest;
 import com.ruoyi.study.service.ITUserService;
 import com.ruoyi.study.service.IVipOrderService;
 import com.ruoyi.study.utils.PayMoneyUtil;
 import com.ruoyi.study.utils.UUIDUtil;
 import com.ruoyi.study.vo.*;
-import com.ruoyi.system.api.domain.SysRole;
-import com.ruoyi.system.api.domain.SysUser;
-import com.ruoyi.system.api.model.LoginUser;
 import com.ruoyi.system.api.model.LoginUserParent;
-import io.jsonwebtoken.Claims;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.PrintWriter;
@@ -66,12 +63,14 @@
     private ManagementClient managementClient;
     @Autowired
     private TokenService tokenService;
+    @Resource
+    private RedisService redisService;
 
     @PostMapping("/vipInfo")
     @ApiOperation(value = "会员中心-获取会员说明、当前登录用户是否为会员、会员购买规格", tags = {"家长端-个人中心"})
     public AjaxResult<List<VipInfoVO>> vipInfo() {
-        if (tokenService.getLoginUser1() == null){
-            return AjaxResult.tokenError("登录失效",new Object());
+        if (tokenService.getLoginUser1() == null) {
+            return AjaxResult.tokenError("登录失效", new Object());
         }
         List<VipInfoVO> vipInfoVOS = new ArrayList<>();
         List<TVipSet> data = managementClient.getVipSet1().getData();
@@ -82,13 +81,13 @@
             Integer userid = tokenService.getLoginUser1().getUserid();
             TUser byId = userService.getById(userid);
             // 先判断vipEndTime
-            if (byId.getVipEndTime() == null){
+            if (byId.getVipEndTime() == null) {
                 vipInfoVO.setIsVip(0);
-            }else{
+            } else {
                 // 判断会员到期时间是否大于当前时间
-                if (byId.getVipEndTime().getTime() > new Date().getTime()){
+                if (byId.getVipEndTime().getTime() > new Date().getTime()) {
                     vipInfoVO.setIsVip(1);
-                }else{
+                } else {
                     vipInfoVO.setIsVip(0);
                 }
             }
@@ -97,6 +96,7 @@
         }
         return AjaxResult.ok(vipInfoVOS);
     }
+
     @Autowired
     private PayMoneyUtil payMoneyUtil;
 
@@ -107,16 +107,16 @@
             @ApiImplicitParam(name = "payType", value = "支付类型 1=微信 2=支付宝", required = true),
             @ApiImplicitParam(name = "id", value = "会员规格id", required = true),
     })
-    public AjaxResult order(Integer payType,Integer id) throws Exception {
-        if (tokenService.getLoginUser1() == null){
-            return AjaxResult.tokenError("登录失效",new Object());
+    public AjaxResult order(Integer payType, Integer id) throws Exception {
+        if (tokenService.getLoginUser1() == null) {
+            return AjaxResult.tokenError("登录失效", new Object());
         }
         Integer userid = tokenService.getLoginUser1().getUserid();
         TVipOrder tVipOrder = new TVipOrder();
         List<TVipSet> data = managementClient.getVipSet1().getData();
         Integer time = 0;
         for (TVipSet datum : data) {
-            if (datum.getId() == id){
+            if (datum.getId() == id) {
                 tVipOrder.setMoney(datum.getAmount());
                 time = datum.getTime();
             }
@@ -125,11 +125,11 @@
         tVipOrder.setUserId(userid);
         tVipOrder.setPayType(payType);
         tVipOrder.setCount(time);
-        switch (payType){
+        switch (payType) {
             case 1:
                 return payMoneyUtil.weixinpay
                         ("购买会员", "",
-                                id+"_"+tVipOrder.getId() + "_"+
+                                id + "_" + tVipOrder.getId() + "_" +
                                         UUIDUtil.getRandomCode(8),
                                 tVipOrder.getMoney().toString(),
                                 "/base/wxPayBuyVip", "APP", "");
@@ -138,13 +138,14 @@
                         ("购买会员",
                                 "购买会员下单支付",
                                 "",
-                                id+"_"+tVipOrder.getId()+"_"+
+                                id + "_" + tVipOrder.getId() + "_" +
                                         UUIDUtil.getRandomCode(8),
                                 tVipOrder.getMoney().toString(),
                                 "/base/aliPayBuyVip");
         }
         return AjaxResult.success();
     }
+
     @ResponseBody
     @PostMapping("/base/aliPayBuyVip")
     public void addVipPaymentAliCallback(HttpServletRequest request, HttpServletResponse response) {
@@ -156,9 +157,9 @@
                 // 会员规格id
                 String s = out_trade_no.split("_")[0];
                 Integer integer = Integer.valueOf(s);
-                Integer time  = 0;
+                Integer time = 0;
                 for (TVipSet datum : managementClient.getVipSet1().getData()) {
-                    if (datum.getId() == integer){
+                    if (datum.getId() == integer) {
                         time = datum.getTime();
                     }
                 }
@@ -173,7 +174,7 @@
 
 
                 TUser byId1 = userService.getById(byId.getUserId());
-                if (byId1.getVipPayTime() == null){
+                if (byId1.getVipPayTime() == null) {
                     // 是否是首次充值会员
                     byId1.setVipPayTime(new Date());
                     Calendar calendar = Calendar.getInstance();
@@ -182,16 +183,16 @@
                     Date dateAfterOneMonth = calendar.getTime();
                     byId.setTime(dateAfterOneMonth);
                     byId1.setVipEndTime(dateAfterOneMonth);
-                }else{
+                } else {
                     // 不是首次 判断vipEndTime 是否到期 如果没有 加指定月份时间 如果到期了 将会员到期时间从当前增加指定月份
-                    if (byId1.getVipEndTime().getTime() < new Date().getTime()){
+                    if (byId1.getVipEndTime().getTime() < new Date().getTime()) {
                         Calendar calendar = Calendar.getInstance();
                         calendar.setTime(new Date());
                         calendar.add(Calendar.MONTH, time);
                         Date dateAfterOneMonth = calendar.getTime();
                         byId.setTime(dateAfterOneMonth);
                         byId1.setVipEndTime(dateAfterOneMonth);
-                    }else{
+                    } else {
                         Calendar calendar = Calendar.getInstance();
                         calendar.setTime(byId1.getVipEndTime());
                         calendar.add(Calendar.MONTH, time);
@@ -215,6 +216,7 @@
             e.printStackTrace();
         }
     }
+
     @ResponseBody
     @PostMapping("/base/wxPayBuyVip")
     public void wxPayBuyPackage(HttpServletRequest request, HttpServletResponse response) {
@@ -229,9 +231,9 @@
                 // 会员规格id
                 String s = out_trade_no.split("_")[0];
                 Integer integer = Integer.valueOf(s);
-                Integer time  = 0;
+                Integer time = 0;
                 for (TVipSet datum : managementClient.getVipSet1().getData()) {
-                    if (datum.getId() == integer){
+                    if (datum.getId() == integer) {
                         time = datum.getTime();
                     }
                 }
@@ -246,7 +248,7 @@
 
 
                 TUser byId1 = userService.getById(byId.getUserId());
-                if (byId1.getVipPayTime() == null){
+                if (byId1.getVipPayTime() == null) {
                     // 是否是首次充值会员
                     byId1.setVipPayTime(new Date());
                     Calendar calendar = Calendar.getInstance();
@@ -255,16 +257,16 @@
                     Date dateAfterOneMonth = calendar.getTime();
                     byId.setTime(dateAfterOneMonth);
                     byId1.setVipEndTime(dateAfterOneMonth);
-                }else{
+                } else {
                     // 不是首次 判断vipEndTime 是否到期 如果没有 加指定月份时间 如果到期了 将会员到期时间从当前增加指定月份
-                    if (byId1.getVipEndTime().getTime() < new Date().getTime()){
+                    if (byId1.getVipEndTime().getTime() < new Date().getTime()) {
                         Calendar calendar = Calendar.getInstance();
                         calendar.setTime(new Date());
                         calendar.add(Calendar.MONTH, time);
                         Date dateAfterOneMonth = calendar.getTime();
                         byId.setTime(dateAfterOneMonth);
                         byId1.setVipEndTime(dateAfterOneMonth);
-                    }else{
+                    } else {
                         Calendar calendar = Calendar.getInstance();
                         calendar.setTime(byId1.getVipEndTime());
                         calendar.add(Calendar.MONTH, time);
@@ -286,59 +288,55 @@
             e.printStackTrace();
         }
     }
+
     @PostMapping("/getPage")
     @ApiOperation(value = "获取注意事项", tags = {"家长端-注意事项"})
     public AjaxResult<String> getPage() {
         List<TPage> data = managementClient.getPage1().getData();
         for (TPage datum : data) {
-            if (datum.getType() == 4){
-                return AjaxResult.success(datum.getImg());
+            if (datum.getType() == 4) {
+                return AjaxResult.success(datum);
             }
         }
         return AjaxResult.success();
     }
+
     @PostMapping("/useGuide")
     @ApiOperation(value = "使用指南", tags = {"家长端-使用指南"})
     public AjaxResult<PageInfo<TUseGuide>> useGuide(@RequestBody UseGuideQuery query) {
         PageInfo<TUseGuide> data = managementClient.useGuide1(query).getData();
         return AjaxResult.success(data);
     }
+
     @PostMapping("/feedBack")
     @ApiOperation(value = "反馈", tags = {"家长端-意见反馈"})
     public AjaxResult feedBack(@RequestBody TFeedback dto) {
-        if (tokenService.getLoginUser1() == null){
-            return AjaxResult.tokenError("登录失效",new Object());
+        if (tokenService.getLoginUser1() == null) {
+            return AjaxResult.tokenError("登录失效", new Object());
         }
         LoginUserParent loginUser1 = tokenService.getLoginUser1();
         dto.setUserId(loginUser1.getUserid());
         managementClient.addFeedBack(dto);
         return AjaxResult.success("反馈成功");
     }
+
     @PostMapping("/parentLogin")
     @ApiOperation(value = "登录", tags = {"家长端-登录"})
     @ApiImplicitParams({
             @ApiImplicitParam(value = "手机号", name = "phone", dataType = "string", required = true),
             @ApiImplicitParam(value = "验证码", name = "phoneCode", dataType = "string", required = true)
     })
-    public AjaxResult login(String phone, String phoneCode)
-    {
+    public AjaxResult login(String phone, String phoneCode) {
         TUser tUser1 = userService.getOne(new QueryWrapper<TUser>()
                 .ne("state", 3)
-                .eq("phone",phone));
-        if (tUser1 != null){
-            if (tUser1.getState() == 2){
+                .eq("phone", phone));
+        if (tUser1 != null) {
+            if (tUser1.getState() == 2) {
                 return AjaxResult.error("登录失败,您的账号已被冻结!");
             }
-        }else{
+        } else {
             // todo 验证码校验
-            tUser1 = new TUser();
-            // 注册
-            tUser1.setName(phone);
-            tUser1.setAccount(phone);
-            tUser1.setState(1);
-            tUser1.setInsertTime(new Date());
-            tUser1.setCreateTime(new Date());
-            tUser1.setPhone(phone);
+            tUser1 = getUser(phone);
             userService.save(tUser1);
         }
         LoginUserParent loginUserParent = new LoginUserParent();
@@ -347,11 +345,79 @@
         loginUserParent.setPhone(tUser1.getPhone());
         loginUserParent.setLoginTime(new Date().getTime());
         HashMap<String, Object> map = new HashMap<>();
-        map.put("token",tokenService.createToken1(loginUserParent));
+        map.put("token", tokenService.createToken1(loginUserParent));
         // 获取登录token
         return AjaxResult.success(map);
     }
 
+    /**
+     * 学生端登录
+     *
+     * @param phoneRequest 手机号及手机验证码
+     */
+    @PostMapping("/studyLogin")
+    @ApiOperation(value = "学习端-登录", tags = {"学习端-登录"})
+    public AjaxResult studyLogin(@RequestBody @Validated RegisterPhoneRequest phoneRequest) {
+        String phone = phoneRequest.getPhone();
+        String phoneCode = phoneRequest.getPhoneCode();
+        TUser user = userService.getOne(new QueryWrapper<TUser>()
+                .ne("state", 3)
+                .eq("phone", phone));
+        if (user != null) {
+            if (user.getState() == 2) {
+                return AjaxResult.error("登录失败,您的账号已被冻结!");
+            }
+        } else {
+            // 手机验证码校验
+            Object redisPhoneCode = redisService.getCacheObject(RedisConstants.PHONE_CODE + phone);
+            if (null == redisPhoneCode) {
+                return AjaxResult.error("登录失败,手机验证码已过期!");
+            } else {
+                // redis 验证码的value 为 code:时间戳
+                String rCodeAndTime = String.valueOf(redisPhoneCode);
+                String rCode = rCodeAndTime.split(":")[0];
+                if (!rCode.equalsIgnoreCase(phoneCode)) {
+                    return AjaxResult.error("登录失败,手机验证码输入有误!");
+                } else {
+                    user = getUser(phone);
+                    userService.save(user);
+                }
+            }
+        }
+        // 生成登录用户信息
+        LoginUserParent loginUserParent = new LoginUserParent();
+        loginUserParent.setName(user.getName());
+        loginUserParent.setUserid(user.getId());
+        loginUserParent.setPhone(user.getPhone());
+        loginUserParent.setLoginTime(System.currentTimeMillis());
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("token", tokenService.createTokenStudy(loginUserParent));
+        // 获取登录token
+        return AjaxResult.success(map);
+    }
+
+    private TUser getUser(String phone) {
+        TUser user = new TUser();
+        // 注册
+        user.setName(phone);
+        user.setAccount(phone);
+        user.setState(1);
+        user.setInsertTime(new Date());
+        user.setCreateTime(new Date());
+        user.setPhone(phone);
+        return user;
+    }
+
+    /**
+     * 家长端 学习端都可用
+     *
+     * @param phone 手机号
+     */
+    @GetMapping("/sendPhoneCode")
+    @ApiOperation(value = "发送手机验证码", tags = {"家长端/学习端-发送手机验证码"})
+    public AjaxResult sendPhoneCode(@RequestParam String phone) {
+        return userService.phoneCode(phone) ? AjaxResult.success() : AjaxResult.error();
+    }
 
     @PostMapping("/deleteUser")
     @ApiOperation(value = "注销当前帐号", tags = {"家长端-个人中心"})
@@ -359,8 +425,8 @@
             @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header"),
     })
     public AjaxResult deleteUser() {
-        if (tokenService.getLoginUser1() == null){
-           return AjaxResult.tokenError("登录失效");
+        if (tokenService.getLoginUser1() == null) {
+            return AjaxResult.tokenError("登录失效");
         }
         Integer userid = tokenService.getLoginUser1().getUserid();
         TUser tUser = userService.getById(userid);
@@ -371,24 +437,25 @@
         userService.removeById(tUser);
         return AjaxResult.success("注销成功");
     }
+
     @PostMapping("/logout")
     @ApiOperation(value = "退出登录", tags = {"家长端-个人中心"})
     @ApiImplicitParams({
             @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header"),
     })
     public AjaxResult logout(HttpServletRequest request) {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return AjaxResult.tokenError("登录失效");
         }
         String token = SecurityUtils.getToken(request);
-        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(token))
-        {
+        if (com.ruoyi.common.core.utils.StringUtils.isNotEmpty(token)) {
             // 删除用户缓存记录
             AuthUtil.logoutByToken1(token);
         }
         // todo 清除token
         return AjaxResult.success("退出登录成功");
     }
+
     @PostMapping("/updateUserInfo")
     @ApiOperation(value = "修改个人资料", tags = {"家长端-个人中心"})
     @ApiImplicitParams({
@@ -397,40 +464,38 @@
             @ApiImplicitParam(name = "phone", value = "电话 改什么就只传什么"),
             @ApiImplicitParam(name = "headImg", value = "头像 改什么就只传什么"),
     })
-    public AjaxResult updateUserInfo(String name, String phone,String headImg) {
-        if (tokenService.getLoginUser1() == null){
-            return AjaxResult.tokenError("登录失效",new Object());
-        }
+    public AjaxResult updateUserInfo(String name, String phone, String headImg) {
         // todo 获取用户id
         Integer userid = tokenService.getLoginUser1().getUserid();
         TUser byId = userService.getById(userid);
 
-        if (StringUtils.hasLength(name)){
+        if (StringUtils.hasLength(name)) {
             byId.setName(name);
         }
-        if (StringUtils.hasLength(phone)){
+        if (StringUtils.hasLength(phone)) {
             // 先判断手机号是否和当前用户手机号一致
 //            if (byId == null){
 //                return AjaxResult.tokenError("登录失效");
 //            }
 
-            if (phone.equals(byId.getPhone())){
+            if (phone.equals(byId.getPhone())) {
                 return AjaxResult.error("更换的手机号不能和原手机号相同");
             }
             List<TUser> list = userService.list(new QueryWrapper<TUser>()
                     .eq("phone", phone)
                     .ne("state", 3));
-            if (list.size() > 0){
-                return AjaxResult.error("更换的手机号已被使用",new Object());
+            if (list.size() > 0) {
+                return AjaxResult.error("更换的手机号已被使用", new Object());
             }
             byId.setPhone(phone);
         }
-        if (StringUtils.hasLength(headImg)){
+        if (StringUtils.hasLength(headImg)) {
             byId.setHeadImg(headImg);
         }
         userService.updateById(byId);
         return AjaxResult.success("修改成功");
     }
+
     @PostMapping("/vipBack/{id}")
     @ApiOperation(value = "会员退款", tags = {"管理后台-会员退款"})
     public R vipBack(@PathVariable("id") Integer id) throws AlipayApiException {
@@ -439,11 +504,11 @@
         String transactionId = byId.getTransactionId();
         // 内部订单号
         String outTradeNo = byId.getOutTradeNo();
-        switch (byId.getPayType()){
+        switch (byId.getPayType()) {
             case 1:
-                 // 微信退款
+                // 微信退款
                 Map<String, String> stringStringMap = payMoneyUtil.wxRefund(transactionId, outTradeNo, byId.getMoney().toString(), byId.getMoney().toString(), "/base/wxRefund");
-                if (stringStringMap.get("code").equals("SUCCESS")){
+                if (stringStringMap.get("code").equals("SUCCESS")) {
                     byId.setPayState(3);
                     byId.setBackTime(new Date());
                     vipOrderService.updateById(byId);
@@ -460,12 +525,12 @@
                             .eq("payState", 2)
                             .orderByDesc("createTime"));
                     int size = list.size();
-                    if (size == 0){
+                    if (size == 0) {
                         // 证明这是用户第一次充值会员 将首次充值会员时间和会员到期时间清空
                         byId1.setVipEndTime(null);
                         byId1.setVipPayTime(null);
                         userService.updateById(byId1);
-                    }else{
+                    } else {
                         // 最近的一次充值会员时间
                         TVipOrder tVipOrder = list.get(0);
                         // 将会员到期时间回退到上一次
@@ -474,13 +539,13 @@
                     }
 
                     return R.ok();
-                }else{
+                } else {
                     return R.fail(stringStringMap.get("msg"));
                 }
             case 2:
                 // 支付宝退款
-                Map<String, String> stringStringMap1 = payMoneyUtil.aliRefund(transactionId,byId.getMoney().toString());
-                if (stringStringMap1.get("code").equals("10000")){
+                Map<String, String> stringStringMap1 = payMoneyUtil.aliRefund(transactionId, byId.getMoney().toString());
+                if (stringStringMap1.get("code").equals("10000")) {
                     byId.setPayState(3);
                     byId.setBackTime(new Date());
                     vipOrderService.updateById(byId);
@@ -497,12 +562,12 @@
                             .eq("payState", 2)
                             .orderByDesc("createTime"));
                     int size = list.size();
-                    if (size == 0){
+                    if (size == 0) {
                         // 证明这是用户第一次充值会员 将首次充值会员时间和会员到期时间清空
                         byId1.setVipEndTime(null);
                         byId1.setVipPayTime(null);
                         userService.updateById(byId1);
-                    }else{
+                    } else {
                         // 最近的一次充值会员时间
                         TVipOrder tVipOrder = list.get(0);
                         // 将会员到期时间回退到上一次
@@ -510,24 +575,25 @@
                         userService.updateById(byId1);
                     }
                     return R.ok();
-                }else{
+                } else {
                     return R.fail(stringStringMap1.get("msg"));
                 }
         }
         return R.ok();
     }
+
     @PostMapping("/userList")
     @ApiOperation(value = "用户列表", tags = {"管理后台-用户管理"})
     public R<PageInfo<AppUserVO>> couponReceive(@RequestBody AppUserQuery query) {
         PageInfo<AppUserVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize());
-        List<AppUserVO> list =  userService.listAll(query);
+        List<AppUserVO> list = userService.listAll(query);
         for (AppUserVO appUserVO : list) {
-            if (appUserVO.getVipEndTime() == null){
+            if (appUserVO.getVipEndTime() == null) {
                 appUserVO.setIsVip(0);
-            }else{
-                if (appUserVO.getVipEndTime().getTime() > System.currentTimeMillis()){
+            } else {
+                if (appUserVO.getVipEndTime().getTime() > System.currentTimeMillis()) {
                     appUserVO.setIsVip(1);
-                }else{
+                } else {
                     appUserVO.setIsVip(0);
                 }
             }
@@ -551,16 +617,16 @@
         Date insertTime = byId.getInsertTime();
         Date vipPayTime = byId.getVipPayTime();
         Date vipEndTime = byId.getVipEndTime();
-        if (vipEndTime == null){
+        if (vipEndTime == null) {
             res.setIsVip(0);
-        }else{
-            if (vipEndTime.getTime() > System.currentTimeMillis()){
+        } else {
+            if (vipEndTime.getTime() > System.currentTimeMillis()) {
                 res.setIsVip(1);
-            }else{
+            } else {
                 res.setIsVip(0);
             }
         }
-        if (vipPayTime!=null){
+        if (vipPayTime != null) {
             res.setVipPayTime(format.format(vipPayTime));
         }
         res.setState(byId.getState());
@@ -582,15 +648,16 @@
         res.setGameRecords(list);
         return R.ok(res);
     }
+
     @PostMapping("/freeze/{id}")
     @ApiOperation(value = "冻结/解冻", tags = {"管理后台-用户管理"})
-    public R freeze(@PathVariable("id")  Integer id) {
+    public R freeze(@PathVariable("id") Integer id) {
         TUser byId = userService.getById(id);
         if (byId.getState() == 1) {
             byId.setState(2);
             userService.updateById(byId);
             return R.ok("冻结成功");
-        }else {
+        } else {
             byId.setState(1);
             userService.updateById(byId);
             return R.ok("解冻成功");
@@ -602,7 +669,7 @@
     @ApiOperation(value = "列表查询", tags = {"管理后台-会员管理"})
     public R<PageInfo<VipOrderVO>> vipOrderList(@RequestBody AppUserQuery query) {
         PageInfo<VipOrderVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize());
-        List<VipOrderVO> list =  vipOrderService.listAll(query);
+        List<VipOrderVO> list = vipOrderService.listAll(query);
         res.setRecords(list);
         res.setTotal(list.size());
         return R.ok(res);

--
Gitblit v1.7.1