| | |
| | | package com.project.admin.controller.system; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 com.project.common.annotation.RepeatSubmit; |
| | | import com.project.common.constant.Constants; |
| | | import com.project.common.core.domain.AjaxResult; |
| | | import com.project.common.core.domain.entity.SysMenu; |
| | |
| | | import com.project.common.utils.SecurityUtils; |
| | | import com.project.framework.web.service.SysLoginService; |
| | | import com.project.framework.web.service.SysPermissionService; |
| | | import com.project.system.domain.bo.editBo.UserPhoneLoginBo; |
| | | import com.project.system.service.ISysMenuService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 登录验证 |
| | |
| | | * @author project |
| | | */ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class SysLoginController |
| | | { |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | private final SysLoginService loginService; |
| | | private final ISysMenuService menuService; |
| | | private final SysPermissionService permissionService; |
| | | |
| | | /** |
| | | * 登录方法 |
| | |
| | | return ajax; |
| | | } |
| | | |
| | | @ApiOperation("获取验证码") |
| | | @GetMapping("/verify/get") |
| | | @RepeatSubmit |
| | | public AjaxResult getVerifyCode(@RequestParam("phone") String phone) |
| | | { |
| | | return AjaxResult.success(loginService.getVerifyCode(phone)); |
| | | } |
| | | |
| | | @ApiOperation("新注册获取验证码") |
| | | @GetMapping("/verify/getNew") |
| | | @RepeatSubmit |
| | | public AjaxResult getVerifyCodeNew(@RequestParam("phone") String phone) |
| | | { |
| | | return AjaxResult.success(loginService.getVerifyCodeNew(phone)); |
| | | } |
| | | |
| | | @ApiOperation("校验验证码") |
| | | @PostMapping("/verify/check") |
| | | @RepeatSubmit |
| | | public AjaxResult verify(@RequestBody UserPhoneLoginBo bo) |
| | | { |
| | | return AjaxResult.success(loginService.verifyPhone(bo.getPhone(), bo.getCode())); |
| | | } |
| | | |
| | | @ApiOperation("验证码登录") |
| | | @PostMapping("/verify/login") |
| | | @RepeatSubmit |
| | | public AjaxResult phoneLogin(@RequestBody UserPhoneLoginBo bo) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | String token = loginService.phoneLogin(bo); |
| | | ajax.put(Constants.TOKEN, token); |
| | | return ajax; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | @GetMapping("getInfo") |
| | | @GetMapping("/getInfo") |
| | | public AjaxResult getInfo() |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | |
| | | * |
| | | * @return 路由信息 |
| | | */ |
| | | @GetMapping("getRouters") |
| | | @GetMapping("/getRouters") |
| | | public AjaxResult getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |