bug 修改
This commit is contained in:
parent
d991c59ba7
commit
ff8fd57c16
|
|
@ -3,6 +3,7 @@ package com.bonus.auth.controller;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
|
|
@ -33,6 +34,18 @@ public class TokenController {
|
|||
@Autowired
|
||||
private SysLoginService sysLoginService;
|
||||
|
||||
@PostMapping("isLogin")
|
||||
public R<?> isLogin(@RequestBody LoginBody form) {
|
||||
LoginUser userInfo;
|
||||
if ("mobile".equals(form.getLoginType())) {
|
||||
userInfo = sysLoginService.login(form.getMobile(), form.getPassword(), form.getLoginType());
|
||||
} else {
|
||||
userInfo = sysLoginService.login(form.getUsername(), form.getPassword(), form.getLoginType());
|
||||
}
|
||||
SysUser sysUser = userInfo.getSysUser();
|
||||
return R.ok(tokenService.isLogin(String.valueOf(sysUser.getUserId())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
*
|
||||
|
|
@ -72,10 +85,15 @@ public class TokenController {
|
|||
try {
|
||||
String token = SecurityUtils.getToken(request);
|
||||
if (StringUtils.isNotEmpty(token)) {
|
||||
String key = JwtUtils.getUserKey(token);
|
||||
boolean key1 = tokenService.isKey(key);
|
||||
if (key1) {
|
||||
String username = JwtUtils.getUserName(token);
|
||||
String userId = JwtUtils.getUserId(token);
|
||||
AuthUtil.logoutByToken(token);
|
||||
tokenService.delExistingToken(Long.valueOf(userId));
|
||||
sysLoginService.logout(username, userId);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue