个人中心接口调整
This commit is contained in:
parent
7fac900ba1
commit
d6922e31dc
|
|
@ -26,8 +26,9 @@ public class UserController {
|
||||||
@ApiOperation(value="个人中心")
|
@ApiOperation(value="个人中心")
|
||||||
public AjaxResult<UserCenterVo> center() {
|
public AjaxResult<UserCenterVo> center() {
|
||||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||||
|
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||||
|
|
||||||
UserCenterVo vo = iUserService.center(userId);
|
UserCenterVo vo = iUserService.center(userId, terminal);
|
||||||
return AjaxResult.success(vo);
|
return AjaxResult.success(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,21 +95,20 @@ public class UserController {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/bindMnp")
|
@PostMapping("/bindMnp")
|
||||||
@ApiOperation(value="绑定小程序")
|
@ApiOperation(value="绑定小程序")
|
||||||
public AjaxResult<Object> bindMnp(@Validated @RequestBody UserBindWechatValidate BindMnpValidate) {
|
public AjaxResult<Object> bindMnp(@Validated @RequestBody UserBindWechatValidate BindMnpValidate) {
|
||||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||||
|
|
||||||
iUserService.bindMnp(BindMnpValidate, userId);
|
iUserService.bindMnp(BindMnpValidate, userId);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/bindOa")
|
@PostMapping("/bindOa")
|
||||||
@ApiOperation(value="绑定微信公众号")
|
@ApiOperation(value="绑定微信公众号")
|
||||||
public AjaxResult<Object> bindOa(@Validated @RequestBody UserBindWechatValidate BindOaValidate) {
|
public AjaxResult<Object> bindOa(@Validated @RequestBody UserBindWechatValidate BindOaValidate) {
|
||||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||||
|
|
||||||
iUserService.bindOa(BindOaValidate, userId);
|
iUserService.bindOa(BindOaValidate, userId);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@ public interface IUserService {
|
||||||
*
|
*
|
||||||
* @author fzr
|
* @author fzr
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
|
* @param terminal 用户终端
|
||||||
* @return UserCenterVo
|
* @return UserCenterVo
|
||||||
*/
|
*/
|
||||||
UserCenterVo center(Integer userId);
|
UserCenterVo center(Integer userId, Integer terminal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 个人信息
|
* 个人信息
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class UserServiceImpl implements IUserService {
|
||||||
* @return UserCenterVo
|
* @return UserCenterVo
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public UserCenterVo center(Integer userId) {
|
public UserCenterVo center(Integer userId, Integer terminal) {
|
||||||
User user = userMapper.selectOne(new QueryWrapper<User>()
|
User user = userMapper.selectOne(new QueryWrapper<User>()
|
||||||
.select("id,sn,avatar,real_name,nickname,username,mobile,is_new")
|
.select("id,sn,avatar,real_name,nickname,username,mobile,is_new")
|
||||||
.eq("id", userId)
|
.eq("id", userId)
|
||||||
|
|
@ -66,6 +66,16 @@ public class UserServiceImpl implements IUserService {
|
||||||
vo.setAvatar(UrlUtils.toAbsoluteUrl(user.getAvatar()));
|
vo.setAvatar(UrlUtils.toAbsoluteUrl(user.getAvatar()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vo.setIsBindWechat(false);
|
||||||
|
if (terminal.equals(ClientEnum.OA.getCode()) || terminal.equals(ClientEnum.MNP.getCode())) {
|
||||||
|
UserAuth userAuth = userAuthMapper.selectOne(new QueryWrapper<UserAuth>()
|
||||||
|
.select("id,openid,terminal")
|
||||||
|
.eq("user_id", userId)
|
||||||
|
.eq("terminal", terminal)
|
||||||
|
.last("limit 1"));
|
||||||
|
vo.setIsBindWechat(userAuth != null);
|
||||||
|
}
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,8 @@ public class UserCenterVo implements Serializable {
|
||||||
@ApiModelProperty(value = "是否新用户")
|
@ApiModelProperty(value = "是否新用户")
|
||||||
private Integer isNew;
|
private Integer isNew;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否绑定微信")
|
||||||
|
private Boolean isBindWechat;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue