|
|
@@ -2,6 +2,7 @@ package com.cyksj.service.relation.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
+import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.claudecode.OAuthTokenMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
@@ -52,6 +53,8 @@ public class GroupRelationClearServiceImpl implements GroupRelationClearService
|
|
|
|
|
|
private final CodexService codexService;
|
|
|
|
|
|
+ private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
|
|
|
+
|
|
|
@Override
|
|
|
public void clearTicket(GroupsRelation relation, UserTicketClearedRecord.Source source) {
|
|
|
Long relationId = relation.getId();
|
|
|
@@ -143,10 +146,12 @@ public class GroupRelationClearServiceImpl implements GroupRelationClearService
|
|
|
}
|
|
|
//claude code
|
|
|
if (groupsRelation.getGoodsId() != null && groupsRelation.getGoodsId() == Constant.CLAUDE_CODE_GOODS_ID && source != UserTicketClearedRecord.Source.cc_deduct) {
|
|
|
- //用户失效 车票用户id
|
|
|
- claudeCodeService.invalidateUserCache(groupsRelation.getUserId());
|
|
|
- //删除用户套餐
|
|
|
- claudeCodeService.delUserPackages(groupsRelation.getUserId());
|
|
|
+ TASK_POOL.execute(()->{
|
|
|
+ //用户失效 车票用户id
|
|
|
+ claudeCodeService.invalidateUserCache(groupsRelation.getUserId());
|
|
|
+ //删除用户套餐
|
|
|
+ claudeCodeService.delUserPackages(groupsRelation.getUserId());
|
|
|
+ });
|
|
|
//清除claude code user
|
|
|
claudeCodeUserMapper.delete(Wrappers.lambdaQuery(ClaudeCodeUser.class).eq(ClaudeCodeUser::getRelationId, relationId));
|
|
|
//清除claude code tokens
|
|
|
@@ -159,13 +164,13 @@ public class GroupRelationClearServiceImpl implements GroupRelationClearService
|
|
|
nanoUserQuotaMapper.delete(Wrappers.lambdaQuery(NanoUserQuota.class).eq(NanoUserQuota::getRelationId, relationId));
|
|
|
}
|
|
|
|
|
|
- //codex
|
|
|
- if (groupsRelation.getGoodsId() != null && groupsRelation.getGoodsId() == Constant.CODEX_GOODS_ID) {
|
|
|
- //清除套餐
|
|
|
- codexService.delUserPackages(groupsRelation.getUserId());
|
|
|
- //清除codex
|
|
|
- codexUserMapper.delete(Wrappers.lambdaQuery(CodexUser.class).eq(CodexUser::getRelationId, relationId));
|
|
|
- }
|
|
|
+ //codex
|
|
|
+ if (groupsRelation.getGoodsId() != null && groupsRelation.getGoodsId() == Constant.CODEX_GOODS_ID) {
|
|
|
+ //清除套餐
|
|
|
+ codexService.delUserPackages(groupsRelation.getUserId());
|
|
|
+ //清除codex
|
|
|
+ TASK_POOL.execute(() -> codexUserMapper.delete(Wrappers.lambdaQuery(CodexUser.class).eq(CodexUser::getRelationId, relationId)));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|