|
@@ -1003,6 +1003,30 @@ public class ClaudeCodeServiceImpl implements ClaudeCodeService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean getUserSubs(long userId) {
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ //是否有该车票
|
|
|
|
|
+ GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder()
|
|
|
|
|
+ .field(GroupsRelationView::getUserId, userIdList).op(Operator.InList)
|
|
|
|
|
+ .field(GroupsRelationView::getGoodsId, Constant.CLAUDE_CODE_GOODS_ID)
|
|
|
|
|
+ .field(GroupsRelationView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ ClaudeCodeUser claudeCodeUser = claudeCodeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeUser.class).in(ClaudeCodeUser::getUserId, userIdList).last("limit 1"));
|
|
|
|
|
+ //车票不存在
|
|
|
|
|
+ if (groupsRelationView == null) {
|
|
|
|
|
+ //套餐是否存在
|
|
|
|
|
+ if (claudeCodeUser != null) {
|
|
|
|
|
+ //清除用户套餐
|
|
|
|
|
+ if (delUserPackages(claudeCodeUser.getUserId())) {
|
|
|
|
|
+ claudeCodeUserMapper.deleteById(claudeCodeUser.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void adjClaudeCodeUserPoints(Long userId, Integer points, String type, String description) throws Exception {
|
|
private void adjClaudeCodeUserPoints(Long userId, Integer points, String type, String description) throws Exception {
|
|
|
String apiKeyUrl = String.format(CLAUDE_CODE_API_PREFIX + "api/users/%s/credits/adjust", userId);
|
|
String apiKeyUrl = String.format(CLAUDE_CODE_API_PREFIX + "api/users/%s/credits/adjust", userId);
|
|
|
Map<String, Object> parmas = new HashMap<>();
|
|
Map<String, Object> parmas = new HashMap<>();
|