Commit e572769f authored by hezhen's avatar hezhen

添加注册和登录

parent db8fafaf
...@@ -231,7 +231,11 @@ public class AppPermissionService { ...@@ -231,7 +231,11 @@ public class AppPermissionService {
userLogin.setId(userid); userLogin.setId(userid);
userLogin.setImPassword(imPassword); userLogin.setImPassword(imPassword);
userLogin.setImUserid(imUserId); userLogin.setImUserid(imUserId);
userLogin.setUsername(username);
appUserLoginBiz.updateSelectiveById(userLogin);
} }
data.put("im_token",access_token);
data.put("im_UserId",imUserId);
} }
if (data != null) { if (data != null) {
...@@ -349,6 +353,14 @@ public class AppPermissionService { ...@@ -349,6 +353,14 @@ public class AppPermissionService {
} }
// 登录结果要做做统一处理 // 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname); JSONObject data = autoLogin(userid, username, headimgurl, nickname);
// 到im注册,获取返回结果
Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
data.put("im_token",access_token);
data.put("im_UserId",imUserId);
}
if (data != null) { if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data); return JsonResultUtil.createSuccessResultWithObj(data);
} }
...@@ -428,6 +440,14 @@ public class AppPermissionService { ...@@ -428,6 +440,14 @@ public class AppPermissionService {
nickname = userDetail.getNickname(); nickname = userDetail.getNickname();
} }
JSONObject data = autoLogin(userid, userLogin.getUsername(), headimgurl, nickname); JSONObject data = autoLogin(userid, userLogin.getUsername(), headimgurl, nickname);
// 到im注册,获取返回结果
Integer imUserId=userLogin.getImUserid();
String imPassword=userLogin.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(userLogin.getUsername(),imPassword,imUserId);
data.put("im_token",access_token);
data.put("im_UserId",imUserId);
}
if (data != null) { if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data); return JsonResultUtil.createSuccessResultWithObj(data);
} }
...@@ -462,6 +482,14 @@ public class AppPermissionService { ...@@ -462,6 +482,14 @@ public class AppPermissionService {
Integer userid = user.getId(); Integer userid = user.getId();
String nickname = SystemConfig.USER_NIKENAME_DEFAULT + (int) ((Math.random() * 9 + 1) * 100000); String nickname = SystemConfig.USER_NIKENAME_DEFAULT + (int) ((Math.random() * 9 + 1) * 100000);
JSONObject data = autoLogin(userid, user.getUsername(), SystemConfig.USER_HEADER_URL_DEFAULT, nickname); JSONObject data = autoLogin(userid, user.getUsername(), SystemConfig.USER_HEADER_URL_DEFAULT, nickname);
// 到im注册,获取返回结果
Integer imUserId=user.getImUserid();
String imPassword=user.getImPassword();
if(StringUtils.isNotBlank(imPassword)&&imUserId!=null&&imUserId>0){
String access_token=loginIm(username,imPassword,imUserId);
data.put("im_token",access_token);
data.put("im_UserId",imUserId);
}
if (data != null) { if (data != null) {
return JsonResultUtil.createSuccessResultWithObj(data); return JsonResultUtil.createSuccessResultWithObj(data);
} }
...@@ -571,7 +599,7 @@ public class AppPermissionService { ...@@ -571,7 +599,7 @@ public class AppPermissionService {
//登录im //登录im
public String loginIm(String username, String password, String userId) { public String loginIm(String username, String password, Integer userId) {
log.error("------登录loginIm----username====="+username+"-----password==="+password+"---userId==="+userId); log.error("------登录loginIm----username====="+username+"-----password==="+password+"---userId==="+userId);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("telephone", username); map.put("telephone", username);
......
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