|
|
|
@ -82,12 +82,12 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getClientInfoByPhoneStatusKey(String phone, String nationCode,String ip) {
|
|
|
|
|
public String getClientInfoByPhoneStatusKey(String phone, String nationCode) {
|
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
|
JSONObject account = clientAccountMapper.findOneByPhoneAndCreateTimeDesc(phone, "+" + nationCode);
|
|
|
|
|
if (account == null) {
|
|
|
|
|
String expireMin = "5";
|
|
|
|
|
stringRedisTemplate.boundValueOps(getClientLoginPhoneBindRedisKey(phone,nationCode,ip)).set(phone, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
stringRedisTemplate.boundValueOps(getClientLoginPhoneBindRedisKey(phone,nationCode)).set(phone, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES);
|
|
|
|
@ -380,7 +380,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject clientAppWechatSignIn(String code,String ip) {
|
|
|
|
|
public JSONObject clientAppWechatSignIn(String code) {
|
|
|
|
|
JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(code);
|
|
|
|
|
if(user==null){
|
|
|
|
|
throw new BadRequestException("WeChat users do not exist");
|
|
|
|
@ -396,7 +396,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
res.put("app_openid", openId);
|
|
|
|
|
res.put("status", "success");
|
|
|
|
|
String expireMin = "5";
|
|
|
|
|
stringRedisTemplate.boundValueOps(getClientLoginWechatBindRedisKey(openId,ip)).set(openId+"&"+nickName+"&"+unionId, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
stringRedisTemplate.boundValueOps(getClientLoginWechatBindRedisKey(openId)).set(openId+"&"+nickName+"&"+unionId, Long.parseLong(expireMin), TimeUnit.MINUTES);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
String statusKey = newStatusKey();
|
|
|
|
@ -411,14 +411,14 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getClientLoginWechatBindRedisKey(String openId,String ip){
|
|
|
|
|
return "login:"+":"+CLIENT_LOGIN_WECHAT_BIND_PREFIX + "&"+openId+"&"+ip;
|
|
|
|
|
private String getClientLoginWechatBindRedisKey(String openId){
|
|
|
|
|
return "login:"+":"+CLIENT_LOGIN_WECHAT_BIND_PREFIX + "&"+openId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject verifyClientLoginWechatBindCode(String openId,String ip){
|
|
|
|
|
String rediskey = getClientLoginWechatBindRedisKey(openId,ip);
|
|
|
|
|
public JSONObject verifyClientLoginWechatBindCode(String openId){
|
|
|
|
|
String rediskey = getClientLoginWechatBindRedisKey(openId);
|
|
|
|
|
String codeValue = stringRedisTemplate.boundValueOps(rediskey).get();
|
|
|
|
|
if (codeValue == null || !codeValue.split("&")[0].equals(openId)) {
|
|
|
|
|
throw new BadRequestException("The WeChat ID does not apply for binding");
|
|
|
|
@ -432,12 +432,12 @@ public class SignInStatusManagerImpl implements SignInStatusManager {
|
|
|
|
|
}};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getClientLoginPhoneBindRedisKey(String phone,String nationCode,String ip){
|
|
|
|
|
return "login:"+CLIENT_LOGIN_PHONE_BIND_PREFIX + "&"+nationCode+"&"+phone+"&"+ip;
|
|
|
|
|
private String getClientLoginPhoneBindRedisKey(String phone,String nationCode){
|
|
|
|
|
return "login:"+CLIENT_LOGIN_PHONE_BIND_PREFIX + "&"+nationCode+"&"+phone;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void verifyClientLoginPhoneBindCode(String phone,String nationCode,String ip){
|
|
|
|
|
String rediskey = getClientLoginPhoneBindRedisKey(phone,nationCode,ip);
|
|
|
|
|
public void verifyClientLoginPhoneBindCode(String phone,String nationCode){
|
|
|
|
|
String rediskey = getClientLoginPhoneBindRedisKey(phone,nationCode);
|
|
|
|
|
String codeValue = stringRedisTemplate.boundValueOps(rediskey).get();
|
|
|
|
|
if (codeValue == null || !codeValue.equals(phone)) {
|
|
|
|
|
throw new BadRequestException("The phone number is for application binding");
|
|
|
|
|