解决多小程序微信登陆渠道相同openId不同问题
This commit is contained in:
parent
08df74e4d7
commit
2cc51d9b4b
@ -21,7 +21,7 @@ public interface AdminOauthUserOtherInfoService {
|
||||
*/
|
||||
void checkInsert(Long userId, String appId, String openId, Integer socialType);
|
||||
|
||||
AdminOauthUserOtherInfoDO getByCondition(Long userId, String appId, String openId, Integer socialType);
|
||||
AdminOauthUserOtherInfoDO getByCondition(Long userId, Integer socialType);
|
||||
|
||||
/**
|
||||
* 通过社交类型+用户状态获取用户社交信息
|
||||
|
@ -24,22 +24,24 @@ public class AdminOauthUserOtherInfoServiceImpl implements AdminOauthUserOtherIn
|
||||
|
||||
@Override
|
||||
public void checkInsert(Long userId, String appId, String openId, Integer socialType) {
|
||||
AdminOauthUserOtherInfoDO adminOauthUserOtherInfoDOS = this.getByCondition(userId, appId, openId, socialType);
|
||||
AdminOauthUserOtherInfoDO adminOauthUserOtherInfoDOS = this.getByCondition(userId, socialType);
|
||||
if (adminOauthUserOtherInfoDOS == null) {
|
||||
adminOauthUserOtherInfoMapper.insert(new AdminOauthUserOtherInfoDO()
|
||||
.setUserId(userId)
|
||||
.setAppId(appId)
|
||||
.setOpenId(openId)
|
||||
.setSocialType(socialType));
|
||||
} else {
|
||||
if (!adminOauthUserOtherInfoDOS.getOpenId().equals(openId)) {
|
||||
adminOauthUserOtherInfoMapper.updateById(adminOauthUserOtherInfoDOS.setOpenId(openId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminOauthUserOtherInfoDO getByCondition(Long userId, String appId, String openId, Integer socialType) {
|
||||
public AdminOauthUserOtherInfoDO getByCondition(Long userId, Integer socialType) {
|
||||
return adminOauthUserOtherInfoMapper.selectOne(new LambdaQueryWrapper<AdminOauthUserOtherInfoDO>()
|
||||
.eq(AdminOauthUserOtherInfoDO::getUserId, userId)
|
||||
.eq(AdminOauthUserOtherInfoDO::getAppId, appId)
|
||||
.eq(AdminOauthUserOtherInfoDO::getOpenId, openId)
|
||||
.eq(AdminOauthUserOtherInfoDO::getSocialType, socialType));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user