|
|
@@ -243,17 +243,18 @@ public class ClaudeCodeServiceImpl implements ClaudeCodeService {
|
|
|
if (claudeCodeUserId != null) {
|
|
|
String url = String.format(CLAUDE_CODE_API_PREFIX + "api/users/%s/credits/history?page=%s&limit=%s&type=%s", claudeCodeUserId, page, limit, type);
|
|
|
String responseBody = executeClaudeCodeGetApi(url);
|
|
|
- ClaudeCodePointsHistoryResp historyResp = Jsons.parseObject(responseBody, ClaudeCodePointsHistoryResp.class);
|
|
|
+ ClaudeCodeResp claudeCodeResp = Jsons.parseObject(responseBody, ClaudeCodeResp.class);
|
|
|
+ ClaudeCodePointsHistoryResp historyResp = Jsons.parseObject(claudeCodeResp.getData(), ClaudeCodePointsHistoryResp.class);
|
|
|
return historyResp;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ClaudeCodeResp getUserPointsStatisticsData(Long userId) throws Exception {
|
|
|
+ public ClaudeCodeResp getUserPointsStatisticsData(Long userId, Integer days) throws Exception {
|
|
|
Long claudeCodeUserId = getClaudeCodeUserId(userId);
|
|
|
if (claudeCodeUserId != null) {
|
|
|
- String url = String.format(CLAUDE_CODE_API_PREFIX + "api/users/%s/usage/stats", claudeCodeUserId);
|
|
|
+ String url = String.format(CLAUDE_CODE_API_PREFIX + "api/users/%s/usage/stats?days=%s", claudeCodeUserId, days);
|
|
|
String responseBody = executeClaudeCodeGetApi(url);
|
|
|
ClaudeCodeResp claudeCodeResp = Jsons.parseObject(responseBody, ClaudeCodeResp.class);
|
|
|
return claudeCodeResp;
|
|
|
@@ -286,10 +287,15 @@ public class ClaudeCodeServiceImpl implements ClaudeCodeService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ClaudeCodeResp getCreditsAnalytics(Long userId, String start, String end, String tz, String page, String limit, String order, String type) throws Exception {
|
|
|
+ public ClaudeCodeResp getCreditsAnalytics(Long userId, String start, String end, String tz, Integer page, Integer limit, String order, String type) throws Exception {
|
|
|
Long claudeCodeUserId = getClaudeCodeUserId(userId);
|
|
|
+ if (start == null) {
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ start = DateUtil.offsetDay(now, -1).toString();
|
|
|
+ end = now.toString();
|
|
|
+ }
|
|
|
if (claudeCodeUserId != null) {
|
|
|
- String url = String.format(CLAUDE_CODE_API_PREFIX + "api/users/%s/credits/analytics", claudeCodeUserId);
|
|
|
+ String url = String.format(CLAUDE_CODE_API_PREFIX + "api/users/%s/credits/analytics?start=%s&end=%s&tz=%s&page=%s&limit=%s&order=%s&type=%s", claudeCodeUserId, start, end, tz, page, limit, order, type);
|
|
|
String responseBody = executeClaudeCodeGetApi(url);
|
|
|
ClaudeCodeResp claudeCodeResp = Jsons.parseObject(responseBody, ClaudeCodeResp.class);
|
|
|
return claudeCodeResp;
|