|
|
@ -27,6 +27,7 @@ import com.luoo.user.util.NickNameUtil;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.Result;
|
|
|
|
import api.Result;
|
|
|
|
import api.StatusCode;
|
|
|
|
import api.StatusCode;
|
|
|
|
|
|
|
|
import io.jsonwebtoken.Claims;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import util.IdWorker;
|
|
|
|
import util.IdWorker;
|
|
|
@ -106,7 +107,7 @@ public class UserController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
User user = userService.loginOrRegister(mobile);
|
|
|
|
User user = userService.loginOrRegister(mobile);
|
|
|
|
BeanUtils.copyProperties(user, userRespDTO);
|
|
|
|
BeanUtils.copyProperties(user, userRespDTO);
|
|
|
|
String token = jwtUtil.createJWT(user.getId(),user.getMobile(),"user");
|
|
|
|
String token = jwtUtil.createJWT(user.getId(),user.getNickname(),Constants.TOKEN_ROLE_APP_USER);
|
|
|
|
userRespDTO.setToken(token);
|
|
|
|
userRespDTO.setToken(token);
|
|
|
|
return Result.success(userRespDTO);
|
|
|
|
return Result.success(userRespDTO);
|
|
|
|
}finally {
|
|
|
|
}finally {
|
|
|
@ -120,8 +121,9 @@ public class UserController {
|
|
|
|
public Result<UserRespDTO> touristLogin() {
|
|
|
|
public Result<UserRespDTO> touristLogin() {
|
|
|
|
UserRespDTO userRespDTO=new UserRespDTO();
|
|
|
|
UserRespDTO userRespDTO=new UserRespDTO();
|
|
|
|
userRespDTO.setId(String.valueOf(idWorker.nextId()));
|
|
|
|
userRespDTO.setId(String.valueOf(idWorker.nextId()));
|
|
|
|
|
|
|
|
String nickName="游客-"+NickNameUtil.getRandomNickName();
|
|
|
|
userRespDTO.setNickname("游客-"+NickNameUtil.getRandomNickName());
|
|
|
|
userRespDTO.setNickname("游客-"+NickNameUtil.getRandomNickName());
|
|
|
|
String token = jwtUtil.createJWT(userRespDTO.getId(),"tourist","tourist");
|
|
|
|
String token = jwtUtil.createJWT(userRespDTO.getId(),nickName,Constants.TOKEN_ROLE_TOURIST);
|
|
|
|
userRespDTO.setToken(token);
|
|
|
|
userRespDTO.setToken(token);
|
|
|
|
return Result.success(userRespDTO);
|
|
|
|
return Result.success(userRespDTO);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -140,17 +142,12 @@ public class UserController {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* token 续期
|
|
|
|
* token 续期
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
@ApiOperation(value = "5.token 续期,有效期7天")
|
|
|
|
* @ApiOperation(value = "5.token 续期,默认token 有效期7天")
|
|
|
|
@PostMapping("/autoLogin/{token}")
|
|
|
|
*
|
|
|
|
@GlobalInterceptor
|
|
|
|
* @PostMapping("/autoLogin")
|
|
|
|
public Result<String> autoLogin(@PathVariable @VerifyParam(required = true) String token) {
|
|
|
|
*
|
|
|
|
return Result.success(userService.autoLogin(token));
|
|
|
|
* @GlobalInterceptor public Result<String>
|
|
|
|
}
|
|
|
|
* autoLogin(@PathVariable @VerifyParam(required=true,max=32) String deviceId,
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @PathVariable @VerifyParam(required=true,regex=VerifyRegexEnum.MOBILE)String
|
|
|
|
|
|
|
|
* mobile) { userService.sendSms(deviceId,mobile); return Result.success(); }
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取图行验证码
|
|
|
|
* 获取图行验证码
|
|
|
|