Commit 1a56b0ef authored by 周健威's avatar 周健威

修改代码

parent 92353436
...@@ -802,120 +802,120 @@ public class AppPermissionService { ...@@ -802,120 +802,120 @@ public class AppPermissionService {
} }
/** // /**
* 小程序注册用户 // * 小程序注册用户
* // *
* @param username // * @param username
* @param password // * @param password
* @param headimgurl // * @param headimgurl
* @param nickname // * @param nickname
*/ // */
@Transactional // @Transactional
public JSONObject applyRegister(String username, String password, String headimgurl, String nickname, Integer small_id) { // public JSONObject applyRegister(String username, String password, String headimgurl, String nickname, Integer small_id) {
// 判断参数 // // 判断参数
if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) { // if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空"); // return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空");
} // }
// if (StringUtils.isNotBlank(username)){ //// if (StringUtils.isNotBlank(username)){
// return JsonResultUtil.createFailedResult(ResultCode.FAILED_CODE, "服务升级中,暂不支持注册"); //// return JsonResultUtil.createFailedResult(ResultCode.FAILED_CODE, "服务升级中,暂不支持注册");
//// }
// // 是否已存在
// AppUserLogin user = appUserLoginBiz.checkeUserLogin(username);
// if (null != user) {
// return JsonResultUtil.createFailedResult(ResultCode.EXIST_CODE, "用户已存在");
// }
// // 新增用户登录信息
// try {
// Long now = System.currentTimeMillis() / 1000;
// AppUserLogin appUserLogin = new AppUserLogin();
// appUserLogin.setUsername(username);
// appUserLogin.setPassword(password);
// appUserLogin.setIsdel(0);
// appUserLogin.setStatus(0);
// appUserLogin.setCreatetime(now);
// appUserLogin.setUpdatetime(now);
// appUserLoginBiz.insertSelective(appUserLogin);
// Integer userid = appUserLogin.getId();
// log.error("注册:新增登陆用户信息: " + userid);
// // 新增用户详情
// AppUserDetail rsUserDetail = new AppUserDetail();
// rsUserDetail.setUserid(userid);
// rsUserDetail.setNickname(nickname);
// rsUserDetail.setHeadimgurl(headimgurl); // 默认路径,待写
// rsUserDetail.setCreatetime(now);
// rsUserDetail.setUpdatetime(now);
// rsUserDetail.setIsdel(0);
// //生成邀请码 长度改为8 不然重复率太高
// rsUserDetail.setCode(ReferralCodeUtil.encode(userid));
// //设置来源
// log.info("register------username====="+username+"----channel===="+UserSourceEnum.APPLET.getCode());
// rsUserDetail.setChannel(-1);
// rsUserDetail.setCrtHost(getIp());
// //setCreateIPInfo(rsUserDetail);
// rsUserDetail.setState(1);
// appUserDetailBiz.insertSelective(rsUserDetail);
// log.error("注册:新增用户详情: " + userid);
// //创建钱包
// walletBiz.createWalletByUserId(appUserLogin.getId());
//
// //上线绑定
// relationBiz.bindByUserId(userid, small_id);
// //发送短信通知用户
// List<String> smsParams = new ArrayList<String>();
// smsParams.add(smallName);
// smsParams.add(username);
// smsParams.add(password);
// thirdFeign.sendTemplate(new SmsTemplateDTO(){{
// setPhoneNumbers(username);
// setType(SmsTemplateDTO.PWD);
// setParams(smsParams.toArray(new String[smsParams.size()]));
// }});
//
// // 登录结果要做做统一处理
// JSONObject data = autoLogin(userid, username, headimgurl, nickname,null,null,2);
//
// if (data != null) {
// return JsonResultUtil.createSuccessResultWithObj(data);
// } else {
// return JsonResultUtil.createDefaultFail();
// }
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// return JsonResultUtil.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
// }
// } // }
// 是否已存在
AppUserLogin user = appUserLoginBiz.checkeUserLogin(username);
if (null != user) {
return JsonResultUtil.createFailedResult(ResultCode.EXIST_CODE, "用户已存在");
}
// 新增用户登录信息
try {
Long now = System.currentTimeMillis() / 1000;
AppUserLogin appUserLogin = new AppUserLogin();
appUserLogin.setUsername(username);
appUserLogin.setPassword(password);
appUserLogin.setIsdel(0);
appUserLogin.setStatus(0);
appUserLogin.setCreatetime(now);
appUserLogin.setUpdatetime(now);
appUserLoginBiz.insertSelective(appUserLogin);
Integer userid = appUserLogin.getId();
log.error("注册:新增登陆用户信息: " + userid);
// 新增用户详情
AppUserDetail rsUserDetail = new AppUserDetail();
rsUserDetail.setUserid(userid);
rsUserDetail.setNickname(nickname);
rsUserDetail.setHeadimgurl(headimgurl); // 默认路径,待写
rsUserDetail.setCreatetime(now);
rsUserDetail.setUpdatetime(now);
rsUserDetail.setIsdel(0);
//生成邀请码 长度改为8 不然重复率太高
rsUserDetail.setCode(ReferralCodeUtil.encode(userid));
//设置来源
log.info("register------username====="+username+"----channel===="+UserSourceEnum.APPLET.getCode());
rsUserDetail.setChannel(-1);
rsUserDetail.setCrtHost(getIp());
//setCreateIPInfo(rsUserDetail);
rsUserDetail.setState(1);
appUserDetailBiz.insertSelective(rsUserDetail);
log.error("注册:新增用户详情: " + userid);
//创建钱包
walletBiz.createWalletByUserId(appUserLogin.getId());
//上线绑定
relationBiz.bindByUserId(userid, small_id);
//发送短信通知用户
List<String> smsParams = new ArrayList<String>();
smsParams.add(smallName);
smsParams.add(username);
smsParams.add(password);
thirdFeign.sendTemplate(new SmsTemplateDTO(){{
setPhoneNumbers(username);
setType(SmsTemplateDTO.PWD);
setParams(smsParams.toArray(new String[smsParams.size()]));
}});
// 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname,null,null,2);
if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data);
} else {
return JsonResultUtil.createDefaultFail();
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return JsonResultUtil.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
}
}
/**
* 通过小程序注册
*
* @param username
* @return
*/
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public JSONObject appletRegistry(String username, String headimgurl, String nickname, Integer small_id) {
try { // /**
// 是否已存在 // * 通过小程序注册
AppUserLogin user = appUserLoginBiz.checkeUserLogin(username); // *
JSONObject data = new JSONObject(); // * @param username
if (null == user) { // * @return
//随机生成密码 // */
String password = UUIDUtils.genCodes(8); // @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
data = applyRegister(username, password, headimgurl, nickname, small_id); // public JSONObject appletRegistry(String username, String headimgurl, String nickname, Integer small_id) {
} else { //
Integer userid = user.getId(); // try {
//上线绑定 // // 是否已存在
relationBiz.bindByUserId(userid, small_id); // AppUserLogin user = appUserLoginBiz.checkeUserLogin(username);
//登录 // JSONObject data = new JSONObject();
data = appletLoginByUserId(userid); // if (null == user) {
} // //随机生成密码
return data; // String password = UUIDUtils.genCodes(8);
} catch (Exception e) { // data = applyRegister(username, password, headimgurl, nickname, small_id);
log.error(e.getMessage(), e); // } else {
return JsonResultUtil.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常"); // Integer userid = user.getId();
} // //上线绑定
} // relationBiz.bindByUserId(userid, small_id);
// //登录
// data = appletLoginByUserId(userid);
// }
// return data;
// } catch (Exception e) {
// log.error(e.getMessage(), e);
// return JsonResultUtil.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
// }
// }
public ImiVo findUserInoByImiId(Integer imiId) { public ImiVo findUserInoByImiId(Integer imiId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment