|
|
@@ -466,9 +466,9 @@ public class CodexServiceImpl implements CodexService {
|
|
|
public ClaudeCodeResp createApiKeys(ClaudeCodeApiKeysReq req) throws Exception {
|
|
|
Long userId = req.getUserId();
|
|
|
if (checkCodexUser(userId)) {
|
|
|
- Long claudeCodeUserId = getCodexUserId(userId);
|
|
|
- Assert.notNull(claudeCodeUserId, "您的codex账号已过期");
|
|
|
- String apiKeyUrl = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/users/%s/keys", claudeCodeUserId);
|
|
|
+ Long codexUserId = getCodexUserId(userId);
|
|
|
+ Assert.notNull(codexUserId, "您的codex账号已过期");
|
|
|
+ String apiKeyUrl = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/users/%s/keys", codexUserId);
|
|
|
Map<String, Object> parmas = new HashMap<>();
|
|
|
parmas.put("name", req.getName());
|
|
|
Integer expiresDays = req.getExpiresDays();
|
|
|
@@ -489,8 +489,8 @@ public class CodexServiceImpl implements CodexService {
|
|
|
Long userId = delReq.getUserId();
|
|
|
Long keyId = delReq.getKeyId();
|
|
|
if (checkCodexUser(userId)) {
|
|
|
- Long claudeCodeUserId = getCodexUserId(userId);
|
|
|
- String url = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/keys/%s/%s", claudeCodeUserId, keyId);
|
|
|
+ Long codexUserId = getCodexUserId(userId);
|
|
|
+ String url = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/keys/%s/%s", codexUserId, keyId);
|
|
|
HttpResponse execute = HttpUtil.createRequest(Method.DELETE, url).header(Constant.CLAUDE_CODE_HEARD_KEY, Constant.CLAUDE_CODE_API_ADMIN_KEY).setConnectionTimeout(Constant.CONNECT_MILLISECONDS).execute();
|
|
|
String responseBody = execute.body();
|
|
|
ClaudeCodeResp claudeCodeResp = Jsons.parseObject(responseBody, ClaudeCodeResp.class);
|
|
|
@@ -503,9 +503,9 @@ public class CodexServiceImpl implements CodexService {
|
|
|
|
|
|
@Override
|
|
|
public List<ClaudeCodeUserApiKeysView> getUserApiKeys(long userId) throws Exception {
|
|
|
- Long claudeCodeUserId = getCodexUserId(userId);
|
|
|
- if (claudeCodeUserId != null) {
|
|
|
- String url = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/users/%s/keys", claudeCodeUserId);
|
|
|
+ Long codexUserId = getCodexUserId(userId);
|
|
|
+ if (codexUserId != null) {
|
|
|
+ String url = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/users/%s/keys", codexUserId);
|
|
|
ClaudeCodeResp claudeCodeResp = executeClaudeCodeGetApi(url);
|
|
|
return Jsons.parseList(claudeCodeResp.getData(), ClaudeCodeUserApiKeysView.class);
|
|
|
}
|
|
|
@@ -1369,7 +1369,7 @@ public class CodexServiceImpl implements CodexService {
|
|
|
*/
|
|
|
public Boolean checkCodexUser(Long userId) {
|
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
- Integer count = relationMapper.selectCountByGoodsId(userIdList, Constant.CLAUDE_CODE_GOODS_ID, DateTime.now());
|
|
|
+ Integer count = relationMapper.selectCountByGoodsId(userIdList, Constant.CODEX_GOODS_ID, DateTime.now());
|
|
|
return count > 0;
|
|
|
}
|
|
|
|