mirror of
https://github.com/yoncodes/BD2PS.git
synced 2026-08-05 06:12:14 +02:00
changed file section
This commit is contained in:
21
httpserver/src/routes/game/id/id_card_preset_delete.rs
Normal file
21
httpserver/src/routes/game/id/id_card_preset_delete.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::IdCardPresetDeleteRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::id::id_card_preset_delete;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("IdCardPresetDelete")]
|
||||
async fn id_card_preset_delete_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req =
|
||||
parse_packet::<IdCardPresetDeleteRequest>("IdCardPresetDelete", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse IdCardPresetDelete: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = id_card_preset_delete::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/id/id_card_preset_info.rs
Normal file
20
httpserver/src/routes/game/id/id_card_preset_info.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::IdCardPresetInfoRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::id::id_card_preset_info;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("IdCardPresetInfo")]
|
||||
async fn id_card_preset_info_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<IdCardPresetInfoRequest>("IdCardPresetInfo", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse IdCardPresetInfo: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = id_card_preset_info::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/id/id_card_preset_save.rs
Normal file
20
httpserver/src/routes/game/id/id_card_preset_save.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::IdCardPresetSaveRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::id::id_card_preset_save;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("IdCardPresetSave")]
|
||||
async fn id_card_preset_save_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<IdCardPresetSaveRequest>("IdCardPresetSave", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse IdCardPresetSave: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = id_card_preset_save::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/id/id_card_recovery.rs
Normal file
20
httpserver/src/routes/game/id/id_card_recovery.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::IdCardRecoveryRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::id::id_card_recovery;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("IdCardRecovery")]
|
||||
async fn id_card_recovery_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<IdCardRecoveryRequest>("IdCardRecovery", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse IdCardRecovery: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = id_card_recovery::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/id/id_card_save.rs
Normal file
20
httpserver/src/routes/game/id/id_card_save.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::IdCardSaveRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::id::id_card_save;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("IdCardSave")]
|
||||
async fn id_card_save_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<IdCardSaveRequest>("IdCardSave", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse IdCardSave: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = id_card_save::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/id/id_card_shop_buy.rs
Normal file
20
httpserver/src/routes/game/id/id_card_shop_buy.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::IdCardShopBuyRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::id::id_card_shop_buy;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("IdCardShopBuy")]
|
||||
async fn id_card_shop_buy_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<IdCardShopBuyRequest>("IdCardShopBuy", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse IdCardShopBuy: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = id_card_shop_buy::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
20
httpserver/src/routes/game/id/id_card_shop_info.rs
Normal file
20
httpserver/src/routes/game/id/id_card_shop_info.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use actix_web::{put, web, HttpResponse, Result};
|
||||
use bd2::proto::proto_net::IdCardShopInfoRequest;
|
||||
use crypto::network::parse_packet;
|
||||
use gameserver::logic::game::id::id_card_shop_info;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[put("IdCardShopInfo")]
|
||||
async fn id_card_shop_info_handler(
|
||||
pool: web::Data<SqlitePool>,
|
||||
body: String,
|
||||
user_id: web::ReqData<i64>,
|
||||
) -> Result<HttpResponse> {
|
||||
let uid = *user_id;
|
||||
let req = parse_packet::<IdCardShopInfoRequest>("IdCardShopInfo", &body).map_err(|e| {
|
||||
tracing::warn!("Failed to parse IdCardShopInfo: {}", e);
|
||||
actix_web::error::ErrorBadRequest("Invalid packet")
|
||||
})?;
|
||||
let response = id_card_shop_info::handle(&pool, uid, req).await;
|
||||
Ok(HttpResponse::Ok().json(response))
|
||||
}
|
||||
7
httpserver/src/routes/game/id/mod.rs
Normal file
7
httpserver/src/routes/game/id/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
pub mod id_card_preset_delete;
|
||||
pub mod id_card_preset_info;
|
||||
pub mod id_card_preset_save;
|
||||
pub mod id_card_recovery;
|
||||
pub mod id_card_save;
|
||||
pub mod id_card_shop_buy;
|
||||
pub mod id_card_shop_info;
|
||||
Reference in New Issue
Block a user