xuhy
昨天 c45c2087783863d127f38aa8fc8a3dcc0acd744f
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -15,17 +15,17 @@
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysMenuService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.web.controller.tool.MsgUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
 * 登录验证
@@ -50,8 +50,6 @@
    private TokenService tokenService;
    @Autowired
    private ISysRoleService roleService;
    @Autowired
    private MsgUtils msgUtils;
    /**
     * 账号密码登录
@@ -116,23 +114,23 @@
     * @param phone 手机号
     * @return 结果
     */
    @ApiOperation(value = "获取验证码",notes = "获取验证码")
    @GetMapping("/getCode")
    public AjaxResult getCode(@RequestParam String phone)
    {
        // 发送验证码并存储到redis
        if (StringUtils.hasLength(phone)) {
            String code = String.valueOf((int) (Math.random() * 1000000));
            redisCache.setCacheObject(phone, code,5*60,TimeUnit.SECONDS);
            try {
                msgUtils.sendMsg(phone, code);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            return AjaxResult.success("发送短信验证码成功!5分钟内有效");
        }
        return AjaxResult.error(500, "发送短信验证码失败,请确认手机号码!");
    }
//    @ApiOperation(value = "获取验证码",notes = "获取验证码")
//    @GetMapping("/getCode")
//    public AjaxResult getCode(@RequestParam String phone)
//    {
//        // 发送验证码并存储到redis
//        if (StringUtils.hasLength(phone)) {
//            String code = String.valueOf((int) (Math.random() * 1000000));
//            redisCache.setCacheObject(phone, code,5*60,TimeUnit.SECONDS);
//            try {
//                msgUtils.sendMsg(phone, code);
//            } catch (Exception e) {
//                throw new RuntimeException(e);
//            }
//            return AjaxResult.success("发送短信验证码成功!5分钟内有效");
//        }
//        return AjaxResult.error(500, "发送短信验证码失败,请确认手机号码!");
//    }
    /**
     * 获取用户信息