mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
I think this works idk
This commit is contained in:
parent
3ce29b357a
commit
394f6b2ae0
2 changed files with 30 additions and 2 deletions
|
@ -3,6 +3,7 @@ use actix_web::{HttpResponse, HttpRequest};
|
||||||
|
|
||||||
use crate::encryption;
|
use crate::encryption;
|
||||||
use crate::router::{userdata, global, items};
|
use crate::router::{userdata, global, items};
|
||||||
|
use crate::include_file;
|
||||||
|
|
||||||
pub fn deck(req: HttpRequest, body: String) -> HttpResponse {
|
pub fn deck(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
let key = global::get_login(req.headers(), &body);
|
let key = global::get_login(req.headers(), &body);
|
||||||
|
@ -343,7 +344,13 @@ pub fn detail(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
|
|
||||||
pub fn sif(req: HttpRequest) -> HttpResponse {
|
pub fn sif(req: HttpRequest) -> HttpResponse {
|
||||||
let key = global::get_login(req.headers(), "");
|
let key = global::get_login(req.headers(), "");
|
||||||
let cards = userdata::get_acc_sif(&key);
|
let user = userdata::get_acc(&key);
|
||||||
|
let mut cards = userdata::get_acc_sif(&key);
|
||||||
|
|
||||||
|
// prevent duplicate data in the database
|
||||||
|
if user["user"]["sif_user_id"].as_i64().unwrap() == 111111111 {
|
||||||
|
cards = json::parse(&include_file!("src/router/userdata/new_user_home.json")).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
"code": 0,
|
"code": 0,
|
||||||
|
@ -369,7 +376,26 @@ pub fn sifas_migrate(req: HttpRequest, _body: String) -> HttpResponse {
|
||||||
global::send(resp, req)
|
global::send(resp, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sif_migrate(req: HttpRequest, _body: String) -> HttpResponse {
|
pub fn sif_migrate(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
|
let key = global::get_login(req.headers(), &body);
|
||||||
|
let mut user = userdata::get_acc(&key);
|
||||||
|
user["user"]["sif_user_id"] = 111111111.into();
|
||||||
|
|
||||||
|
userdata::save_acc(&key, user.clone());
|
||||||
|
|
||||||
|
let resp = object!{
|
||||||
|
"code": 0,
|
||||||
|
"server_time": global::timestamp(),
|
||||||
|
"data": {
|
||||||
|
"sif_migrate_status": 0,
|
||||||
|
"user": user["user"].clone(),
|
||||||
|
"master_title_ids": user["master_title_ids"].clone()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Error response
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
"code": 0,
|
"code": 0,
|
||||||
"server_time": global::timestamp(),
|
"server_time": global::timestamp(),
|
||||||
|
@ -377,6 +403,7 @@ pub fn sif_migrate(req: HttpRequest, _body: String) -> HttpResponse {
|
||||||
"sif_migrate_status": 38
|
"sif_migrate_status": 38
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
global::send(resp, req)
|
global::send(resp, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
src/router/userdata/full_sif.json
Normal file
1
src/router/userdata/full_sif.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue