fix(main): 修正 create_server_config 函数结构

This commit is contained in:
2026-04-27 09:26:51 +08:00
parent bb20d82d49
commit 48ed2ca9ea

View File

@@ -79,28 +79,26 @@ fn create_server_config(
.service(mock_login) // #[get("/api/mock-login")](沙箱测试用) .service(mock_login) // #[get("/api/mock-login")](沙箱测试用)
.service(refresh_token) // #[post("/api/refresh-token")](公开接口,无需认证) .service(refresh_token) // #[post("/api/refresh-token")](公开接口,无需认证)
.service(get_weather_details) // #[get("/weather/details")](支持 JWT 或 temp_token公开接口 .service(get_weather_details) // #[get("/weather/details")](支持 JWT 或 temp_token公开接口
.service(health_check) // #[get("/health")](公开接口,无需认证) .service(health_check)
// 网页登录(无需 JWT登录码本身就是认证凭证- 必须在 JWT scope 之前注册 .service(web_generate_login_code)
.service(web_generate_login_code) // POST /api/web-login/code无需 JWT .service(web_login_confirm)
.service(web_login_confirm) // POST /api/web-login/confirm无需 JWT
// 受保护接口JWT
.service( .service(
web::scope("") web::scope("")
.wrap(from_fn(jwt_middleware)) .wrap(from_fn(jwt_middleware))
.service(post_weather_data) // #[post("/api/post-weather-data")] .service(post_weather_data)
.service(get_weather_brief) // #[get("/api/weather")] .service(get_weather_brief)
.service(generate_temp_token_handler) // #[post("/api/generate-temp-token/{resource_id}")] .service(generate_temp_token_handler)
.service(delete_weather) // #[delete("/api/weather/delete/{id}")] .service(delete_weather)
.service(get_current_user_profile) // #[get("/api/user/profile")] .service(get_current_user_profile)
.service(save_user_profile) // #[put("/api/user/profile")] .service(save_user_profile)
.service(admin_get_user) // #[get("/api/admin/users/{id}")] .service(admin_get_user)
.service(admin_update_user_payment) // #[put("/api/admin/users/{id}/payment")] .service(admin_update_user_payment)
.service(create_order) // #[post("/api/payment/create-order")] .service(create_order)
.service(mock_confirm) // #[post("/api/payment/mock-confirm")] .service(mock_confirm)
.service(get_user_quota) // #[get("/api/user/quota")] .service(get_user_quota)
.service(get_favorites) // #[get("/api/favorites")] .service(get_favorites)
.service(add_favorite) // #[post("/api/favorites/{id}")] .service(add_favorite)
.service(remove_favorite) // #[delete("/api/favorites/{id}")] .service(remove_favorite)
) )
} }