I hate this so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so much

This commit is contained in:
Ethan O'Brien 2024-05-03 16:32:00 -05:00
parent 56d20a9752
commit 2518a7a75f
2 changed files with 9 additions and 8 deletions

View file

@ -108,8 +108,10 @@ pub fn timestamp_since_midnight() -> u64 {
rv rv
} }
pub fn send(data: JsonValue) -> HttpResponse { pub fn send(mut data: JsonValue) -> HttpResponse {
//println!("{}", json::stringify(data.clone())); //println!("{}", json::stringify(data.clone()));
data["server_time"] = 1711741114.into();
let encrypted = encryption::encrypt_packet(&json::stringify(data)).unwrap(); let encrypted = encryption::encrypt_packet(&json::stringify(data)).unwrap();
let resp = encrypted.into_bytes(); let resp = encrypted.into_bytes();

View file

@ -157,7 +157,7 @@ pub fn lottery_post(req: HttpRequest, body: String) -> HttpResponse {
let mut cardstogive; let mut cardstogive;
let mut lottery_id = body["master_lottery_id"].as_i64().unwrap(); let lottery_id = body["master_lottery_id"].as_i64().unwrap();
if user["tutorial_step"].as_i32().unwrap() != 130 { if user["tutorial_step"].as_i32().unwrap() != 130 {
cardstogive = get_random_cards(body["master_lottery_id"].as_i64().unwrap(), 9); cardstogive = get_random_cards(body["master_lottery_id"].as_i64().unwrap(), 9);
let item_id = (body["master_lottery_id"].to_string().parse::<i32>().unwrap() * 100) + 1; let item_id = (body["master_lottery_id"].to_string().parse::<i32>().unwrap() * 100) + 1;
@ -169,14 +169,13 @@ pub fn lottery_post(req: HttpRequest, body: String) -> HttpResponse {
}; };
cardstogive.push(new_card).unwrap(); cardstogive.push(new_card).unwrap();
} else { } else {
lottery_id = 1110024;
let price = PRICE[lottery_id.to_string()][body["master_lottery_price_number"].to_string()].clone(); let price = PRICE[lottery_id.to_string()][body["master_lottery_price_number"].to_string()].clone();
//if price["consumeType"].as_i32().unwrap() == 1 { if price["consumeType"].as_i32().unwrap() == 1 {
// global::remove_gems(&mut user, price["price"].as_i64().unwrap()); global::remove_gems(&mut user, price["price"].as_i64().unwrap());
//} else if price["consumeType"].as_i32().unwrap() == 4 { } else if price["consumeType"].as_i32().unwrap() == 4 {
// global::use_item(price["masterItemId"].as_i64().unwrap(), price["price"].as_i64().unwrap(), &mut user); global::use_item(price["masterItemId"].as_i64().unwrap(), price["price"].as_i64().unwrap(), &mut user);
//} }
cardstogive = get_random_cards(lottery_id, price["count"].as_usize().unwrap()); cardstogive = get_random_cards(lottery_id, price["count"].as_usize().unwrap());
} }