()
| 2991 | } |
| 2992 | |
| 2993 | async function resetAllUsageStats() { |
| 2994 | if (!confirm('确定要重置所有文件的使用统计吗?此操作不可恢复!')) return; |
| 2995 | |
| 2996 | try { |
| 2997 | const response = await fetch('./usage/reset', { |
| 2998 | method: 'POST', |
| 2999 | headers: getAuthHeaders(), |
| 3000 | body: JSON.stringify({}) |
| 3001 | }); |
| 3002 | |
| 3003 | const data = await response.json(); |
| 3004 | |
| 3005 | if (response.ok && data.success) { |
| 3006 | showStatus(data.message, 'success'); |
| 3007 | await refreshUsageStats(); |
| 3008 | } else { |
| 3009 | showStatus(`重置失败: ${data.message || data.detail || data.error || '未知错误'}`, 'error'); |
| 3010 | } |
| 3011 | } catch (error) { |
| 3012 | showStatus(`网络错误: ${error.message}`, 'error'); |
| 3013 | } |
| 3014 | } |
| 3015 | |
| 3016 | // ===================================================================== |
| 3017 | // 冷却倒计时自动更新 |
nothing calls this directly
no test coverage detected