mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2026-07-12 00:32:20 +08:00
Split giant router api function mess
This commit is contained in:
161
src/router.rs
161
src/router.rs
@@ -33,13 +33,30 @@ mod master_data;
|
||||
use actix_web::{
|
||||
HttpResponse,
|
||||
HttpRequest,
|
||||
http::header::HeaderValue,
|
||||
body::{BoxBody, MessageBody},
|
||||
dev::{ServiceRequest, ServiceResponse},
|
||||
middleware::{from_fn, Next},
|
||||
http::header::HeaderMap
|
||||
};
|
||||
use jzon::{JsonValue, object};
|
||||
use crate::encryption;
|
||||
|
||||
fn unhandled(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
// Requests without client headers (a browser) get the webui
|
||||
async fn webui_fallback(req: ServiceRequest, next: Next<impl MessageBody + 'static>) -> Result<ServiceResponse<BoxBody>, actix_web::Error> {
|
||||
let is_from_game = req.headers().get("aoharu-asset-version").is_some() || req.path().starts_with("/api/webui");
|
||||
if !is_from_game {
|
||||
let req = req.into_parts().0;
|
||||
let resp = if crate::get_args().hidden {
|
||||
not_found(req.headers())
|
||||
} else {
|
||||
webui::main(req.clone())
|
||||
};
|
||||
return Ok(ServiceResponse::new(req, resp));
|
||||
}
|
||||
Ok(next.call(req).await?.map_into_boxed_body())
|
||||
}
|
||||
|
||||
fn unhandled(req: &HttpRequest, body: String) -> Option<JsonValue> {
|
||||
if body != String::new() {
|
||||
println!("{}", encryption::decrypt_packet(&body).unwrap_or(body));
|
||||
}
|
||||
@@ -56,117 +73,16 @@ fn not_found(headers: &HeaderMap) -> HttpResponse {
|
||||
global::send(rv, 0, headers)
|
||||
}
|
||||
|
||||
// Fallback for paths no actix route matched. Game endpoints live in each module's routes()
|
||||
async fn api_req(req: HttpRequest, body: String) -> HttpResponse {
|
||||
let headers = req.headers().clone();
|
||||
let args = crate::get_args();
|
||||
if args.hidden && (req.path().starts_with("/api/webui/") || !(req.path().starts_with("/api") || req.path().starts_with("/v1.0"))) {
|
||||
return not_found(&headers);
|
||||
return not_found(req.headers());
|
||||
} else if !req.path().starts_with("/api") && !req.path().starts_with("/v1.0") {
|
||||
return webui::main(req);
|
||||
}
|
||||
let blank_header = HeaderValue::from_static("");
|
||||
let uid = req.headers().get("aoharu-user-id").unwrap_or(&blank_header).to_str().unwrap_or("").parse::<i64>().unwrap_or(0);
|
||||
let resp: Option<JsonValue> = if req.method() == "POST" {
|
||||
match req.path() {
|
||||
"/api/debug/error" => debug::error(req, body),
|
||||
"/api/start" => start::start(req, body),
|
||||
"/api/start/assetHash" => start::asset_hash(req, body),
|
||||
"/api/dummy/login" => login::dummy(req, body),
|
||||
"/api/user" => user::user_post(req, body),
|
||||
"/api/chat/home" => chat::home(req, body),
|
||||
"/api/chat/talk/start" => chat::start(req, body),
|
||||
"/api/chat/talk/end" => chat::end(req, body),
|
||||
"/api/story/read" => story::read(req, body),
|
||||
"/api/user/initialize" => user::initialize(req, body),
|
||||
"/api/user/detail" => user::detail(req, body),
|
||||
"/api/gift" => user::gift(req, body),
|
||||
"/api/deck" => user::deck(req, body),
|
||||
"/api/tutorial" => tutorial::tutorial(req, body),
|
||||
"/api/friend" => friend::friend(req, body),
|
||||
"/api/friend/search" => friend::search(req, body),
|
||||
"/api/friend/search/recommend" => friend::recommend(req, body),
|
||||
"/api/friend/request" => friend::request(req, body),
|
||||
"/api/friend/request/approve" => friend::approve(req, body),
|
||||
"/api/friend/request/cancel" => friend::cancel(req, body),
|
||||
"/api/friend/delete" => friend::delete(req, body),
|
||||
"/api/live/guest" => live::guest(req, body),
|
||||
"/api/live/mission" => live::mission(req, body),
|
||||
"/api/live/ranking" => clear_rate::ranking(req, body),
|
||||
"/api/event" => event::event(req, body),
|
||||
"/api/event/star_event" => event::star_event(req, body),
|
||||
"/api/event/set/member" => event::set_member(req, body),
|
||||
"/api/event/ranking" => event::ranking(req, body).await,
|
||||
"/api/event_star_live/change_target_music" => event::change_target_music(req, body),
|
||||
"/api/event_star_live/start" => live::event_start(req, body),
|
||||
"/api/event_star_live/end" => event::event_end(req, body),
|
||||
"/api/event_star_live/skip" => event::event_skip(req, body),
|
||||
"/api/live/start" => live::start(req, body),
|
||||
"/api/live/end" => live::end(req, body),
|
||||
"/api/live/skip" => live::skip(req, body),
|
||||
"/api/live/retire" => live::retire(req, body),
|
||||
"/api/live/continue" => live::continuee(req, body),
|
||||
"/api/live/reward" => live::reward(req, body),
|
||||
"/api/mission/clear" => mission::clear(req, body),
|
||||
"/api/mission/receive" => mission::receive(req, body),
|
||||
"/api/home/preset" => home::preset(req, body),
|
||||
"/api/lottery/get_tutorial" => lottery::tutorial(req, body),
|
||||
"/api/lottery" => lottery::lottery_post(req, body),
|
||||
"/api/login_bonus" => login::bonus(req, body),
|
||||
"/api/login_bonus/event" => login::bonus_event(req, body),
|
||||
"/api/notice/reward" => notice::reward_post(req, body),
|
||||
"/api/user/getmigrationcode" => user::get_migration_code(req, body),
|
||||
"/api/user/registerpassword" => user::register_password(req, body),
|
||||
"/api/user/migration" => user::migration(req, body),
|
||||
"/api/user/gglrequestmigrationcode" => user::request_migration_code(req, body),
|
||||
"/api/user/gglverifymigrationcode" => user::verify_migration_code(req, body),
|
||||
"/api/serial_code" => serial_code::serial_code(req, body),
|
||||
"/api/card/reinforce" => card::reinforce(req, body),
|
||||
"/api/card/skill/reinforce" => card::skill_reinforce(req, body),
|
||||
"/api/card/evolve" => card::evolve(req, body),
|
||||
"/api/shop/buy" => shop::buy(req, body),
|
||||
"/api/user/getregisteredplatformlist" => user::getregisteredplatformlist(req, body),
|
||||
"/api/user/sif/migrate" => user::sif_migrate(req, body).await,
|
||||
"/api/user/ss/migrate" => user::sifas_migrate(req, body),
|
||||
"/api/exchange" => exchange::exchange_post(req, body),
|
||||
"/api/item/use" => items::use_item_req(req, body),
|
||||
_ => unhandled(req, body)
|
||||
}
|
||||
} else {
|
||||
match req.path() {
|
||||
"/api/user" => user::user(req),
|
||||
"/api/gift" => home::gift_get(req),
|
||||
"/api/purchase" => purchase::purchase(req),
|
||||
"/api/friend/ids" => friend::ids(req),
|
||||
"/api/live/clearRate" => clear_rate::clearrate(req).await,
|
||||
"/api/mission" => mission::mission(req),
|
||||
"/api/home" => home::home(req),
|
||||
"/api/home/preset" => home::preset_get(req),
|
||||
"/api/lottery" => lottery::lottery(req),
|
||||
"/api/notice/reward" => notice::reward(req),
|
||||
"/api/serial_code/events" => serial_code::events(req),
|
||||
"/api/album/sif" => user::sif(req),
|
||||
"/api/home/announcement" => user::announcement(req),
|
||||
"/api/shop" => shop::shop(req),
|
||||
"/api/exchange" => exchange::exchange(req),
|
||||
"/api/location" => location::location(req),
|
||||
_ => unhandled(req, body)
|
||||
}
|
||||
};
|
||||
if resp.is_some() {
|
||||
let rv = object!{
|
||||
"code": 0,
|
||||
"server_time": global::timestamp(),
|
||||
"data": resp.unwrap()
|
||||
};
|
||||
global::send(rv, uid, &headers)
|
||||
} else {
|
||||
let rv = object!{
|
||||
"code": 4,//Idontnermemrmemremremermrme <-- I think I was not okay when I put this note because I dont remmebr doing it
|
||||
"server_time": global::timestamp(),
|
||||
"message": ""
|
||||
};
|
||||
global::send(rv, uid, &headers)
|
||||
}
|
||||
let resp = unhandled(&req, body);
|
||||
global::api(&req, resp)
|
||||
}
|
||||
|
||||
pub async fn request(req: HttpRequest, body: String) -> HttpResponse {
|
||||
@@ -214,6 +130,37 @@ pub fn configure(cfg: &mut actix_web::web::ServiceConfig) {
|
||||
actix_web::web::scope("/api")
|
||||
.configure(asset_lists::routes)
|
||||
.configure(master_data::routes)
|
||||
.service(
|
||||
actix_web::web::scope("")
|
||||
.wrap(from_fn(webui_fallback))
|
||||
// Split between user (claiming) and home (listing)
|
||||
.service(
|
||||
actix_web::web::resource("/gift")
|
||||
.route(actix_web::web::get().to(home::gift_get))
|
||||
.route(actix_web::web::post().to(user::gift))
|
||||
)
|
||||
.configure(card::routes)
|
||||
.configure(chat::routes)
|
||||
.configure(debug::routes)
|
||||
.configure(event::routes)
|
||||
.configure(exchange::routes)
|
||||
.configure(friend::routes)
|
||||
.configure(home::routes)
|
||||
.configure(items::routes)
|
||||
.configure(live::routes)
|
||||
.configure(location::routes)
|
||||
.configure(login::routes)
|
||||
.configure(lottery::routes)
|
||||
.configure(mission::routes)
|
||||
.configure(notice::routes)
|
||||
.configure(purchase::routes)
|
||||
.configure(serial_code::routes)
|
||||
.configure(shop::routes)
|
||||
.configure(start::routes)
|
||||
.configure(story::routes)
|
||||
.configure(tutorial::routes)
|
||||
.configure(user::routes)
|
||||
)
|
||||
);
|
||||
cfg.service(
|
||||
actix_web::web::scope("/v1.0")
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{userdata, global, items, databases};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/card")
|
||||
.route("/reinforce", web::post().to(reinforce))
|
||||
.route("/skill/reinforce", web::post().to(skill_reinforce))
|
||||
.route("/evolve", web::post().to(evolve))
|
||||
);
|
||||
}
|
||||
|
||||
// Chats will only ever be used when evolving
|
||||
fn do_reinforce(user: &mut JsonValue, body: &JsonValue, exp_id: &str, money_multiplier: i64, evolve: bool, missions: &mut JsonValue, chats: &mut JsonValue, clear_mission_ids: &mut JsonValue) -> JsonValue {
|
||||
for (i, data) in user["card_list"].members().enumerate() {
|
||||
@@ -52,7 +61,7 @@ fn do_reinforce(user: &mut JsonValue, body: &JsonValue, exp_id: &str, money_mult
|
||||
object!{}
|
||||
}
|
||||
|
||||
pub fn reinforce(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn reinforce(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -62,15 +71,15 @@ pub fn reinforce(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
card: card,
|
||||
item_list: user["item_list"].clone(),
|
||||
point_list: user["point_list"].clone(),
|
||||
clear_mission_ids: clear_mission_ids
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn skill_reinforce(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn skill_reinforce(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -80,15 +89,15 @@ pub fn skill_reinforce(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
card: card,
|
||||
item_list: user["item_list"].clone(),
|
||||
point_list: user["point_list"].clone(),
|
||||
clear_mission_ids: clear_mission_ids
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn evolve(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn evolve(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -102,10 +111,10 @@ pub fn evolve(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_chats(&key, chats);
|
||||
userdata::save_acc_missions(&key, missions);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
card: card,
|
||||
item_list: user["item_list"].clone(),
|
||||
point_list: user["point_list"].clone(),
|
||||
clear_mission_ids: clear_mission_ids
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{global, items, userdata, databases};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/chat")
|
||||
.route("/home", web::post().to(home))
|
||||
.route("/talk/start", web::post().to(start))
|
||||
.route("/talk/end", web::post().to(end))
|
||||
);
|
||||
}
|
||||
|
||||
pub fn add_chat(id: i64, num: i64, chats: &mut JsonValue) -> bool {
|
||||
for data in chats.members() {
|
||||
if data["chat_id"] == id && data["room_id"] == num {
|
||||
@@ -29,7 +38,7 @@ pub fn add_chat_from_chapter_id(chapter_id: i64, chats: &mut JsonValue) -> bool
|
||||
add_chat(chapter["masterChatId"].as_i64().unwrap(), chapter["roomId"].as_i64().unwrap(), chats)
|
||||
}
|
||||
|
||||
pub fn home(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn home(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let chats = userdata::get_acc_chats(&key);
|
||||
|
||||
@@ -38,19 +47,19 @@ pub fn home(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
rooms.push(databases::CHATS[data["chat_id"].to_string()][data["room_id"].to_string()]["id"].clone()).unwrap();
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"progress_list": chats,
|
||||
"master_chat_room_ids": rooms,
|
||||
"master_chat_stamp_ids": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,11001003,22001001,33001001,44001002],
|
||||
"master_chat_attachment_ids": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn start(_req: HttpRequest, _body: String) -> Option<JsonValue> {
|
||||
Some(object!{"select_talk_id_list":[],"get_item_list":[],"is_read":0})
|
||||
async fn start(req: HttpRequest, _body: String) -> impl Responder {
|
||||
global::api(&req, Some(object!{"select_talk_id_list":[],"get_item_list":[],"is_read":0}))
|
||||
}
|
||||
|
||||
pub fn end(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn end(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut missions = userdata::get_acc_missions(&key);
|
||||
@@ -68,5 +77,5 @@ pub fn end(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
}
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest, HttpResponse, http::header::ContentType};
|
||||
use actix_web::{HttpRequest, HttpResponse, Responder, http::header::ContentType};
|
||||
use rusqlite::params;
|
||||
use std::sync::Mutex;
|
||||
use lazy_static::lazy_static;
|
||||
@@ -220,11 +220,11 @@ async fn get_clearrate_json() -> JsonValue {
|
||||
rv
|
||||
}
|
||||
|
||||
pub async fn clearrate(_req: HttpRequest) -> Option<JsonValue> {
|
||||
Some(get_clearrate_json().await)
|
||||
pub async fn clearrate(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(get_clearrate_json().await))
|
||||
}
|
||||
|
||||
pub fn ranking(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub async fn ranking(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let live = body["master_live_id"].as_i64().unwrap();
|
||||
|
||||
@@ -246,9 +246,9 @@ pub fn ranking(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}).unwrap();
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"ranking_list": rank
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn get_html() -> JsonValue {
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
use jzon::{JsonValue, object};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::object;
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::encryption;
|
||||
use crate::router::global;
|
||||
|
||||
pub fn error(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/debug/error", web::post().to(error));
|
||||
}
|
||||
|
||||
async fn error(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
println!("client error: {}", body["code"]);
|
||||
|
||||
Some(object!{})
|
||||
global::api(&req, Some(object!{}))
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use jzon::{JsonValue, object, array};
|
||||
use actix_web::HttpRequest;
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
use rand::RngExt;
|
||||
|
||||
use crate::encryption;
|
||||
@@ -9,6 +9,23 @@ use crate::router::{userdata, global, databases};
|
||||
// I believe(?) this is all?
|
||||
const STAR_EVENT_IDS: [u32; 3] = [127, 135, 139];
|
||||
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/event")
|
||||
.route("", web::post().to(event))
|
||||
.route("/star_event", web::post().to(star_event))
|
||||
.route("/set/member", web::post().to(set_member))
|
||||
.route("/ranking", web::post().to(ranking))
|
||||
);
|
||||
cfg.service(
|
||||
web::scope("/event_star_live")
|
||||
.route("/start", web::post().to(crate::router::live::event_start))
|
||||
.route("/change_target_music", web::post().to(change_target_music))
|
||||
.route("/end", web::post().to(event_end))
|
||||
.route("/skip", web::post().to(event_skip))
|
||||
);
|
||||
}
|
||||
|
||||
fn get_event_data(key: &str, event_id: u32) -> JsonValue {
|
||||
let mut event = userdata::get_acc_event(key);
|
||||
let is_star_event = STAR_EVENT_IDS.contains(&event_id);
|
||||
@@ -97,7 +114,7 @@ fn init_star_event(event: &mut JsonValue) {
|
||||
switch_music(event, 5);
|
||||
}
|
||||
|
||||
pub fn event(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn event(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
|
||||
let body = &encryption::decrypt_packet(&body).unwrap();
|
||||
@@ -142,10 +159,10 @@ pub fn event(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
}
|
||||
|
||||
Some(event)
|
||||
global::api(&req, Some(event))
|
||||
}
|
||||
|
||||
pub fn star_event(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn star_event(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let user = userdata::get_acc(&key);
|
||||
|
||||
@@ -163,14 +180,14 @@ pub fn star_event(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
save_event_data(&key, master_event_id, event.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
star_event: star_event,
|
||||
gift_list: [],
|
||||
reward_list: []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn change_target_music(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn change_target_music(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
|
||||
let body = &encryption::decrypt_packet(&body).unwrap();
|
||||
@@ -185,10 +202,10 @@ pub fn change_target_music(req: HttpRequest, body: String) -> Option<JsonValue>
|
||||
|
||||
save_event_data(&key, master_event_id, event.clone());
|
||||
|
||||
Some(event["star_event"].clone())
|
||||
global::api(&req, Some(event["star_event"].clone()))
|
||||
}
|
||||
|
||||
pub fn set_member(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn set_member(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
|
||||
let body = &encryption::decrypt_packet(&body).unwrap();
|
||||
@@ -205,9 +222,9 @@ pub fn set_member(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
save_event_data(&key, master_event_id, event.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
event_member: event["member_ranking"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn get_rank(event: u32, user_id: u64) -> u32 {
|
||||
@@ -223,7 +240,7 @@ fn get_rank(event: u32, user_id: u64) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
pub async fn ranking(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn ranking(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = &encryption::decrypt_packet(&body).unwrap();
|
||||
let body = jzon::parse(&body).unwrap();
|
||||
let master_event_id = body["master_event_id"].as_u32().unwrap();
|
||||
@@ -241,9 +258,9 @@ pub async fn ranking(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
ranking_detail_list: rv
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
const POINTS_PER_LEVEL: i64 = 65;
|
||||
@@ -287,7 +304,7 @@ fn get_points(event_id: u32, user: &JsonValue) -> i64 {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn event_live(req: HttpRequest, body: String, skipped: bool) -> Option<JsonValue> {
|
||||
fn event_live(req: &HttpRequest, body: String, skipped: bool) -> Option<JsonValue> {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body_temp = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let event_id = if skipped {
|
||||
@@ -296,7 +313,7 @@ pub fn event_live(req: HttpRequest, body: String, skipped: bool) -> Option<JsonV
|
||||
crate::router::live::get_end_live_event_id(&key, &body_temp)?
|
||||
};
|
||||
|
||||
let mut resp = crate::router::live::live_end(&req, &body, skipped);
|
||||
let mut resp = crate::router::live::live_end(req, &body, skipped);
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut event = get_event_data(&key, event_id);
|
||||
@@ -363,10 +380,10 @@ pub fn event_live(req: HttpRequest, body: String, skipped: bool) -> Option<JsonV
|
||||
Some(resp)
|
||||
}
|
||||
|
||||
pub fn event_end(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
event_live(req, body, false)
|
||||
async fn event_end(req: HttpRequest, body: String) -> impl Responder {
|
||||
global::api(&req, event_live(&req, body, false))
|
||||
}
|
||||
|
||||
pub fn event_skip(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
event_live(req, body, true)
|
||||
async fn event_skip(req: HttpRequest, body: String) -> impl Responder {
|
||||
global::api(&req, event_live(&req, body, true))
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{object, array};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{global, userdata, items, databases};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn exchange(_req: HttpRequest) -> Option<JsonValue> {
|
||||
Some(object!{"exchange_list":[]})
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(web::resource("/exchange").route(web::get().to(exchange)).route(web::post().to(exchange_post)));
|
||||
}
|
||||
|
||||
pub fn exchange_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn exchange(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(object!{"exchange_list":[]}))
|
||||
}
|
||||
|
||||
async fn exchange_post(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -29,7 +33,7 @@ pub fn exchange_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_missions(&key, missions);
|
||||
userdata::save_acc_chats(&key, chats);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"exchange": body,
|
||||
"updated_value_list": {
|
||||
"card_list": user["card_list"].clone(),
|
||||
@@ -37,5 +41,5 @@ pub fn exchange_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
"point_list": user["point_list"].clone()
|
||||
},
|
||||
"clear_mission_ids": cleared_missions
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{object, array};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{userdata, global};
|
||||
use crate::encryption;
|
||||
|
||||
pub const FRIEND_LIMIT: usize = 40;
|
||||
|
||||
pub fn friend(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/friend")
|
||||
.route("", web::post().to(friend))
|
||||
.route("/ids", web::get().to(ids))
|
||||
.route("/search", web::post().to(search))
|
||||
.route("/search/recommend", web::post().to(recommend))
|
||||
.route("/request", web::post().to(request))
|
||||
.route("/request/approve", web::post().to(approve))
|
||||
.route("/request/cancel", web::post().to(cancel))
|
||||
.route("/delete", web::post().to(delete))
|
||||
);
|
||||
}
|
||||
|
||||
async fn friend(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let user_id = userdata::get_acc(&key)["user"]["id"].as_i64().unwrap();
|
||||
@@ -30,19 +44,19 @@ pub fn friend(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
rv.push(user).unwrap();
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"friend_list": rv
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn ids(req: HttpRequest) -> Option<JsonValue> {
|
||||
async fn ids(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let friends = userdata::get_acc_friends(&key);
|
||||
|
||||
Some(friends)
|
||||
global::api(&req, Some(friends))
|
||||
}
|
||||
|
||||
pub fn recommend(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn recommend(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let user_id = userdata::get_acc(&key)["user"]["id"].as_i64().unwrap();
|
||||
let friends = userdata::get_acc_friends(&key);
|
||||
@@ -63,12 +77,12 @@ pub fn recommend(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
rv.push(user).unwrap();
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
friend_list: rv
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn search(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn search(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let friends = userdata::get_acc_friends(&key);
|
||||
@@ -76,10 +90,10 @@ pub fn search(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
let uid = body["user_id"].as_i64().unwrap();
|
||||
let user = global::get_user(uid, &friends, false);
|
||||
|
||||
Some(user)
|
||||
global::api(&req, Some(user))
|
||||
}
|
||||
|
||||
pub fn request(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn request(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let user_id = userdata::get_acc(&key)["user"]["id"].as_i64().unwrap();
|
||||
@@ -94,10 +108,10 @@ pub fn request(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::friend_request(uid, user_id);
|
||||
}
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
pub fn approve(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn approve(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let user_id = userdata::get_acc(&key)["user"]["id"].as_i64().unwrap();
|
||||
@@ -115,10 +129,10 @@ pub fn approve(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_friends(&key, friends);
|
||||
}
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
pub fn cancel(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn cancel(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let user_id = userdata::get_acc(&key)["user"]["id"].as_i64().unwrap();
|
||||
@@ -132,10 +146,10 @@ pub fn cancel(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::friend_request_approve(uid, user_id, false, "pending_user_id_list");
|
||||
userdata::save_acc_friends(&key, friends);
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
pub fn delete(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn delete(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let user_id = userdata::get_acc(&key)["user"]["id"].as_i64().unwrap();
|
||||
@@ -149,5 +163,5 @@ pub fn delete(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::friend_remove(uid, user_id);
|
||||
userdata::save_acc_friends(&key, friends);
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use jzon::{array, object, JsonValue};
|
||||
use actix_web::{
|
||||
HttpResponse,
|
||||
HttpRequest,
|
||||
http::header::{HeaderValue, HeaderMap}
|
||||
};
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
@@ -249,6 +250,26 @@ pub fn send(mut data: JsonValue, uid: i64, headers: &HeaderMap) -> HttpResponse
|
||||
HttpResponse::Ok().body(resp)
|
||||
}
|
||||
|
||||
// Standard api response wrapper. None becomes the generic error response
|
||||
pub fn api(req: &HttpRequest, data: Option<JsonValue>) -> HttpResponse {
|
||||
let blank_header = HeaderValue::from_static("");
|
||||
let uid = req.headers().get("aoharu-user-id").unwrap_or(&blank_header).to_str().unwrap_or("").parse::<i64>().unwrap_or(0);
|
||||
let rv = if let Some(data) = data {
|
||||
object!{
|
||||
"code": 0,
|
||||
"server_time": timestamp(),
|
||||
"data": data
|
||||
}
|
||||
} else {
|
||||
object!{
|
||||
"code": 4,
|
||||
"server_time": timestamp(),
|
||||
"message": ""
|
||||
}
|
||||
};
|
||||
send(rv, uid, req.headers())
|
||||
}
|
||||
|
||||
pub fn start_login_bonus(id: i64, bonus: &mut JsonValue) -> bool {
|
||||
if crate::router::login::get_login_bonus_info(id).is_empty() {
|
||||
return false;
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use crate::router::{global, userdata, items};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn preset(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/home")
|
||||
.route("", web::get().to(home))
|
||||
.service(web::resource("/preset").route(web::get().to(preset_get)).route(web::post().to(preset)))
|
||||
.route("/announcement", web::get().to(crate::router::user::announcement))
|
||||
);
|
||||
}
|
||||
|
||||
async fn preset(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc_home(&key);
|
||||
@@ -17,7 +26,7 @@ pub fn preset(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
userdata::save_acc_home(&key, user);
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
fn check_gifts(user: &mut JsonValue) {
|
||||
@@ -32,25 +41,25 @@ fn check_gifts(user: &mut JsonValue) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gift_get(req: HttpRequest) -> Option<JsonValue> {
|
||||
pub async fn gift_get(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let mut user = userdata::get_acc_home(&key);
|
||||
check_gifts(&mut user);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"gift_list": user["home"]["gift_list"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn preset_get(req: HttpRequest) -> Option<JsonValue> {
|
||||
async fn preset_get(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let user = userdata::get_acc(&key);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"master_preset_background_ids": [1,2,3,4,5],
|
||||
"master_preset_foreground_ids": [1,2,3],
|
||||
"card_list": user["card_list"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +88,7 @@ lazy_static! {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn home(req: HttpRequest) -> Option<JsonValue> {
|
||||
async fn home(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let mut user = userdata::get_acc_home(&key);
|
||||
|
||||
@@ -124,5 +133,5 @@ pub fn home(req: HttpRequest) -> Option<JsonValue> {
|
||||
//todo
|
||||
user["home"]["beginner_mission_complete"] = 1.into();
|
||||
|
||||
Some(user)
|
||||
global::api(&req, Some(user))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use jzon::{array, object, JsonValue};
|
||||
use rand::RngExt;
|
||||
use actix_web::{HttpRequest, http::header::{HeaderMap, HeaderValue}};
|
||||
use actix_web::{web, HttpRequest, Responder, http::header::{HeaderMap, HeaderValue}};
|
||||
use crate::encryption;
|
||||
|
||||
use crate::router::{userdata, global, databases};
|
||||
@@ -511,7 +511,11 @@ pub fn completed_daily_mission(id: i64, missions: &mut JsonValue) -> JsonValue {
|
||||
rv
|
||||
}
|
||||
|
||||
pub fn use_item_req(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/item/use", web::post().to(use_item_req));
|
||||
}
|
||||
|
||||
async fn use_item_req(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -532,8 +536,8 @@ pub fn use_item_req(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
item_list: user["item_list"].clone(),
|
||||
stamina: user["stamina"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
use rand::RngExt;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
@@ -7,25 +7,41 @@ use crate::router::{global, userdata, items, databases};
|
||||
use crate::encryption;
|
||||
use crate::router::clear_rate::live_completed;
|
||||
|
||||
pub fn retire(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/live")
|
||||
.route("/guest", web::post().to(guest))
|
||||
.route("/mission", web::post().to(mission))
|
||||
.route("/ranking", web::post().to(crate::router::clear_rate::ranking))
|
||||
.route("/clearRate", web::get().to(crate::router::clear_rate::clearrate))
|
||||
.route("/start", web::post().to(start))
|
||||
.route("/end", web::post().to(end))
|
||||
.route("/skip", web::post().to(skip))
|
||||
.route("/retire", web::post().to(retire))
|
||||
.route("/continue", web::post().to(continuee))
|
||||
.route("/reward", web::post().to(reward))
|
||||
);
|
||||
}
|
||||
|
||||
async fn retire(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
live_retire(&key, &body);
|
||||
if body["live_score"]["play_time"].as_i64().unwrap_or(0) > 5 {
|
||||
live_completed(body["master_live_id"].as_i64().unwrap(), body["level"].as_i32().unwrap(), true, 0, 0);
|
||||
}
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"stamina": {},
|
||||
"item_list": [],
|
||||
"event_point_list": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn reward(_req: HttpRequest, _body: String) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
async fn reward(req: HttpRequest, _body: String) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"ensured_list": [],
|
||||
"random_list": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn random_number(lowest: usize, highest: usize) -> usize {
|
||||
@@ -37,7 +53,7 @@ fn random_number(lowest: usize, highest: usize) -> usize {
|
||||
rand::rng().random_range(lowest..highest + 1)
|
||||
}
|
||||
|
||||
pub fn guest(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn guest(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let user_id = userdata::get_acc(&key)["user"]["id"].as_i64().unwrap();
|
||||
let friends = userdata::get_acc_friends(&key);
|
||||
@@ -161,18 +177,18 @@ pub fn guest(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"guest_list": guest_list
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn mission(_req: HttpRequest, _body: String) -> Option<JsonValue> {
|
||||
async fn mission(req: HttpRequest, _body: String) -> impl Responder {
|
||||
//todo
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"score_ranking": "",
|
||||
"combo_ranking": "",
|
||||
"clear_count_ranking": ""
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn check_for_stale_data(server_data: &mut JsonValue, live_id: i64) {
|
||||
@@ -236,18 +252,21 @@ fn start_live(login_token: &str, body: &JsonValue) {
|
||||
userdata::save_server_data(login_token, server_data);
|
||||
}
|
||||
|
||||
pub fn start(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn start(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
start_live(&key, &body);
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
pub fn event_start(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
start(req, body)
|
||||
pub async fn event_start(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
start_live(&key, &body);
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
pub fn continuee(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn continuee(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let mut user = userdata::get_acc(&key);
|
||||
|
||||
@@ -255,9 +274,9 @@ pub fn continuee(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
gem: user["gem"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn get_clear_count(id: i64, user: &JsonValue) -> i64 {
|
||||
@@ -652,10 +671,10 @@ pub fn live_end(req: &HttpRequest, body: &str, skipped: bool) -> JsonValue {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn end(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
Some(live_end(&req, &body, false))
|
||||
async fn end(req: HttpRequest, body: String) -> impl Responder {
|
||||
global::api(&req, Some(live_end(&req, &body, false)))
|
||||
}
|
||||
|
||||
pub fn skip(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
Some(live_end(&req, &body, true))
|
||||
async fn skip(req: HttpRequest, body: String) -> impl Responder {
|
||||
global::api(&req, Some(live_end(&req, &body, true)))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
use jzon::{object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::object;
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
pub fn location(_req: HttpRequest) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
"master_location_ids": []
|
||||
})
|
||||
use crate::router::global;
|
||||
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/location", web::get().to(location));
|
||||
}
|
||||
|
||||
async fn location(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"master_location_ids": []
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{global, userdata, items, databases};
|
||||
|
||||
pub fn dummy(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/dummy/login", web::post().to(dummy));
|
||||
cfg.route("/login_bonus", web::post().to(bonus));
|
||||
cfg.route("/login_bonus/event", web::post().to(bonus_event));
|
||||
}
|
||||
|
||||
async fn dummy(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let user = userdata::get_acc(&key);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"user_id": user["user"]["id"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn get_login_bonus_info(id: i64) -> JsonValue {
|
||||
@@ -47,7 +53,7 @@ fn do_bonus(user_home: &mut JsonValue, bonuses: &mut JsonValue) -> JsonValue {
|
||||
to_send
|
||||
}
|
||||
|
||||
pub fn bonus(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn bonus(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let mut user_home = userdata::get_acc_home(&key);
|
||||
let mut user_missions = userdata::get_acc_missions(&key);
|
||||
@@ -67,14 +73,14 @@ pub fn bonus(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_loginbonus(&key, bonuses.clone());
|
||||
userdata::save_acc_home(&key, user_home.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"login_bonus_list": to_send,
|
||||
"start_time": bonuses["start_time"].clone(),
|
||||
"clear_mission_ids": cleared_missions
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn bonus_event(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn bonus_event(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let mut user_home = userdata::get_acc_home(&key);
|
||||
|
||||
@@ -87,9 +93,9 @@ pub fn bonus_event(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_eventlogin(&key, bonuses.clone());
|
||||
userdata::save_acc_home(&key, user_home.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"login_bonus_list": to_send,
|
||||
"start_time": bonuses["start_time"].clone(),
|
||||
"clear_mission_ids": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
use jzon::{array, object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
use rand::RngExt;
|
||||
|
||||
use crate::router::{global, userdata, items, databases};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn tutorial(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/lottery")
|
||||
.service(web::resource("").route(web::get().to(lottery)).route(web::post().to(lottery_post)))
|
||||
.route("/get_tutorial", web::post().to(tutorial))
|
||||
);
|
||||
}
|
||||
|
||||
async fn tutorial(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
let id = body["master_character_id"].to_string();
|
||||
@@ -20,7 +28,7 @@ pub fn tutorial(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
lotteryid += user;
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"lottery_list": [
|
||||
{
|
||||
"master_lottery_id": lotteryid,
|
||||
@@ -31,7 +39,7 @@ pub fn tutorial(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
],
|
||||
"item_list": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn get_card_master_id(lottery_id: String, lottery_number: String) -> Option<i64> {
|
||||
@@ -93,13 +101,13 @@ fn get_random_cards(id: i64, mut count: usize) -> JsonValue {
|
||||
rv
|
||||
}
|
||||
|
||||
pub fn lottery(_req: HttpRequest) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
async fn lottery(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"lottery_list": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn lottery_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn lottery_post(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
//println!("lottery: {}", body);
|
||||
@@ -183,7 +191,7 @@ pub fn lottery_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_chats(&key, chats);
|
||||
userdata::save_acc_missions(&key, missions);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"lottery_item_list": lottery_list,
|
||||
"updated_value_list": {
|
||||
"card_list": new_cards,
|
||||
@@ -192,5 +200,5 @@ pub fn lottery_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
"gift_list": user2["home"]["gift_list"].clone(),
|
||||
"clear_mission_ids": cleared_missions,
|
||||
"draw_count_list": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
use jzon::{array, object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{array, object};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{global, userdata, items, databases};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn mission(req: HttpRequest) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/mission")
|
||||
.route("", web::get().to(mission))
|
||||
.route("/clear", web::post().to(clear))
|
||||
.route("/receive", web::post().to(receive))
|
||||
);
|
||||
}
|
||||
|
||||
async fn mission(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let missions = userdata::get_acc_missions(&key);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"mission_list": missions
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn clear(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn clear(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
|
||||
let mut missions = userdata::get_acc_missions(&key);
|
||||
@@ -25,12 +34,12 @@ pub fn clear(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc_missions(&key, missions);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"clear_mission_ids": body["master_mission_ids"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn receive(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn receive(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
@@ -71,7 +80,7 @@ pub fn receive(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_chats(&key, chats);
|
||||
userdata::save_acc_missions(&key, missions.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"reward_list": rewards,
|
||||
"updated_value_list": {
|
||||
"gem": user["gem"].clone(),
|
||||
@@ -79,5 +88,5 @@ pub fn receive(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
"point_list": user["point_list"].clone()
|
||||
},
|
||||
"mission_list": missions
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
use jzon::{object, array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{object, array};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::global;
|
||||
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(web::resource("/notice/reward").route(web::get().to(reward)).route(web::post().to(reward_post)));
|
||||
}
|
||||
|
||||
//todo
|
||||
pub fn reward(_req: HttpRequest) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
async fn reward(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"reward_list": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn reward_post(_req: HttpRequest, _body: String) -> Option<JsonValue> {
|
||||
Some(array![])
|
||||
async fn reward_post(req: HttpRequest, _body: String) -> impl Responder {
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
use jzon::{object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::object;
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::global;
|
||||
|
||||
pub fn purchase(_req: HttpRequest) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/purchase", web::get().to(purchase));
|
||||
}
|
||||
|
||||
async fn purchase(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"product_list": [//Client will error if this is an empty array
|
||||
{
|
||||
"product_id": "com.bushiroad.global.lovelive.sif2.google.promo.4199",
|
||||
@@ -29,5 +34,5 @@ pub fn purchase(_req: HttpRequest) -> Option<JsonValue> {
|
||||
"total_gem": 6000
|
||||
}
|
||||
]
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,197 +1,205 @@
|
||||
use jzon::{array, object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{array, object};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{global, userdata, items};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn events(_req: HttpRequest) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
"serial_code_list": []
|
||||
})
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/serial_code")
|
||||
.route("", web::post().to(serial_code))
|
||||
.route("/events", web::get().to(events))
|
||||
);
|
||||
}
|
||||
|
||||
pub fn serial_code(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn events(req: HttpRequest) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"serial_code_list": []
|
||||
}))
|
||||
}
|
||||
|
||||
async fn serial_code(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc_home(&key);
|
||||
|
||||
let mut itemz = array![];
|
||||
if body["input_code"] == "SIF2REVIVALREAL!" {
|
||||
itemz.push(items::gift_item_basic(1, 10000000, 4, "Another game died... This makes me sad :(", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(1, 10000000, 4, "Another game died... This makes me sad :(", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "pweasegivegems11" {
|
||||
itemz.push(items::gift_item_basic(1, 6000, 1, "Only because you asked...", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(1, 6000, 1, "Only because you asked...", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "sleepysleepyslep" {
|
||||
itemz.push(items::gift_item_basic(15540001, 50, 3, "I am tired", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540001, 50, 3, "I am tired", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "ilikeganyu!!!!!!" {
|
||||
itemz.push(items::gift_item_basic(16005003, 100, 3, "I need more primogems", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(16005003, 100, 3, "I need more primogems", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "serial_code" {
|
||||
itemz.push(items::gift_item_basic(17001003, 100, 3, "nyaa~", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(17001003, 100, 3, "nyaa~", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "ganuy" {
|
||||
itemz.push(items::gift_item_basic(40010015, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30010015, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20010018, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10040018, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20050016, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30070015, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40030013, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10070016, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40010015, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30010015, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20010018, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10040018, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20050016, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30070015, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(40030013, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10070016, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "kode" {
|
||||
itemz.push(items::gift_item_basic(10060018, 1, 2, "meow", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20050019, 1, 2, "meow", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10020018, 1, 2, "meow", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10010014, 1, 2, "meow", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10010015, 1, 2, "meow", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10060018, 1, 2, "meow", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20050019, 1, 2, "meow", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10020018, 1, 2, "meow", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10010014, 1, 2, "meow", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10010015, 1, 2, "meow", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "meow" {
|
||||
itemz.push(items::gift_item_basic(10010020, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10040016, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10050018, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10080016, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10090015, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20010019, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20030015, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20050014, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20070013, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20080016, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(20090013, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30010017, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30020009, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30040012, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30090009, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40010011, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40030009, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40040013, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40060010, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40080011, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(40090011, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30030010, 1, 2, "I need more primogem!!!!!!", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(10010020, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10040016, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10050018, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10080016, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(10090015, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20010019, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20030015, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20050014, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20070013, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20080016, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(20090013, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30010017, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30020009, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30040012, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30090009, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(40010011, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(40030009, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(40040013, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(40060010, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(40080011, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(40090011, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30030010, 1, 2, "I need more primogem!!!!!!", &mut user)).unwrap();
|
||||
} else if body["input_code"] == "HuTao" {
|
||||
itemz.push(items::gift_item_basic(15500001, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15500002, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520001, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520002, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520003, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520004, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520005, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520006, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520007, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520008, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520009, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520010, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520011, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520012, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520013, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520014, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520015, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520016, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520017, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520018, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520019, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15520020, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510004, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510005, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510006, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510007, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510008, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510009, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510010, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510011, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510012, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510013, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510014, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510015, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510016, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510017, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510018, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510019, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510020, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510021, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510022, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510023, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15510024, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530001, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530002, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530003, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530004, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530005, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530006, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530007, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530008, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530009, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530010, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530011, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530012, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530013, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530014, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530015, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530016, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530017, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530018, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530019, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530020, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530021, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530022, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530023, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530024, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530025, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530026, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530027, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530028, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530029, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530030, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530031, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530032, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530033, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530034, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530035, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530036, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15530037, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540002, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540005, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540006, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540007, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540008, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540009, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540010, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540011, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540012, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540013, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540014, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540015, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540016, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540017, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540023, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540024, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540025, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540027, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540028, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540029, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540030, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540031, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540032, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540033, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540034, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540035, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30010002, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30010003, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30010004, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30010005, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(30010001, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15540001, 500, 3, "Okay...............", &mut user)).ok()?;
|
||||
itemz.push(items::gift_item_basic(15500001, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15500002, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520001, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520002, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520003, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520004, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520005, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520006, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520007, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520008, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520009, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520010, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520011, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520012, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520013, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520014, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520015, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520016, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520017, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520018, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520019, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15520020, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510004, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510005, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510006, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510007, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510008, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510009, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510010, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510011, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510012, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510013, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510014, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510015, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510016, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510017, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510018, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510019, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510020, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510021, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510022, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510023, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15510024, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530001, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530002, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530003, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530004, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530005, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530006, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530007, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530008, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530009, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530010, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530011, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530012, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530013, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530014, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530015, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530016, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530017, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530018, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530019, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530020, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530021, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530022, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530023, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530024, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530025, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530026, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530027, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530028, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530029, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530030, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530031, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530032, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530033, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530034, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530035, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530036, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15530037, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540002, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540005, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540006, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540007, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540008, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540009, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540010, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540011, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540012, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540013, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540014, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540015, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540016, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540017, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540023, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540024, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540025, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540027, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540028, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540029, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540030, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540031, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540032, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540033, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540034, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540035, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30010002, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30010003, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30010004, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30010005, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(30010001, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
itemz.push(items::gift_item_basic(15540001, 500, 3, "Okay...............", &mut user)).unwrap();
|
||||
} else {
|
||||
return Some(object!{
|
||||
return global::api(&req, Some(object!{
|
||||
"result_code": 3
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
if body["receive_flg"] == 1 {
|
||||
userdata::save_acc_home(&key, user.clone());
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"serial_code_event": {"id":1,"name":"Serial Code Reward","unique_limit_count":0,"min_user_rank":0,"max_user_rank":0,"end_date":null},
|
||||
"reward_list": itemz,
|
||||
"result_code": 0,
|
||||
"gift_list": user["gift_list"].clone(),
|
||||
"excluded_gift_list": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
use jzon::{object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{object};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{userdata, global, items, databases};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn shop(req: HttpRequest) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/shop")
|
||||
.route("", web::get().to(shop))
|
||||
.route("/buy", web::post().to(buy))
|
||||
);
|
||||
}
|
||||
|
||||
async fn shop(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let user = userdata::get_acc(&key);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"shop_list": user["shop_list"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn buy(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn buy(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -27,12 +35,12 @@ pub fn buy(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"gem": user["gem"].clone(),
|
||||
"shop_list": user["shop_list"].clone(),
|
||||
"gift_list": user_home["home"]["gift_list"].clone(),
|
||||
"updated_value_list": {
|
||||
"stamina": user["stamina"].clone()
|
||||
}
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
use jzon::{JsonValue, object};
|
||||
use actix_web::HttpRequest;
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::encryption;
|
||||
use crate::router::{userdata, global};
|
||||
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/start", web::post().to(start));
|
||||
cfg.route("/start/assetHash", web::post().to(asset_hash));
|
||||
}
|
||||
|
||||
fn get_asset_hash(req: &HttpRequest, body: &JsonValue) -> String {
|
||||
if global::get_player_region(&body["asset_version"].to_string()).is_none() {
|
||||
println!("Warning! Asset version is not what was expected. (Did the app update?)");
|
||||
@@ -20,15 +25,15 @@ fn get_asset_hash(req: &HttpRequest, body: &JsonValue) -> String {
|
||||
global::get_asset_hash(&body["asset_version"].to_string(), platform).unwrap()
|
||||
}
|
||||
|
||||
pub fn asset_hash(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn asset_hash(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"asset_hash": get_asset_hash(&req, &body)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn start(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn start(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -39,8 +44,8 @@ pub fn start(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc(&key, user);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"asset_hash": get_asset_hash(&req, &body),
|
||||
"token": hex::encode("Hello") //what is this?
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
use jzon::{object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{object};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::encryption;
|
||||
use crate::router::{global, userdata, databases};
|
||||
|
||||
pub fn read(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/story/read", web::post().to(read));
|
||||
}
|
||||
|
||||
async fn read(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -29,12 +33,12 @@ pub fn read(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"gift_list":[],
|
||||
"updated_value_list":{
|
||||
"story_list": user["story_list"].clone()
|
||||
},
|
||||
"reward_list":[],
|
||||
"clear_mission_ids":[]
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
use jzon::{array, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use jzon::{array};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
|
||||
use crate::router::{userdata, global};
|
||||
use crate::encryption;
|
||||
|
||||
pub fn tutorial(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/tutorial", web::post().to(tutorial));
|
||||
}
|
||||
|
||||
async fn tutorial(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -16,5 +20,5 @@ pub fn tutorial(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc(&key, user);
|
||||
}
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
@@ -1,12 +1,31 @@
|
||||
use jzon::{array, object, JsonValue};
|
||||
use actix_web::{HttpRequest};
|
||||
use actix_web::{web, HttpRequest, Responder};
|
||||
use sha1::{Sha1, Digest};
|
||||
|
||||
use crate::encryption;
|
||||
use crate::router::{userdata, global, items};
|
||||
use crate::include_file;
|
||||
|
||||
pub fn deck(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub fn routes(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/user")
|
||||
.service(web::resource("").route(web::get().to(user)).route(web::post().to(user_post)))
|
||||
.route("/initialize", web::post().to(initialize))
|
||||
.route("/detail", web::post().to(detail))
|
||||
.route("/getmigrationcode", web::post().to(get_migration_code))
|
||||
.route("/registerpassword", web::post().to(register_password))
|
||||
.route("/migration", web::post().to(migration))
|
||||
.route("/gglrequestmigrationcode", web::post().to(request_migration_code))
|
||||
.route("/gglverifymigrationcode", web::post().to(verify_migration_code))
|
||||
.route("/getregisteredplatformlist", web::post().to(getregisteredplatformlist))
|
||||
.route("/sif/migrate", web::post().to(sif_migrate))
|
||||
.route("/ss/migrate", web::post().to(sifas_migrate))
|
||||
);
|
||||
cfg.route("/deck", web::post().to(deck));
|
||||
cfg.route("/album/sif", web::get().to(sif));
|
||||
}
|
||||
|
||||
async fn deck(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
@@ -29,26 +48,26 @@ pub fn deck(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
}
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"deck": {
|
||||
"slot": body["slot"].clone(),
|
||||
"leader_role": 0,
|
||||
"main_card_ids": body["main_card_ids"].clone()
|
||||
},
|
||||
"clear_mission_ids": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn user(req: HttpRequest) -> Option<JsonValue> {
|
||||
async fn user(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let mut user = userdata::get_acc(&key);
|
||||
|
||||
user["lottery_list"] = array![];
|
||||
|
||||
Some(user)
|
||||
global::api(&req, Some(user))
|
||||
}
|
||||
|
||||
pub fn gift(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
pub async fn gift(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
@@ -93,7 +112,7 @@ pub fn gift(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc(&key, userr.clone());
|
||||
let userr = userdata::get_acc(&key);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"failed_gift_ids": failed,
|
||||
"updated_value_list": {
|
||||
"gem": userr["gem"].clone(),
|
||||
@@ -103,10 +122,10 @@ pub fn gift(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
},
|
||||
"clear_mission_ids": cleared_missions,
|
||||
"reward_list": rewards
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn user_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn user_post(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
@@ -149,13 +168,13 @@ pub fn user_post(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"user": user["user"].clone(),
|
||||
"clear_mission_ids": []
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn announcement(req: HttpRequest) -> Option<JsonValue> {
|
||||
pub async fn announcement(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
|
||||
let mut user = userdata::get_acc_home(&key);
|
||||
@@ -164,22 +183,23 @@ pub fn announcement(req: HttpRequest) -> Option<JsonValue> {
|
||||
|
||||
userdata::save_acc_home(&key, user);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
new_announcement_flag: 0
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn get_migration_code(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn get_migration_code(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
let code = userdata::user::migration::get_acc_token(body["user_id"].as_i64()?);
|
||||
let Some(user_id) = body["user_id"].as_i64() else { return global::api(&req, None); };
|
||||
let code = userdata::user::migration::get_acc_token(user_id);
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"migrationCode": code
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn register_password(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn register_password(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
@@ -187,49 +207,49 @@ pub fn register_password(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
|
||||
userdata::user::migration::save_acc_transfer(user["user"]["id"].as_i64().unwrap(), &body["pass"].to_string());
|
||||
|
||||
Some(array![])
|
||||
global::api(&req, Some(array![]))
|
||||
}
|
||||
|
||||
pub fn verify_migration_code(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn verify_migration_code(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
let user = userdata::user::migration::get_acc_transfer(&body["migrationCode"].to_string(), &body["pass"].to_string());
|
||||
|
||||
if !user["success"].as_bool().unwrap() || user["user_id"] == 0 {
|
||||
return None;
|
||||
return global::api(&req, None);
|
||||
}
|
||||
|
||||
let data_user = userdata::get_acc(&user["login_token"].to_string());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"user_id": user["user_id"].clone(),
|
||||
"uuid": user["login_token"].to_string(),
|
||||
"charge": data_user["gem"]["charge"].clone(),
|
||||
"free": data_user["gem"]["free"].clone()
|
||||
})
|
||||
}))
|
||||
}
|
||||
pub fn request_migration_code(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn request_migration_code(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
let user = userdata::user::migration::get_acc_transfer(&body["migrationCode"].to_string(), &body["pass"].to_string());
|
||||
|
||||
if !user["success"].as_bool().unwrap() || user["user_id"] == 0 {
|
||||
return None;
|
||||
return global::api(&req, None);
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"twxuid": user["login_token"].to_string()
|
||||
})
|
||||
}))
|
||||
}
|
||||
pub fn migration(_req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn migration(req: HttpRequest, body: String) -> impl Responder {
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
let user = userdata::get_name_and_rank(body["user_id"].to_string().parse::<i64>().unwrap());
|
||||
|
||||
Some(user)
|
||||
global::api(&req, Some(user))
|
||||
}
|
||||
|
||||
pub fn detail(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn detail(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let friends = userdata::get_acc_friends(&key);
|
||||
@@ -240,12 +260,12 @@ pub fn detail(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
let user = global::get_user(uid, &friends, true);
|
||||
user_detail_list.push(user).unwrap();
|
||||
}
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
user_detail_list: user_detail_list
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn sif(req: HttpRequest) -> Option<JsonValue> {
|
||||
async fn sif(req: HttpRequest) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), "");
|
||||
let mut user = userdata::get_acc(&key);
|
||||
let mut cards = userdata::get_acc_sif(&key);
|
||||
@@ -259,18 +279,18 @@ pub fn sif(req: HttpRequest) -> Option<JsonValue> {
|
||||
userdata::save_acc(&key, user);
|
||||
}
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
cards: cards
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn sifas_migrate(_req: HttpRequest, _body: String) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
async fn sifas_migrate(req: HttpRequest, _body: String) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"ss_migrate_status": 1,
|
||||
"user": null,
|
||||
"gift_list": null,
|
||||
"lock_remain_time": null
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
fn _a_sha1(t: &str) -> String {
|
||||
@@ -315,7 +335,7 @@ fn clean_sif_data(current: &JsonValue) -> JsonValue {
|
||||
rv
|
||||
}
|
||||
|
||||
pub async fn sif_migrate(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn sif_migrate(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let mut user = userdata::get_acc(&key);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
@@ -323,9 +343,9 @@ pub async fn sif_migrate(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
let id = generate_passcode_sha1(body["sif_user_id"].to_string(), body["password"].to_string());
|
||||
let user_info = npps4_req(id).await;
|
||||
if user_info.is_none() {
|
||||
return Some(object!{
|
||||
return global::api(&req, Some(object!{
|
||||
sif_migrate_status: 38
|
||||
});
|
||||
}));
|
||||
}
|
||||
let user_info = user_info.unwrap();
|
||||
|
||||
@@ -338,23 +358,23 @@ pub async fn sif_migrate(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_sif(&key, clean_sif_data(&user_info["units"]));
|
||||
userdata::save_acc(&key, user.clone());
|
||||
|
||||
Some(object!{
|
||||
global::api(&req, Some(object!{
|
||||
"sif_migrate_status": 0,
|
||||
"user": user["user"].clone(),
|
||||
"master_title_ids": user["master_title_ids"].clone()
|
||||
})
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
pub fn getregisteredplatformlist(_req: HttpRequest, _body: String) -> Option<JsonValue> {
|
||||
Some(object!{
|
||||
async fn getregisteredplatformlist(req: HttpRequest, _body: String) -> impl Responder {
|
||||
global::api(&req, Some(object!{
|
||||
"google": 0,
|
||||
"apple": 0,
|
||||
"twitter": 0
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn initialize(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
async fn initialize(req: HttpRequest, body: String) -> impl Responder {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = jzon::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
||||
@@ -394,7 +414,7 @@ pub fn initialize(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
cardstoreward = array![40010001, 40020001, 40030001, 40040001, 40050001, 40060001, 40070001, 40080001, 40090001]; //liella
|
||||
masterid += 9 + 9 + 12; //nijigasaki
|
||||
} else {
|
||||
return None;
|
||||
return global::api(&req, None);
|
||||
}
|
||||
masterid += userr;
|
||||
|
||||
@@ -416,5 +436,5 @@ pub fn initialize(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
userdata::save_acc_home(&key, user2);
|
||||
userdata::save_acc_missions(&key, missions);
|
||||
|
||||
Some(user["user"].clone())
|
||||
global::api(&req, Some(user["user"].clone()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user