Organize databases

This commit is contained in:
Ethan O'Brien
2024-05-09 16:39:31 -05:00
parent 248979f2cb
commit 98aed96701
33 changed files with 240 additions and 314 deletions

View File

@@ -1,6 +1,5 @@
use json::{array, object, JsonValue};
use actix_web::{HttpResponse, HttpRequest};
use lazy_static::lazy_static;
use crate::encryption;
use crate::router::{userdata, global, items};
@@ -57,21 +56,6 @@ pub fn user(req: HttpRequest) -> HttpResponse {
global::send(resp, req)
}
lazy_static! {
static ref LOGIN_REWARDS: JsonValue = {
let mut info = object!{};
let items = json::parse(include_str!("json/login_bonus_reward.json")).unwrap();
for (_i, data) in items.members().enumerate() {
info[data["id"].to_string()] = data.clone();
}
info
};
}
pub fn get_info_from_id(id: i64) -> JsonValue {
LOGIN_REWARDS[id.to_string()].clone()
}
pub fn gift(req: HttpRequest, body: String) -> HttpResponse {
let key = global::get_login(req.headers(), &body);
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();