mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
feat: 增加账号session窗口管理与显示。后续可以据此优化账号轮转逻辑。
scripts目录有相关管理脚本,请自行探索
This commit is contained in:
@@ -2538,6 +2538,34 @@ const app = createApp({
|
||||
return number.toLocaleString();
|
||||
},
|
||||
|
||||
// 格式化会话窗口时间
|
||||
formatSessionWindow(windowStart, windowEnd) {
|
||||
if (!windowStart || !windowEnd) return '--';
|
||||
|
||||
const start = new Date(windowStart);
|
||||
const end = new Date(windowEnd);
|
||||
|
||||
const startHour = start.getHours().toString().padStart(2, '0');
|
||||
const startMin = start.getMinutes().toString().padStart(2, '0');
|
||||
const endHour = end.getHours().toString().padStart(2, '0');
|
||||
const endMin = end.getMinutes().toString().padStart(2, '0');
|
||||
|
||||
return `${startHour}:${startMin} - ${endHour}:${endMin}`;
|
||||
},
|
||||
|
||||
// 格式化剩余时间
|
||||
formatRemainingTime(minutes) {
|
||||
if (!minutes || minutes <= 0) return '已结束';
|
||||
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const mins = minutes % 60;
|
||||
|
||||
if (hours > 0) {
|
||||
return `${hours}小时${mins}分钟`;
|
||||
}
|
||||
return `${mins}分钟`;
|
||||
},
|
||||
|
||||
// 格式化运行时间
|
||||
formatUptime(seconds) {
|
||||
if (!seconds) return '0s';
|
||||
|
||||
@@ -1019,6 +1019,7 @@
|
||||
</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">代理</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">今日使用</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">会话窗口</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">最后使用</th>
|
||||
<th class="px-6 py-4 text-left text-xs font-bold text-gray-700 uppercase tracking-wider">操作</th>
|
||||
</tr>
|
||||
@@ -1107,6 +1108,31 @@
|
||||
</div>
|
||||
<div v-else class="text-gray-400 text-xs">暂无数据</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div v-if="account.platform === 'claude' && account.sessionWindow && account.sessionWindow.hasActiveWindow" class="space-y-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-24 bg-gray-200 rounded-full h-2">
|
||||
<div class="bg-gradient-to-r from-blue-500 to-indigo-600 h-2 rounded-full transition-all duration-300"
|
||||
:style="{ width: account.sessionWindow.progress + '%' }"></div>
|
||||
</div>
|
||||
<span class="text-xs text-gray-700 font-medium min-w-[32px]">
|
||||
{{ account.sessionWindow.progress }}%
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-xs text-gray-600">
|
||||
<div>{{ formatSessionWindow(account.sessionWindow.windowStart, account.sessionWindow.windowEnd) }}</div>
|
||||
<div v-if="account.sessionWindow.remainingTime > 0" class="text-indigo-600 font-medium">
|
||||
剩余 {{ formatRemainingTime(account.sessionWindow.remainingTime) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="account.platform === 'claude'" class="text-gray-400 text-sm">
|
||||
<i class="fas fa-minus"></i>
|
||||
</div>
|
||||
<div v-else class="text-gray-400 text-sm">
|
||||
<span class="text-xs">N/A</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ account.lastUsedAt ? new Date(account.lastUsedAt).toLocaleDateString() : '从未使用' }}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user