@@ -94,24 +94,6 @@ def update_site(
94
94
return schemas .Response (success = True )
95
95
96
96
97
- @router .delete ("/{site_id}" , summary = "删除站点" , response_model = schemas .Response )
98
- def delete_site (
99
- site_id : int ,
100
- db : Session = Depends (get_db ),
101
- _ : User = Depends (get_current_active_superuser )
102
- ) -> Any :
103
- """
104
- 删除站点
105
- """
106
- Site .delete (db , site_id )
107
- # 插件站点删除
108
- EventManager ().send_event (EventType .SiteDeleted ,
109
- {
110
- "site_id" : site_id
111
- })
112
- return schemas .Response (success = True )
113
-
114
-
115
97
@router .get ("/cookiecloud" , summary = "CookieCloud同步" , response_model = schemas .Response )
116
98
def cookie_cloud_sync (background_tasks : BackgroundTasks ,
117
99
_ : schemas .TokenPayload = Depends (verify_token )) -> Any :
@@ -141,6 +123,21 @@ def reset(db: Session = Depends(get_db),
141
123
return schemas .Response (success = True , message = "站点已重置!" )
142
124
143
125
126
+ @router .post ("/priorities" , summary = "批量更新站点优先级" , response_model = schemas .Response )
127
+ def update_sites_priority (
128
+ priorities : List [dict ],
129
+ db : Session = Depends (get_db ),
130
+ _ : schemas .TokenPayload = Depends (verify_token )) -> Any :
131
+ """
132
+ 批量更新站点优先级
133
+ """
134
+ for priority in priorities :
135
+ site = Site .get (db , priority .get ("id" ))
136
+ if site :
137
+ site .update (db , {"pri" : priority .get ("pri" )})
138
+ return schemas .Response (success = True )
139
+
140
+
144
141
@router .get ("/cookie/{site_id}" , summary = "更新站点Cookie&UA" , response_model = schemas .Response )
145
142
def update_cookie (
146
143
site_id : int ,
@@ -293,3 +290,21 @@ def read_site(
293
290
detail = f"站点 { site_id } 不存在" ,
294
291
)
295
292
return site
293
+
294
+
295
+ @router .delete ("/{site_id}" , summary = "删除站点" , response_model = schemas .Response )
296
+ def delete_site (
297
+ site_id : int ,
298
+ db : Session = Depends (get_db ),
299
+ _ : User = Depends (get_current_active_superuser )
300
+ ) -> Any :
301
+ """
302
+ 删除站点
303
+ """
304
+ Site .delete (db , site_id )
305
+ # 插件站点删除
306
+ EventManager ().send_event (EventType .SiteDeleted ,
307
+ {
308
+ "site_id" : site_id
309
+ })
310
+ return schemas .Response (success = True )
0 commit comments