推广后台-邀请码进房-特殊邀请码

This commit is contained in:
khalil
2023-11-03 16:02:33 +08:00
parent 442afe9d03
commit c6d14eedd4
2 changed files with 17 additions and 6 deletions

View File

@@ -96,7 +96,6 @@ public class FlowTeamService {
@Autowired
private FlowTeamGroupService flowTeamGroupService;
private final static Integer MEMBER_STATUS_VALID = 1;
private final static Integer MEMBER_STATUS_INVALID = 0;
private final static Integer MEMBER_STATUS_DELETED = -1;
@@ -791,17 +790,21 @@ public class FlowTeamService {
}
private void checkTeamRoomInviteCode(String teamId, String roomInviteCode) {
// 校验邀请码是不是自己小组的
FlowTeamInviteCodeRecord record = flowTeamInviteCodeRecordService.getByTeamIdAndCode(teamId, roomInviteCode);
if (record == null) {
throw new ServiceException(BusiStatus.BUSIERROR, "邀请码无权操作");
}
// 校验邀请码是否已经被绑定
List<String> invitecodes = Arrays.asList(roomInviteCode);
List<RoomInviteCode> records = roomInviteCodeService.listByInviteCodes(invitecodes);
if (!CollectionUtils.isEmpty(records)) {
throw new ServiceException(BusiStatus.BUSIERROR, "邀请码已绑定其他房间");
}
UserInviteCode specialCode = userInviteCodeService.getByCode(roomInviteCode);
if (specialCode != null){
return;
}
// 校验邀请码是不是自己小组的
FlowTeamInviteCodeRecord record = flowTeamInviteCodeRecordService.getByTeamIdAndCode(teamId, roomInviteCode);
if (record == null) {
throw new ServiceException(BusiStatus.BUSIERROR, "邀请码无权操作");
}
}

View File

@@ -49,6 +49,14 @@ public class UserInviteCodeService extends ServiceImpl<UserInviteCodeMapper, Use
return null;
}
public UserInviteCode getByCode(String code){
QueryWrapper<UserInviteCode> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(UserInviteCode::getInviteCode, code)
.eq(UserInviteCode::getStatus, INVITE_CODE_STATUS_VALID)
.orderByDesc(UserInviteCode::getCreateTime);
return userInviteCodeMapper.selectOne(queryWrapper);
}
public void initUserInivteCode(Long uid) {
UserInviteCode inviteCode = getInviteCode(uid);
if (inviteCode != null) {