Properly mark item as not new

This commit is contained in:
Ethan O'Brien 2024-05-03 17:29:44 -05:00
parent bb324bec26
commit 4dde7bb2e3
2 changed files with 7 additions and 4 deletions

View file

@ -331,7 +331,7 @@ pub fn lp_modification(user: &mut JsonValue, change_amount: u64, remove: bool) {
pub fn give_character(id: String, user: &mut JsonValue) -> bool {
for (_i, data) in user["card_list"].members().enumerate() {
if data["master_card_id"].to_string() == id || data["id"].to_string() == id {
give_item(19100001, 100, user);
give_item(19100001, 50, user);
return false;
}
}

View file

@ -203,15 +203,16 @@ pub fn lottery_post(req: HttpRequest, body: String) -> HttpResponse {
new_cards.push(to_push).unwrap();
}
userdata::save_acc(&key, user.clone());
for (_i, data) in cardstogive.members().enumerate() {
let new = if new_ids.contains(data["master_lottery_item_id"].to_string()) { 1 } else { 0 };
let to_push = object!{
let mut to_push = object!{
"master_lottery_item_id": data["master_lottery_item_id"].clone(),
"master_lottery_item_number": data["master_lottery_item_number"].clone(),
"is_new": new
};
if new == 0 {
to_push["exchange_item"] = object!{"master_item_id": 19100001, "amount": 50};
}
lottery_list.push(to_push).unwrap();
}
} else if lottery_type == 2 {
@ -227,6 +228,8 @@ pub fn lottery_post(req: HttpRequest, body: String) -> HttpResponse {
}
}
userdata::save_acc(&key, user.clone());
//todo
let resp = object!{
"code": 0,