|
@@ -6,7 +6,6 @@ import com.caimei.mapper.cmMapper.ClubMapper;
|
|
|
import com.caimei.mapper.cmMapper.LoginMapper;
|
|
|
import com.caimei.mapper.cmMapper.ShopMapper;
|
|
|
import com.caimei.model.ResponseJson;
|
|
|
-import com.caimei.model.po.ClubUserPo;
|
|
|
import com.caimei.model.po.CmBrandAuthPo;
|
|
|
import com.caimei.model.vo.ShopFormVo;
|
|
|
import com.caimei.model.vo.WxClubUserVo;
|
|
@@ -19,7 +18,6 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Date;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
@@ -71,7 +69,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
String openId = infoMap.get("openId");
|
|
|
String accessToken = infoMap.get("accessToken");
|
|
|
log.info("微信授权,openId:>>>>>>>>>>>" + openId);
|
|
|
- WxClubUserVo clubUser = loginMapper.findClubUserByOpenId(openId);
|
|
|
+ WxClubUserVo clubUser = loginMapper.getClubUserByOpenId(openId, appId);
|
|
|
if (null == clubUser) {
|
|
|
clubUser = new WxClubUserVo();
|
|
|
clubUser.setOpenId(openId);
|
|
@@ -80,7 +78,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
}
|
|
|
clubUser.setAccessToken(accessToken);
|
|
|
// 登录成功redis保存token
|
|
|
- redisService.set(accessToken, openId, 60L * 60 * 4);
|
|
|
+ redisService.set(accessToken, openId + "|" + appId, 60L * 60 * 4);
|
|
|
return ResponseJson.success(clubUser);
|
|
|
}
|
|
|
|
|
@@ -141,7 +139,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
return ResponseJson.error("验证码错误,请重新输入", null);
|
|
|
}
|
|
|
// 校验机构用户是否存在
|
|
|
- WxClubUserVo wxClubUser = clubMapper.getWxClubUser(mobile, appId, null);
|
|
|
+ WxClubUserVo wxClubUser = clubMapper.getWxClubUser(mobile, appId, null, null);
|
|
|
if (null == wxClubUser) {
|
|
|
return ResponseJson.error("抱歉,您的手机号暂无权限登录", null);
|
|
|
}
|
|
@@ -172,15 +170,15 @@ public class LoginServiceImpl implements LoginService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, String appId) {
|
|
|
+ public ResponseJson<WxClubUserVo> loginByVerifyCode(String mobile, String verifyCode, Integer authUserId) {
|
|
|
if (StringUtils.isEmpty(mobile)) {
|
|
|
return ResponseJson.error("参数异常,请输入手机号", null);
|
|
|
}
|
|
|
if (StringUtils.isEmpty(verifyCode)) {
|
|
|
return ResponseJson.error("参数异常,请输入验证码", null);
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(appId)) {
|
|
|
- return ResponseJson.error("参数异常,请输入appId", null);
|
|
|
+ if (null == authUserId) {
|
|
|
+ return ResponseJson.error("参数异常,请输入供应商用户id", null);
|
|
|
}
|
|
|
// 校验验证码是否正确
|
|
|
String redisVerifyCode = null == redisService.get("code:" + mobile) ? null : redisService.get("code:" + mobile).toString();
|
|
@@ -188,11 +186,11 @@ public class LoginServiceImpl implements LoginService {
|
|
|
return ResponseJson.error("验证码错误,请重新输入", null);
|
|
|
}
|
|
|
// 获取手机号对应机构用户
|
|
|
- WxClubUserVo clubUser = clubMapper.getWxClubUser(mobile, appId, null);
|
|
|
+ WxClubUserVo clubUser = clubMapper.getWxClubUser(mobile, null, authUserId, null);
|
|
|
if (null == clubUser) {
|
|
|
clubUser = new WxClubUserVo();
|
|
|
clubUser.setMobile(mobile);
|
|
|
- return ResponseJson.error(-2,"抱歉,您的手机号暂无权限登录", clubUser);
|
|
|
+ return ResponseJson.error("抱歉,您的手机号暂无权限登录", clubUser);
|
|
|
}
|
|
|
// 校验机构和供应商的状态是否为已上线
|
|
|
CmBrandAuthPo clubPo = authMapper.getAuthById(clubUser.getAuthId());
|
|
@@ -202,7 +200,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
}
|
|
|
// 登录成功redis保存token
|
|
|
String accessToken = UUID.randomUUID().toString();
|
|
|
- redisService.set(accessToken, mobile + "," + appId, 60L * 60 * 24);
|
|
|
+ redisService.set(accessToken, mobile + "," + authUserId, 60L * 60 * 24);
|
|
|
clubUser.setAccessToken(accessToken);
|
|
|
return ResponseJson.success(clubUser);
|
|
|
}
|