...
|
...
|
@@ -6,8 +6,10 @@ import com.xkl.authorization.annotation.Sign; |
|
|
import com.xkl.authorization.manager.ITokenManager;
|
|
|
import com.xkl.config.ResultStatus;
|
|
|
import com.xkl.domain.User;
|
|
|
import com.xkl.domain.XklMemberEntity;
|
|
|
import com.xkl.model.ResultModel;
|
|
|
import com.xkl.repository.UserRepository;
|
|
|
import com.xkl.repository.XklMemberRespository;
|
|
|
import com.xkl.security.AntiXSS;
|
|
|
import com.wordnik.swagger.annotations.ApiImplicitParam;
|
|
|
import com.wordnik.swagger.annotations.ApiImplicitParams;
|
...
|
...
|
@@ -34,11 +36,13 @@ public class UserInfoController { |
|
|
private UserRepository userRepository;
|
|
|
@Autowired
|
|
|
private ITokenManager tokenManager;
|
|
|
@Autowired
|
|
|
private XklMemberRespository xklMemberRespository;
|
|
|
|
|
|
@AntiXSS
|
|
|
//@Sign
|
|
|
@RequestMapping(method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "注册")
|
|
|
@ApiOperation(value = "用户注册接口")
|
|
|
public ResponseEntity<ResultModel> register(HttpServletRequest request,@RequestParam String username, @RequestParam String password,
|
|
|
@RequestParam String sign,@RequestParam long t,@RequestParam int type) {
|
|
|
Assert.notNull(username, "username can not be empty");
|
...
|
...
|
@@ -51,7 +55,10 @@ public class UserInfoController { |
|
|
String salt= SecurityTool.genSalt();
|
|
|
String pass=SecurityTool.getPassword(username,password,salt);
|
|
|
user = new User();
|
|
|
user.setMember_id(123);
|
|
|
/**
|
|
|
* TODO:暂时都为1
|
|
|
*/
|
|
|
user.setMember_id(1);
|
|
|
user.setUsername(username);
|
|
|
user.setPassword(pass);
|
|
|
user.setSalt(salt);
|
...
|
...
|
@@ -66,7 +73,7 @@ public class UserInfoController { |
|
|
@AntiXSS
|
|
|
//@Sign
|
|
|
@RequestMapping(method = RequestMethod.PUT)
|
|
|
@ApiOperation(value = "修改用户密码")
|
|
|
@ApiOperation(value = "用户密码修改接口")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
|
|
|
})
|
...
|
...
|
@@ -84,13 +91,15 @@ public class UserInfoController { |
|
|
|
|
|
@RequestMapping(method = RequestMethod.GET)
|
|
|
@Authorization
|
|
|
@ApiOperation(value = "获取用户id")
|
|
|
@ApiOperation(value = "个人信息查询接口")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
|
|
|
})
|
|
|
public ResponseEntity<ResultModel> getUserNickName(@CurrentUser User user) {
|
|
|
public ResponseEntity<ResultModel> getUserInfo(HttpServletRequest request,@CurrentUser User user,
|
|
|
@RequestParam String sign,@RequestParam long t,@RequestParam int type) {
|
|
|
long member_id=user.getMember_id();
|
|
|
return new ResponseEntity<>(ResultModel.ok(member_id), HttpStatus.OK);
|
|
|
XklMemberEntity xklMemberEntity=xklMemberRespository.findOne(member_id);
|
|
|
return new ResponseEntity<>(ResultModel.ok(xklMemberEntity), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|