| | |
| | | import com.ruoyi.company.api.model.RegisterUser; |
| | | import com.ruoyi.system.api.model.AppUser; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @Tag(name = "用户登录", description = "用户登录") |
| | | public class TokenController |
| | | { |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | @PostMapping("companyLogin") |
| | | @Operation(summary = "用户登录接口",description = "账号/手机号登录") |
| | | public R<Map<String, Object>> companyLogin(@RequestBody RegisterUser registerUser) |
| | | { |
| | | // 用户登录 |
| | |
| | | String token = IdUtils.fastUUID(); |
| | | AppUser appUser = new AppUser(); |
| | | appUser.setUserId(user.getUserId()); |
| | | appUser.setAccountName(appUser.getAccountName()); |
| | | appUser.setPhone(appUser.getPhone()); |
| | | appUser.setLoginTime(LocalDateTime.now()); |
| | | appUser.setAccountName(user.getAccountName()); |
| | | appUser.setPhone(user.getPhone()); |
| | | appUser.setLoginTime(System.currentTimeMillis()); |
| | | appUser.setToken(token); |
| | | |
| | | // 根据uuid将loginUser缓存 |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("smsLogin") |
| | | @Operation(summary = "验证码登录",description = "验证码登录") |
| | | public R<Map<String, Object>> smsLogin(@RequestBody RegisterUser registerUser){ |
| | | String smsCode = registerUser.getSmsCode(); |
| | | if (!"999999".equals(smsCode)) { |
| | |
| | | * 重置密码 |
| | | */ |
| | | @PostMapping("resetPwd") |
| | | @Operation(summary = "重置密码",description = "重置密码") |
| | | public R<?> resetPwd(@RequestBody RegisterUser registerUser) |
| | | { |
| | | sysLoginService.resetPwd(registerUser); |