|
@@ -489,7 +489,6 @@ public class MemberServiceImpl implements MemberService {
|
|
|
return memberId;
|
|
|
}
|
|
|
|
|
|
- //todo 先做绑定第三方账号
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = BackendRuntimeException.class)
|
|
|
public BindAccountVo bindAccount(BindAccountParam param) {
|
|
@@ -499,6 +498,8 @@ public class MemberServiceImpl implements MemberService {
|
|
|
Members currentUser = getCurrentUser();
|
|
|
BeanUtils.copyProperties(currentUser,memberVo);
|
|
|
memberVo.setStatus("verified");
|
|
|
+ bindAccountVo.setMember(memberVo);
|
|
|
+
|
|
|
String provider = param.getProvider();
|
|
|
if("phone".equals(provider)){
|
|
|
String phone = param.getPhone();
|
|
@@ -537,18 +538,58 @@ public class MemberServiceImpl implements MemberService {
|
|
|
} else{
|
|
|
//绑定第三方账号
|
|
|
String accountId = socialAccountService.bindSocialAccount(currentUser,param);
|
|
|
+ SocialAccounts socialAccounts = socialAccountService.selectByAccountId(accountId);
|
|
|
+ BeanUtils.copyProperties(socialAccounts,socialAccountVo);
|
|
|
+ bindAccountVo.setSocialAccount(socialAccountVo);
|
|
|
}
|
|
|
+ return bindAccountVo;
|
|
|
+ }
|
|
|
|
|
|
- SocialAccounts socialAccounts = socialAccountService.selectByMemberId(currentUser.getId(), ProviderEnum.getCodeByName(provider));
|
|
|
- BeanUtils.copyProperties(socialAccounts,socialAccountVo);
|
|
|
+ @Override
|
|
|
+ public BindAccountVo unbindAccount(BindAccountParam param) {
|
|
|
+ BindAccountVo bindAccountVo = new BindAccountVo();
|
|
|
+ MemberVo memberVo = new MemberVo();
|
|
|
+ SocialAccountVo accountVo = new SocialAccountVo();
|
|
|
|
|
|
+ Members currentUser = getCurrentUser();
|
|
|
+ BeanUtils.copyProperties(currentUser,memberVo);
|
|
|
+ memberVo.setStatus("verified");
|
|
|
bindAccountVo.setMember(memberVo);
|
|
|
- bindAccountVo.setSocialAccount(socialAccountVo);
|
|
|
+
|
|
|
+ String provider = param.getProvider();
|
|
|
+ if("phone".equals(provider)){
|
|
|
+ currentUser.setPhone("");
|
|
|
+ update(currentUser);
|
|
|
+ } else {
|
|
|
+ String accountId = socialAccountService.unbindSocialAccount(currentUser,param);
|
|
|
+ SocialAccounts socialAccounts = socialAccountService.selectByAccountId(accountId);
|
|
|
+ BeanUtils.copyProperties(socialAccounts,accountVo);
|
|
|
+ bindAccountVo.setSocialAccount(accountVo);
|
|
|
+ }
|
|
|
return bindAccountVo;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public BindAccountVo unbindAccount(BindAccountParam param) {
|
|
|
- return null;
|
|
|
+ public MemberVo appModifyName(String name) {
|
|
|
+ modifyNickname(name);
|
|
|
+ Members currentUser = getCurrentUser();
|
|
|
+ return createMemberVo(currentUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 返回一个memberVo对象
|
|
|
+ * @param member 当前用户
|
|
|
+ * @return memberVo
|
|
|
+ */
|
|
|
+ public MemberVo createMemberVo(Members member){
|
|
|
+ MemberVo vo = new MemberVo();
|
|
|
+ BeanUtils.copyProperties(member,vo);
|
|
|
+ AvatarsExample example = new AvatarsExample();
|
|
|
+ example.createCriteria().andMemberIdEqualTo(member.getId());
|
|
|
+ List<Avatars> avatars = avatarsMapper.selectByExample(example);
|
|
|
+ if(!CollectionUtils.isEmpty(avatars)){
|
|
|
+ vo.setAvatarUrl(avatars.get(0).getAvatar());
|
|
|
+ }
|
|
|
+ return vo;
|
|
|
}
|
|
|
}
|