响应参数新增微信头像,绑定手机号新增密码

This commit is contained in:
yiyan 2019-12-21 15:57:32 +08:00
parent 6259645d6c
commit cfd63d829d
4 changed files with 30 additions and 9 deletions

View File

@ -115,8 +115,8 @@ public class UsersAction {
* @return
*/
@RequestMapping(value="/bindPhone",method=RequestMethod.GET)
public JsonResult<?> bindPhone(String unionId, String phoneNum) {
return userService.bindPhone(unionId, phoneNum);
public JsonResult<?> bindPhone(String unionId, String phoneNum, String password) {
return userService.bindPhone(unionId, phoneNum, password);
}
/**

View File

@ -137,6 +137,8 @@ public class User implements Serializable{
@Column(name = "wechat_unionid")
private String wechatUnionid;
private String wechatImgUrl;
/**
* 修改时间
*/
@ -302,4 +304,12 @@ public class User implements Serializable{
public void setWechatUnionid(String wechatUnionid) {
this.wechatUnionid = wechatUnionid;
}
public String getWechatImgUrl() {
return wechatImgUrl;
}
public void setWechatImgUrl(String wechatImgUrl) {
this.wechatImgUrl = wechatImgUrl;
}
}

View File

@ -58,7 +58,7 @@ public interface UserService {
* @param phone
* @return
*/
public JsonResult<?> bindPhone(String unionId, String phone);
public JsonResult<?> bindPhone(String unionId, String phone, String password);
/**
* 更多用户数据信息

View File

@ -319,6 +319,8 @@ public class UserServiceImpl implements UserService {
if (wechatUserInfo == null || wechatUserInfo.size() == 2) {
throw new IfishException(ResultEnum.error403);
}
//微信头像
String headimgurl = wechatUserInfo.getString("headimgurl");
//用户信息
User user = userDao.findUniqueByProperty(Restrictions.eq("wechatUnionid",wechatUserInfo.getString("unionid")));
if (user == null) {
@ -387,6 +389,8 @@ public class UserServiceImpl implements UserService {
/**
* 登录返回信息
*/
//微信头像
user.setWechatImgUrl(headimgurl);
//用户信息
json.put("user", getUserInfo(user,gwellParam));
//用户资产
@ -484,7 +488,7 @@ public class UserServiceImpl implements UserService {
}
@Override
public JsonResult<?> bindPhone(String unionId, String phone) {
public JsonResult<?> bindPhone(String unionId, String phone, String password) {
if (unionId == null || phone == null) {
throw new IfishException(ResultEnum.error401);
}
@ -495,7 +499,8 @@ public class UserServiceImpl implements UserService {
}
User userPhone = userDao.findUniqueByProperty(Restrictions.eq("phoneNumber",phone));
if (userPhone == null) {
throw new IfishException(ResultEnum.fail101);
userWechat.setPhoneNumber(phone);
userWechat.setUserPassword(password);
}
List<DeviceUser> deviceUserListWechat = deviceUserDao.findByProperty(Restrictions.eq("priId.userId", userWechat.getUserId()));
List<DeviceUser> deviceUserListPhone = deviceUserDao.findByProperty(Restrictions.eq("priId.userId", userPhone.getUserId()));
@ -551,10 +556,15 @@ public class UserServiceImpl implements UserService {
// tbl_Camera_User_Mapper.updateCameraUserId(userPhone.getUserId(), Integer.valueOf(cameraUser.getCameraUserId().getCameraId()));
}
}
//修改手机账号的微信unionid
userPhone.setWechatUnionid(userWechat.getWechatUnionid());
userDao.update(userPhone);
userDao.delete(userWechat);
if (userPhone != null) {
//修改手机账号的微信unionid
userPhone.setWechatUnionid(userWechat.getWechatUnionid());
userDao.update(userPhone);
userDao.delete(userWechat);
} else {
userDao.update(userWechat);
}
//用户资产信息
UserAssetDto userAssetDtoWechat = getUserAssetInfo(userWechat.getUserId());
UserAssetDto userAssetDtoPhone = getUserAssetInfo(userPhone.getUserId());
@ -1277,6 +1287,7 @@ public class UserServiceImpl implements UserService {
json.put("gwellUserID", user.getGwellUserID());
json.put("neteaseToken", user.getNeteaseToken());
json.put("userType", user.getUserType());
json.put("wechatImgUrl", user.getWechatImgUrl());
json.put("shopsUserId", user.getShopsUserId());
return json;
}