Add refund received toggle button and filter options

- Add refund_received column to claude_payment_status table
- API endpoint POST /api/tools/refund-received/{email} to toggle
- Clickable badge in table to mark refund as received/not received
- Filter options: refund received / refund not received

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-06 01:46:45 +08:00
parent 663f99a510
commit d8d651240a
5 changed files with 87 additions and 26 deletions

View File

@@ -1270,6 +1270,23 @@ async def update_claude_payment_note(email: str, request: dict) -> ApiResponse:
return ApiResponse(success=True, message="保存成功")
return ApiResponse(success=False, message="保存失败")
@app.post("/api/tools/refund-received/{email}")
async def toggle_refund_received(email: str) -> ApiResponse:
"""切换退款已收到状态"""
email = email.strip()
try:
status = await db_manager.get_claude_payment_status(email)
current = status.get('refund_received', '0') if status else '0'
new_val = '0' if current == '1' else '1'
ok = await db_manager.update_claude_payment_note(email, refund_received=new_val)
if ok:
await cache.invalidate_payment()
return ApiResponse(success=True, data={"refund_received": new_val})
return ApiResponse(success=False, message="更新失败")
except Exception as e:
logger.error(f"切换退款状态失败: {e}")
return ApiResponse(success=False, message="操作失败")
@app.get("/api/tools/claude-payment-status")
async def get_claude_payment_status() -> ApiResponse:
"""获取所有账户的Claude支付缓存状态"""