|
@@ -186,16 +186,14 @@ public class ClaudeCodeServiceImpl implements ClaudeCodeService {
|
|
|
public void deleteApiKeysById(ClaudeCodeDelReq delReq) throws Exception {
|
|
public void deleteApiKeysById(ClaudeCodeDelReq delReq) throws Exception {
|
|
|
Long userId = delReq.getUserId();
|
|
Long userId = delReq.getUserId();
|
|
|
Long keyId = delReq.getKeyId();
|
|
Long keyId = delReq.getKeyId();
|
|
|
- String keyValue = delReq.getKeyValue();
|
|
|
|
|
if (checkClaudeCodeUser(userId)) {
|
|
if (checkClaudeCodeUser(userId)) {
|
|
|
Long claudeCodeUserId = getClaudeCodeUserId(userId);
|
|
Long claudeCodeUserId = getClaudeCodeUserId(userId);
|
|
|
String url = String.format(CLAUDE_CODE_API_PREFIX + "api/keys/%s/%s", claudeCodeUserId, keyId);
|
|
String url = String.format(CLAUDE_CODE_API_PREFIX + "api/keys/%s/%s", claudeCodeUserId, keyId);
|
|
|
HttpResponse execute = HttpUtil.createRequest(Method.DELETE, url).execute();
|
|
HttpResponse execute = HttpUtil.createRequest(Method.DELETE, url).execute();
|
|
|
String responseBody = execute.body();
|
|
String responseBody = execute.body();
|
|
|
ClaudeCodeResp claudeCodeResp = Jsons.parseObject(responseBody, ClaudeCodeResp.class);
|
|
ClaudeCodeResp claudeCodeResp = Jsons.parseObject(responseBody, ClaudeCodeResp.class);
|
|
|
- if (claudeCodeResp.getSuccess()) {
|
|
|
|
|
- //更新用户apikey缓存
|
|
|
|
|
- updateUserApiKeysCache(keyValue);
|
|
|
|
|
|
|
+ if (!Constant.SUCCESS.equals(claudeCodeResp.getMessage())) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("删除失败");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|