|
@@ -102,7 +102,7 @@ public class WxLoginService
|
|
|
* @param tel
|
|
* @param tel
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public Boolean register_small(String openId,String unionId,String tel) {
|
|
|
|
|
|
|
+ public Boolean register_small(String openId,String unionId,String tel,String inviteCode) {
|
|
|
User bo = new User();
|
|
User bo = new User();
|
|
|
bo.setOpenId(openId);
|
|
bo.setOpenId(openId);
|
|
|
bo.setUnionId(unionId);
|
|
bo.setUnionId(unionId);
|
|
@@ -111,7 +111,7 @@ public class WxLoginService
|
|
|
bo.setNickname(TelPhoneUtils.hideTelPhone(tel));
|
|
bo.setNickname(TelPhoneUtils.hideTelPhone(tel));
|
|
|
//雪花算法产生账号ID
|
|
//雪花算法产生账号ID
|
|
|
SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
|
- bo.setUserAccout(String.valueOf(idWorker.nextId()));
|
|
|
|
|
|
|
+ bo.setUserAccount(String.valueOf(idWorker.nextId()));
|
|
|
bo.setSex(1);
|
|
bo.setSex(1);
|
|
|
bo.setStatus(1);
|
|
bo.setStatus(1);
|
|
|
bo.setRegisterPlat("1");
|
|
bo.setRegisterPlat("1");
|
|
@@ -120,6 +120,12 @@ public class WxLoginService
|
|
|
bo.setLastLoginTime(DateUtils.getNowTime());
|
|
bo.setLastLoginTime(DateUtils.getNowTime());
|
|
|
bo.setCreateTime(DateUtils.getNowTime());
|
|
bo.setCreateTime(DateUtils.getNowTime());
|
|
|
bo.setUpdateTime(DateUtils.getNowTime());
|
|
bo.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ if(inviteCode!=null){
|
|
|
|
|
+ User inviteUser = iUserService.queryByAccount(inviteCode);
|
|
|
|
|
+ if(inviteUser!=null){
|
|
|
|
|
+ bo.setInviteUserAccount(inviteCode);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if(iUserService.save(bo)){
|
|
if(iUserService.save(bo)){
|
|
|
UserSchoolInfo schoolInfo = new UserSchoolInfo();
|
|
UserSchoolInfo schoolInfo = new UserSchoolInfo();
|
|
|
schoolInfo.setUserId(bo.getUserId());
|
|
schoolInfo.setUserId(bo.getUserId());
|
|
@@ -141,7 +147,7 @@ public class WxLoginService
|
|
|
String phoneNumber = obtainWxPhone(loginBody.getIv(),loginBody.getEncryptedData(),session_key);
|
|
String phoneNumber = obtainWxPhone(loginBody.getIv(),loginBody.getEncryptedData(),session_key);
|
|
|
User user = iUserService.queryByUnionId(unionId);
|
|
User user = iUserService.queryByUnionId(unionId);
|
|
|
if(user==null){
|
|
if(user==null){
|
|
|
- if(!register_small(openId,unionId,phoneNumber)){
|
|
|
|
|
|
|
+ if(!register_small(openId,unionId,phoneNumber,loginBody.getInviteCode())){
|
|
|
throw new CustomException("注册失败");
|
|
throw new CustomException("注册失败");
|
|
|
}
|
|
}
|
|
|
user = iUserService.queryByUnionId(unionId);
|
|
user = iUserService.queryByUnionId(unionId);
|