Add dummy /api/login_bonus handler

This commit is contained in:
Ethan O'Brien 2024-02-26 20:51:30 -06:00
parent f6cf70ab9f
commit 6a6eadc723
2 changed files with 22 additions and 0 deletions

View file

@ -75,6 +75,9 @@ async fn lottery_tutorial(req: HttpRequest, body: String) -> HttpResponse { rout
#[post("/api/lottery")]
async fn lottery(req: HttpRequest, body: String) -> HttpResponse { router::lottery::lottery(req, body) }
#[post("/api/login_bonus")]
async fn login_bonus(req: HttpRequest, body: String) -> HttpResponse { router::login::bonus(req, body) }
#[get("/api/notice/reward")]
async fn reward(req: HttpRequest) -> HttpResponse { router::notice::reward(req) }
@ -95,6 +98,7 @@ async fn main() -> std::io::Result<()> {
println!("Request: {}", req.path());
srv.call(req)
})
.service(login_bonus)
.service(reward)
.service(live_guest)
.service(live_clearrate)

View file

@ -22,3 +22,21 @@ pub fn dummy(req: HttpRequest, _body: String) -> HttpResponse {
};
global::send(resp)
}
pub fn bonus(req: HttpRequest, _body: String) -> HttpResponse {
//let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
let blank_header = HeaderValue::from_static("");
let key = req.headers().get("a6573cbe").unwrap_or(&blank_header).to_str().unwrap_or("");
let user = userdata::get_acc_home(key);
let resp = object!{
"code": 0,
"server_time": global::timestamp(),
"data": {
"login_bonus_list": [],
"start_time": global::timestamp(),
"clear_mission_ids": user["clear_mission_ids"].clone()
}
};
global::send(resp)
}