mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Implement live end endpoint
This commit is contained in:
parent
841d2b0acd
commit
05bf6c011e
2 changed files with 37 additions and 6 deletions
|
@ -57,6 +57,9 @@ async fn event(req: HttpRequest, body: String) -> HttpResponse { router::event::
|
||||||
#[post("/api/live/start")]
|
#[post("/api/live/start")]
|
||||||
async fn live_start(req: HttpRequest, body: String) -> HttpResponse { router::live::start(req, body) }
|
async fn live_start(req: HttpRequest, body: String) -> HttpResponse { router::live::start(req, body) }
|
||||||
|
|
||||||
|
#[post("/api/live/end")]
|
||||||
|
async fn live_end(req: HttpRequest, body: String) -> HttpResponse { router::live::end(req, body) }
|
||||||
|
|
||||||
#[get("/api/live/clearRate")]
|
#[get("/api/live/clearRate")]
|
||||||
async fn live_clearrate(req: HttpRequest) -> HttpResponse { router::live::clearrate(req) }
|
async fn live_clearrate(req: HttpRequest) -> HttpResponse { router::live::clearrate(req) }
|
||||||
|
|
||||||
|
@ -92,6 +95,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
.service(live_guest)
|
.service(live_guest)
|
||||||
.service(live_clearrate)
|
.service(live_clearrate)
|
||||||
.service(live_start)
|
.service(live_start)
|
||||||
|
.service(live_end)
|
||||||
.service(chat_home)
|
.service(chat_home)
|
||||||
.service(chat_end)
|
.service(chat_end)
|
||||||
.service(chat_start)
|
.service(chat_start)
|
||||||
|
|
|
@ -2,8 +2,8 @@ use json;
|
||||||
use json::object;
|
use json::object;
|
||||||
use crate::router::global;
|
use crate::router::global;
|
||||||
//use crate::encryption;
|
//use crate::encryption;
|
||||||
use actix_web::{HttpResponse, HttpRequest};
|
use actix_web::{HttpResponse, HttpRequest, http::header::HeaderValue};
|
||||||
//use crate::router::userdata;
|
use crate::router::userdata;
|
||||||
|
|
||||||
pub fn guest(_req: HttpRequest, _body: String) -> HttpResponse {
|
pub fn guest(_req: HttpRequest, _body: String) -> HttpResponse {
|
||||||
//let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
//let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||||
|
@ -20,10 +20,6 @@ pub fn guest(_req: HttpRequest, _body: String) -> HttpResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(_req: HttpRequest, _body: String) -> HttpResponse {
|
pub fn start(_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(key, "");
|
|
||||||
|
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
"code": 0,
|
"code": 0,
|
||||||
|
@ -33,6 +29,37 @@ pub fn start(_req: HttpRequest, _body: String) -> HttpResponse {
|
||||||
global::send(resp)
|
global::send(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn end(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 uid = req.headers().get("aoharu-user-id").unwrap_or(&blank_header).to_str().unwrap_or("");
|
||||||
|
let user = userdata::get_acc(key, uid);
|
||||||
|
let user2 = userdata::get_acc_home(key, uid);
|
||||||
|
|
||||||
|
let resp = object!{
|
||||||
|
"code": 0,
|
||||||
|
"server_time": global::timestamp(),
|
||||||
|
"data": {
|
||||||
|
"item_list": user["item_list"].clone(),
|
||||||
|
"point_list": user["point_list"].clone(),
|
||||||
|
"live": null, //likely a server bug?
|
||||||
|
"clear_master_live_mission_ids": [],
|
||||||
|
"user": user["user"].clone(),
|
||||||
|
"stamina": user["stamina"].clone(),
|
||||||
|
"character_list": user["character_list"].clone(),
|
||||||
|
"reward_list": [],
|
||||||
|
"gift_list": user2["home"]["gift_list"].clone(),
|
||||||
|
"clear_mission_ids": user2["clear_mission_ids"].clone(),
|
||||||
|
"event_point_reward_list": [],
|
||||||
|
"ranking_change": [],
|
||||||
|
"event_member": [],
|
||||||
|
"event_ranking_data": []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
global::send(resp)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn clearrate(_req: HttpRequest) -> HttpResponse {
|
pub fn clearrate(_req: HttpRequest) -> HttpResponse {
|
||||||
|
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
|
|
Loading…
Add table
Reference in a new issue