|
|
@@ -234,18 +234,54 @@ public class UserInfoServiceImpl implements UserInfoService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public UserInfo loginSms(String phone, String code, String sessionId) throws LoginException {
|
|
|
- logger.info("loginSms");
|
|
|
-// SMSVerifyCodeResult sMSVerifyCodeResult;
|
|
|
+// @Override
|
|
|
+// public UserInfo loginSms(String phone, String code, String sessionId) throws LoginException {
|
|
|
+// logger.info("loginSms");
|
|
|
+//// SMSVerifyCodeResult sMSVerifyCodeResult;
|
|
|
+//// try {
|
|
|
+//// sMSVerifyCodeResult = rongCloud.sms.verifyCode(sessionId, code);
|
|
|
+//// } catch (Exception e) {
|
|
|
+//// e.printStackTrace();
|
|
|
+//// throw new LoginException("验证码错误");
|
|
|
+//// }
|
|
|
// try {
|
|
|
-// sMSVerifyCodeResult = rongCloud.sms.verifyCode(sessionId, code);
|
|
|
+// if (code.toLowerCase().equals(sessionId)) {
|
|
|
+// UserInfo userInfo = new UserInfo();
|
|
|
+// userInfo.setPhone(phone);
|
|
|
+// userInfo = getUserInfo(userInfo);
|
|
|
+// if (userInfo == null) {
|
|
|
+// userInfo = new UserInfo();
|
|
|
+// userInfo.setPhone(phone);
|
|
|
+// userInfo.setUsername(phone);
|
|
|
+// userInfo.setNickname(phone);
|
|
|
+// userInfo.setIcon("https://microball.oss-cn-hangzhou.aliyuncs.com/huanbaojia/icon_morentouxiang.png");
|
|
|
+// if (!createUserInfo(userInfo)) {
|
|
|
+// throw new LoginException("登录失败");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return userInfo;
|
|
|
+// }
|
|
|
// } catch (Exception e) {
|
|
|
// e.printStackTrace();
|
|
|
// throw new LoginException("验证码错误");
|
|
|
// }
|
|
|
+// throw new LoginException("验证码错误");
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public UserInfo loginSms(String phone, String code, String sessionId) throws LoginException {
|
|
|
+ logger.info("loginSms");
|
|
|
+ SMSVerifyCodeResult sMSVerifyCodeResult;
|
|
|
try {
|
|
|
- if (code.toLowerCase().equals(sessionId)) {
|
|
|
+ sMSVerifyCodeResult = rongCloud.sms.verifyCode(sessionId, code);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new LoginException("验证码错误");
|
|
|
+ }
|
|
|
+ if (200 == sMSVerifyCodeResult.getCode()) {
|
|
|
+ Boolean success = sMSVerifyCodeResult.getSuccess();
|
|
|
+ if (success) {
|
|
|
UserInfo userInfo = new UserInfo();
|
|
|
userInfo.setPhone(phone);
|
|
|
userInfo = getUserInfo(userInfo);
|
|
|
@@ -261,9 +297,6 @@ public class UserInfoServiceImpl implements UserInfoService {
|
|
|
}
|
|
|
return userInfo;
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- throw new LoginException("验证码错误");
|
|
|
}
|
|
|
throw new LoginException("验证码错误");
|
|
|
}
|