fix: Cookie批量删除路由顺序修正(/batch必须在/{task_id}前)+ Statistic valueStyle改为styles.content
This commit is contained in:
@@ -124,23 +124,6 @@ def export_cookies(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/{task_id}")
|
|
||||||
def delete_cookie(
|
|
||||||
task_id: int,
|
|
||||||
db: Session = Depends(get_db),
|
|
||||||
current: User = Depends(require_permission("cookie:export")),
|
|
||||||
):
|
|
||||||
"""删除一条 Cookie 记录。"""
|
|
||||||
task = db.query(LoginTask).filter(LoginTask.id == task_id).first()
|
|
||||||
if not task:
|
|
||||||
raise HTTPException(status_code=404, detail="记录不存在")
|
|
||||||
task.cookie = ""
|
|
||||||
task.status = "failed"
|
|
||||||
task.message = "Cookie已清除"
|
|
||||||
db.commit()
|
|
||||||
return {"message": "已删除", "success": True}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/batch")
|
@router.delete("/batch")
|
||||||
def delete_cookies_batch(
|
def delete_cookies_batch(
|
||||||
task_ids: str = "",
|
task_ids: str = "",
|
||||||
@@ -160,3 +143,20 @@ def delete_cookies_batch(
|
|||||||
t.message = "Cookie已清除"
|
t.message = "Cookie已清除"
|
||||||
db.commit()
|
db.commit()
|
||||||
return {"message": f"已删除 {len(tasks)} 条", "deleted": len(tasks), "success": True}
|
return {"message": f"已删除 {len(tasks)} 条", "deleted": len(tasks), "success": True}
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/{task_id}")
|
||||||
|
def delete_cookie(
|
||||||
|
task_id: int,
|
||||||
|
db: Session = Depends(get_db),
|
||||||
|
current: User = Depends(require_permission("cookie:export")),
|
||||||
|
):
|
||||||
|
"""删除一条 Cookie 记录。"""
|
||||||
|
task = db.query(LoginTask).filter(LoginTask.id == task_id).first()
|
||||||
|
if not task:
|
||||||
|
raise HTTPException(status_code=404, detail="记录不存在")
|
||||||
|
task.cookie = ""
|
||||||
|
task.status = "failed"
|
||||||
|
task.message = "Cookie已清除"
|
||||||
|
db.commit()
|
||||||
|
return {"message": "已删除", "success": True}
|
||||||
|
|||||||
@@ -207,12 +207,12 @@ export default function AssignmentsPage() {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Card size="small">
|
<Card size="small">
|
||||||
<Statistic title="已分配" value={assignedCount} valueStyle={{ color: token.colorSuccess }} prefix={<CheckCircleOutlined />} />
|
<Statistic title="已分配" value={assignedCount} styles={{ content: { color: token.colorSuccess } }} prefix={<CheckCircleOutlined />} />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Card size="small">
|
<Card size="small">
|
||||||
<Statistic title="未分配" value={unassignedCount} valueStyle={{ color: token.colorError }} prefix={<SwapOutlined />} />
|
<Statistic title="未分配" value={unassignedCount} styles={{ content: { color: token.colorError } }} prefix={<SwapOutlined />} />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ export default function CookiePage() {
|
|||||||
<Statistic
|
<Statistic
|
||||||
title="已分配"
|
title="已分配"
|
||||||
value={assignedCount}
|
value={assignedCount}
|
||||||
valueStyle={{ color: token.colorSuccess }}
|
styles={{ content: { color: token.colorSuccess } }}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -264,7 +264,7 @@ export default function CookiePage() {
|
|||||||
<Statistic
|
<Statistic
|
||||||
title="未分配"
|
title="未分配"
|
||||||
value={unassignedCount}
|
value={unassignedCount}
|
||||||
valueStyle={{ color: token.colorError }}
|
styles={{ content: { color: token.colorError } }}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ export default function DashboardPage() {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Card>
|
<Card>
|
||||||
<Statistic title="成功" value={stats.success} valueStyle={{ color: token.colorSuccess }} />
|
<Statistic title="成功" value={stats.success} styles={{ content: { color: token.colorSuccess } }} />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Card>
|
<Card>
|
||||||
<Statistic title="失败" value={stats.failed} valueStyle={{ color: token.colorError }} />
|
<Statistic title="失败" value={stats.failed} styles={{ content: { color: token.colorError } }} />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
Reference in New Issue
Block a user