user增加邀请人id,通过邀请码获取用户修改为id获取
This commit is contained in:
@@ -178,6 +178,11 @@ public class UserEntity implements Serializable {
|
||||
*/
|
||||
private String qdCode;
|
||||
|
||||
/**
|
||||
* 邀请人id
|
||||
*/
|
||||
private Long inviterUserId;
|
||||
|
||||
/**
|
||||
* 是否是新用户 1否
|
||||
*/
|
||||
|
||||
@@ -233,4 +233,6 @@ public interface UserService extends IService<UserEntity> {
|
||||
* 用户行为
|
||||
*/
|
||||
void addBlackUser(Long userId,String behavior);
|
||||
|
||||
UserEntity queryByInvitationCodeOrUserId(Long inviterUserId, String invitationCode);
|
||||
}
|
||||
|
||||
@@ -473,7 +473,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (StringUtils.isEmpty(userInfo1.getInviterCode())) {
|
||||
userInfo1.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
UserEntity userEntity = queryByInvitationCodeOrUserId(userInfo1.getInviterUserId(), userInfo1.getInviterCode());
|
||||
// UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
if (userEntity != null && StringUtils.isEmpty(userInfo1.getQdCode())) {
|
||||
userInfo1.setQdCode(userEntity.getQdCode());
|
||||
}
|
||||
@@ -763,7 +764,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (StringUtils.isEmpty(userInfo1.getInviterCode())) {
|
||||
userInfo1.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
UserEntity userEntity = queryByInvitationCodeOrUserId(userInfo1.getInviterUserId(), userInfo1.getInviterCode());
|
||||
// UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
//没有则生成新账号
|
||||
userInfo1.setCreateTime(date);
|
||||
userInfo1.setPlatform("抖音");
|
||||
@@ -858,7 +860,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (StringUtils.isEmpty(userInfo1.getInviterCode())) {
|
||||
userInfo1.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
UserEntity userEntity = queryByInvitationCodeOrUserId(userInfo1.getInviterUserId(), userInfo1.getInviterCode());
|
||||
// UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
//没有则生成新账号
|
||||
userInfo1.setCreateTime(date);
|
||||
userInfo1.setPlatform("快手");
|
||||
@@ -957,7 +960,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
} else {
|
||||
userInfo.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
userEntity = queryByInvitationCode(userInfo.getInviterCode());
|
||||
userEntity = queryByInvitationCodeOrUserId(userInfo.getInviterUserId(), userInfo.getInviterCode());
|
||||
// userEntity = queryByInvitationCode(userInfo.getInviterCode());
|
||||
}
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = simpleDateFormat.format(new Date());
|
||||
@@ -1673,4 +1677,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
.set(UserEntity::getPlatform, behavior)
|
||||
.set(UserEntity::getUpdateTime,DateUtil.now()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserEntity queryByInvitationCodeOrUserId(Long inviterUserId, String invitationCode) {
|
||||
if (inviterUserId == null) {
|
||||
return baseMapper.selectOne(new QueryWrapper<UserEntity>().eq("invitation_code", invitationCode));
|
||||
}
|
||||
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<UserEntity>().eq(UserEntity::getUserId, inviterUserId));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user