|
|
@@ -1,5 +1,6 @@
|
|
|
package com.cyksj.service.codex.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
@@ -319,7 +320,7 @@ public class CodexServiceImpl implements CodexService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ClaudeCodeResp getJavaUserAnalytics(Long userId) {
|
|
|
+ public ClaudeCodeResp getJavaUserAnalytics(Long userId, String start, String end) {
|
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
CodexUser codexUser = codexUserMapper.selectOne(Wrappers.lambdaQuery(CodexUser.class).in(CodexUser::getUserId, userIdList).last("limit 1"));
|
|
|
|
|
|
@@ -327,8 +328,14 @@ public class CodexServiceImpl implements CodexService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ if (start == null) {
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ start = DateUtil.offsetDay(now, -1).toString();
|
|
|
+ end = now.toString();
|
|
|
+ }
|
|
|
+
|
|
|
// 调用Codex API获取用户分析数据
|
|
|
- String analyticsUrl = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/openai/users/%s/analytics", codexUser.getUserId());
|
|
|
+ String analyticsUrl = String.format(Constant.CLAUDE_CODE_API_PREFIX + "api/openai/users/%s/analytics?start=%s&end=%s", codexUser.getUserId(), start, end);
|
|
|
ClaudeCodeResp codexResp = executeCodexGetApi(analyticsUrl);
|
|
|
|
|
|
return codexResp;
|