Browse Source

api access token dev update

pull/2/head
qiaozhanwei 6 years ago
parent
commit
5d23ba710e
  1. 25
      escheduler-api/src/main/java/cn/escheduler/api/controller/AccessTokenController.java
  2. 14
      escheduler-dao/src/main/java/cn/escheduler/dao/model/AccessToken.java

25
escheduler-api/src/main/java/cn/escheduler/api/controller/AccessTokenController.java

@ -141,4 +141,29 @@ public class AccessTokenController extends BaseController{
}
}
/**
* update token
* @param loginUser
* @return
*/
@PostMapping(value = "/update")
@ResponseStatus(HttpStatus.CREATED)
public Result updateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id,
@RequestParam(value = "userId") int userId,
@RequestParam(value = "expireTime") String expireTime,
@RequestParam(value = "token") String token){
logger.info("login user {}, update token , userId : {} , token expire time : {} , token : {}", loginUser.getUserName(),
userId,expireTime,token);
try {
Map<String, Object> result = accessTokenService.updateToken(id,userId, expireTime, token);
return returnDataList(result);
}catch (Exception e){
logger.error(CREATE_ACCESS_TOKEN_ERROR.getMsg(),e);
return error(CREATE_ACCESS_TOKEN_ERROR.getCode(), CREATE_ACCESS_TOKEN_ERROR.getMsg());
}
}
}

14
escheduler-dao/src/main/java/cn/escheduler/dao/model/AccessToken.java

@ -30,6 +30,11 @@ public class AccessToken {
*/
private int userId;
/**
* user name
*/
private String userName;
/**
* user token
*/
@ -98,11 +103,20 @@ public class AccessToken {
this.updateTime = updateTime;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public String toString() {
return "AccessToken{" +
"id=" + id +
", userId=" + userId +
", userName='" + userName + '\'' +
", token='" + token + '\'' +
", expireTime=" + expireTime +
", createTime=" + createTime +

Loading…
Cancel
Save