From 94f2a489e088f4b838cc560e9777263ee47f55b8 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 29 May 2021 15:09:18 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cweb/config/AuthConfig.java | 1 + .../controller/HighUserCommonController.java | 7 +- .../cweb/controller/HighUserController.java | 2 +- .../com/cweb/controller/WechatController.java | 33 ++--- .../main/java/com/hai/dao/HighUserMapper.java | 10 +- .../java/com/hai/dao/HighUserSqlProvider.java | 28 ++++ .../main/java/com/hai/entity/HighUser.java | 34 ++++- .../java/com/hai/entity/HighUserExample.java | 140 ++++++++++++++++++ .../java/com/hai/service/HighUserService.java | 7 + .../hai/service/impl/HighUserServiceImpl.java | 17 ++- 10 files changed, 248 insertions(+), 31 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 3913d329..804c8e45 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -104,6 +104,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/highMerchantStore/getStoreListByMerchant") .excludePathPatterns("/sms/sendSmsCode") .excludePathPatterns("/sms/getSmsCode") + .excludePathPatterns("/user/login") .excludePathPatterns("/wechat/*") ; } diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java index 15447231..f5a3e3a5 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java @@ -8,10 +8,7 @@ import com.cweb.config.WxMaConfiguration; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; -import com.hai.common.security.SessionObject; -import com.hai.common.security.UserCenter; -import com.hai.common.security.VerifyCode; -import com.hai.common.security.VerifyCodeStorage; +import com.hai.common.security.*; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.HighUser; import com.hai.model.HighUserModel; @@ -77,7 +74,7 @@ public class HighUserCommonController { HighUserModel highUserModel = new HighUserModel(); user.setPassword(null); highUserModel.setHighUser(user); - SessionObject so = new SessionObject(user.getOpenId(), 1 , highUserModel); + SessionObject so = new SessionObject(Base64Util.encode(user.getId().toString()), 1 , highUserModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); } catch (Exception e) { diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java index 252a9c0a..c1ec9739 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -104,7 +104,7 @@ public class HighUserController { HighUserModel highUserModel = new HighUserModel(); highUser.setPassword(null); highUserModel.setHighUser(highUser); - SessionObject so = new SessionObject(highUser.getOpenId(), 1 , highUserModel); + SessionObject so = new SessionObject(highUser.getUnionId(), 1 , highUserModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 6e5bee61..e6084174 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -98,8 +98,7 @@ public class WechatController { HighUserModel loginDataModel = new HighUserModel(); highUser.setPassword(null); loginDataModel.setHighUser(highUser); - - SessionObject so = new SessionObject(openId, 99 , loginDataModel); + SessionObject so = new SessionObject(highUser.getUnionId(), 1 , loginDataModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); @@ -135,26 +134,15 @@ public class WechatController { if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) { throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败"); } - HighUser user = highUserService.findByOpenId(openId); - if (user == null) { - user = new HighUser(); - user.setOpenId(openId); - user.setRegTime(new Date()); - user.setStatus(1); - user.setGold(0); - user.setPhone(phoneNoInfo.getPurePhoneNumber()); - highUserService.insertUser(user); - } else { - user.setPhone(phoneNoInfo.getPurePhoneNumber()); - highUserService.updateUser(user); - } + + HighUser user = highUserService.bindUserPhone(phoneNoInfo.getPurePhoneNumber(), request); // 定义个人所有数据 HighUserModel highUserModel = new HighUserModel(); user.setPassword(null); highUserModel.setHighUser(user); - SessionObject so = new SessionObject(openId, 1 , highUserModel); + SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); @@ -187,13 +175,13 @@ public class WechatController { final WxMaService wxService = WxMaConfiguration.getMaService(); WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(sessionKey, encryptedData, iv); - System.out.println(""); if (userInfo == null) { throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败"); } - HighUser user = highUserService.findByOpenId(openId); + HighUser user = highUserService.findByUnionId(userInfo.getUnionId()); if (user == null) { user = new HighUser(); + user.setUnionId(userInfo.getUnionId()); user.setOpenId(openId); user.setRegTime(new Date()); user.setStatus(1); @@ -212,7 +200,7 @@ public class WechatController { user.setPassword(null); highUserModel.setHighUser(user); - SessionObject so = new SessionObject(openId, 1 , highUserModel); + SessionObject so = new SessionObject(userInfo.getUnionId(), 1 , highUserModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); @@ -301,10 +289,11 @@ public class WechatController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信用户信息失败"); } - HighUser user = highUserService.findByOpenId(openid); + HighUser user = highUserService.findByUnionId(userInfo.getString("unionid")); if (user == null) { user = new HighUser(); - user.setOpenId(openid); + user.setUnionId(userInfo.getString("unionid")); + user.setOpenIdH5(openid); user.setRegTime(new Date()); user.setStatus(1); user.setGold(0); @@ -321,7 +310,7 @@ public class WechatController { HighUserModel highUserModel = new HighUserModel(); user.setPassword(null); highUserModel.setHighUser(user); - SessionObject so = new SessionObject(openid, 1 , highUserModel); + SessionObject so = new SessionObject(userInfo.getString("unionid"), 1 , highUserModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); diff --git a/hai-service/src/main/java/com/hai/dao/HighUserMapper.java b/hai-service/src/main/java/com/hai/dao/HighUserMapper.java index 6a25c5e0..080e2ff2 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserMapper.java @@ -43,12 +43,14 @@ public interface HighUserMapper extends HighUserMapperExt { "phone, `password`, ", "sex, birthdate, reg_time, ", "gold, `status`, open_id, ", + "open_id_h5, union_id, ", "ext_1, ext_2, ext_3, ", "ext_4)", "values (#{headerImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ", "#{phone,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, ", "#{sex,jdbcType=VARCHAR}, #{birthdate,jdbcType=DATE}, #{regTime,jdbcType=TIMESTAMP}, ", "#{gold,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, ", + "#{openIdH5,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR}, ", "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", "#{ext4,jdbcType=VARCHAR})" }) @@ -72,6 +74,8 @@ public interface HighUserMapper extends HighUserMapperExt { @Result(column="gold", property="gold", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), + @Result(column="open_id_h5", property="openIdH5", jdbcType=JdbcType.VARCHAR), + @Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), @@ -82,7 +86,7 @@ public interface HighUserMapper extends HighUserMapperExt { @Select({ "select", "id, header_img, `name`, phone, `password`, sex, birthdate, reg_time, gold, `status`, ", - "open_id, ext_1, ext_2, ext_3, ext_4", + "open_id, open_id_h5, union_id, ext_1, ext_2, ext_3, ext_4", "from high_user", "where id = #{id,jdbcType=BIGINT}" }) @@ -98,6 +102,8 @@ public interface HighUserMapper extends HighUserMapperExt { @Result(column="gold", property="gold", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), + @Result(column="open_id_h5", property="openIdH5", jdbcType=JdbcType.VARCHAR), + @Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), @@ -126,6 +132,8 @@ public interface HighUserMapper extends HighUserMapperExt { "gold = #{gold,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},", "open_id = #{openId,jdbcType=VARCHAR},", + "open_id_h5 = #{openIdH5,jdbcType=VARCHAR},", + "union_id = #{unionId,jdbcType=VARCHAR},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", "ext_3 = #{ext3,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java index a89a4675..5fdbe9a6 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java @@ -68,6 +68,14 @@ public class HighUserSqlProvider { sql.VALUES("open_id", "#{openId,jdbcType=VARCHAR}"); } + if (record.getOpenIdH5() != null) { + sql.VALUES("open_id_h5", "#{openIdH5,jdbcType=VARCHAR}"); + } + + if (record.getUnionId() != null) { + sql.VALUES("union_id", "#{unionId,jdbcType=VARCHAR}"); + } + if (record.getExt1() != null) { sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); } @@ -104,6 +112,8 @@ public class HighUserSqlProvider { sql.SELECT("gold"); sql.SELECT("`status`"); sql.SELECT("open_id"); + sql.SELECT("open_id_h5"); + sql.SELECT("union_id"); sql.SELECT("ext_1"); sql.SELECT("ext_2"); sql.SELECT("ext_3"); @@ -169,6 +179,14 @@ public class HighUserSqlProvider { sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}"); } + if (record.getOpenIdH5() != null) { + sql.SET("open_id_h5 = #{record.openIdH5,jdbcType=VARCHAR}"); + } + + if (record.getUnionId() != null) { + sql.SET("union_id = #{record.unionId,jdbcType=VARCHAR}"); + } + if (record.getExt1() != null) { sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); } @@ -204,6 +222,8 @@ public class HighUserSqlProvider { sql.SET("gold = #{record.gold,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}"); + sql.SET("open_id_h5 = #{record.openIdH5,jdbcType=VARCHAR}"); + sql.SET("union_id = #{record.unionId,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); @@ -258,6 +278,14 @@ public class HighUserSqlProvider { sql.SET("open_id = #{openId,jdbcType=VARCHAR}"); } + if (record.getOpenIdH5() != null) { + sql.SET("open_id_h5 = #{openIdH5,jdbcType=VARCHAR}"); + } + + if (record.getUnionId() != null) { + sql.SET("union_id = #{unionId,jdbcType=VARCHAR}"); + } + if (record.getExt1() != null) { sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighUser.java b/hai-service/src/main/java/com/hai/entity/HighUser.java index 6a8c6916..d9c40b9d 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUser.java +++ b/hai-service/src/main/java/com/hai/entity/HighUser.java @@ -67,6 +67,16 @@ public class HighUser extends UserModel implements Serializable { private String openId; + /** + * H5openId + */ + private String openIdH5; + + /** + * 微信·开放平台 + */ + private String unionId; + private String ext1; private String ext2; @@ -165,6 +175,22 @@ public class HighUser extends UserModel implements Serializable { this.openId = openId; } + public String getOpenIdH5() { + return openIdH5; + } + + public void setOpenIdH5(String openIdH5) { + this.openIdH5 = openIdH5; + } + + public String getUnionId() { + return unionId; + } + + public void setUnionId(String unionId) { + this.unionId = unionId; + } + public String getExt1() { return ext1; } @@ -220,6 +246,8 @@ public class HighUser extends UserModel implements Serializable { && (this.getGold() == null ? other.getGold() == null : this.getGold().equals(other.getGold())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId())) + && (this.getOpenIdH5() == null ? other.getOpenIdH5() == null : this.getOpenIdH5().equals(other.getOpenIdH5())) + && (this.getUnionId() == null ? other.getUnionId() == null : this.getUnionId().equals(other.getUnionId())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())) @@ -241,6 +269,8 @@ public class HighUser extends UserModel implements Serializable { result = prime * result + ((getGold() == null) ? 0 : getGold().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode()); + result = prime * result + ((getOpenIdH5() == null) ? 0 : getOpenIdH5().hashCode()); + result = prime * result + ((getUnionId() == null) ? 0 : getUnionId().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); @@ -265,6 +295,8 @@ public class HighUser extends UserModel implements Serializable { sb.append(", gold=").append(gold); sb.append(", status=").append(status); sb.append(", openId=").append(openId); + sb.append(", openIdH5=").append(openIdH5); + sb.append(", unionId=").append(unionId); sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); sb.append(", ext3=").append(ext3); @@ -273,4 +305,4 @@ public class HighUser extends UserModel implements Serializable { sb.append("]"); return sb.toString(); } -} +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/HighUserExample.java b/hai-service/src/main/java/com/hai/entity/HighUserExample.java index aa04d6a8..823fcc7d 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUserExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserExample.java @@ -872,6 +872,146 @@ public class HighUserExample { return (Criteria) this; } + public Criteria andOpenIdH5IsNull() { + addCriterion("open_id_h5 is null"); + return (Criteria) this; + } + + public Criteria andOpenIdH5IsNotNull() { + addCriterion("open_id_h5 is not null"); + return (Criteria) this; + } + + public Criteria andOpenIdH5EqualTo(String value) { + addCriterion("open_id_h5 =", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5NotEqualTo(String value) { + addCriterion("open_id_h5 <>", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5GreaterThan(String value) { + addCriterion("open_id_h5 >", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5GreaterThanOrEqualTo(String value) { + addCriterion("open_id_h5 >=", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5LessThan(String value) { + addCriterion("open_id_h5 <", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5LessThanOrEqualTo(String value) { + addCriterion("open_id_h5 <=", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5Like(String value) { + addCriterion("open_id_h5 like", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5NotLike(String value) { + addCriterion("open_id_h5 not like", value, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5In(List values) { + addCriterion("open_id_h5 in", values, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5NotIn(List values) { + addCriterion("open_id_h5 not in", values, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5Between(String value1, String value2) { + addCriterion("open_id_h5 between", value1, value2, "openIdH5"); + return (Criteria) this; + } + + public Criteria andOpenIdH5NotBetween(String value1, String value2) { + addCriterion("open_id_h5 not between", value1, value2, "openIdH5"); + return (Criteria) this; + } + + public Criteria andUnionIdIsNull() { + addCriterion("union_id is null"); + return (Criteria) this; + } + + public Criteria andUnionIdIsNotNull() { + addCriterion("union_id is not null"); + return (Criteria) this; + } + + public Criteria andUnionIdEqualTo(String value) { + addCriterion("union_id =", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdNotEqualTo(String value) { + addCriterion("union_id <>", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdGreaterThan(String value) { + addCriterion("union_id >", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdGreaterThanOrEqualTo(String value) { + addCriterion("union_id >=", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdLessThan(String value) { + addCriterion("union_id <", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdLessThanOrEqualTo(String value) { + addCriterion("union_id <=", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdLike(String value) { + addCriterion("union_id like", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdNotLike(String value) { + addCriterion("union_id not like", value, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdIn(List values) { + addCriterion("union_id in", values, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdNotIn(List values) { + addCriterion("union_id not in", values, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdBetween(String value1, String value2) { + addCriterion("union_id between", value1, value2, "unionId"); + return (Criteria) this; + } + + public Criteria andUnionIdNotBetween(String value1, String value2) { + addCriterion("union_id not between", value1, value2, "unionId"); + return (Criteria) this; + } + public Criteria andExt1IsNull() { addCriterion("ext_1 is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 97593df7..3a1331f6 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -47,6 +47,13 @@ public interface HighUserService { **/ HighUser findByOpenId(String openId); + /** + * + * @param unionId + * @return + */ + HighUser findByUnionId(String unionId); + /** * @Author 胡锐 * @Description 根据手机号 查询用户 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 04ceede4..bc733468 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -72,7 +72,18 @@ public class HighUserServiceImpl implements HighUserService { @Override public HighUser findByOpenId(String openId) { HighUserExample example = new HighUserExample(); - example.createCriteria().andOpenIdEqualTo(openId); + example.createCriteria().andOpenIdEqualTo(openId).andStatusEqualTo(1); + List list = highUserMapper.selectByExample(example); + if (list != null && list.size() > 0) { + return list.get(0); + } + return null; + } + + @Override + public HighUser findByUnionId(String unionId) { + HighUserExample example = new HighUserExample(); + example.createCriteria().andUnionIdEqualTo(unionId).andStatusEqualTo(1); List list = highUserMapper.selectByExample(example); if (list != null && list.size() > 0) { return list.get(0); @@ -101,6 +112,9 @@ public class HighUserServiceImpl implements HighUserService { if (highUser == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户"); } + if (StringUtils.isBlank(highUser.getPhone())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定手机号,请勿重复绑定"); + } // 查询手机号是否被绑定 HighUser user = findByPhone(phone); @@ -114,6 +128,7 @@ public class HighUserServiceImpl implements HighUserService { user.setHeaderImg(highUser.getHeaderImg()); user.setName(highUser.getName()); user.setOpenId(highUser.getOpenId()); + user.setUnionId(highUser.getUnionId()); highUserMapper.updateByPrimaryKey(user); return user; }