mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Properly mark item as not new
This commit is contained in:
parent
bb324bec26
commit
4dde7bb2e3
2 changed files with 7 additions and 4 deletions
|
@ -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 {
|
pub fn give_character(id: String, user: &mut JsonValue) -> bool {
|
||||||
for (_i, data) in user["card_list"].members().enumerate() {
|
for (_i, data) in user["card_list"].members().enumerate() {
|
||||||
if data["master_card_id"].to_string() == id || data["id"].to_string() == id {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,15 +203,16 @@ pub fn lottery_post(req: HttpRequest, body: String) -> HttpResponse {
|
||||||
new_cards.push(to_push).unwrap();
|
new_cards.push(to_push).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
userdata::save_acc(&key, user.clone());
|
|
||||||
|
|
||||||
for (_i, data) in cardstogive.members().enumerate() {
|
for (_i, data) in cardstogive.members().enumerate() {
|
||||||
let new = if new_ids.contains(data["master_lottery_item_id"].to_string()) { 1 } else { 0 };
|
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_id": data["master_lottery_item_id"].clone(),
|
||||||
"master_lottery_item_number": data["master_lottery_item_number"].clone(),
|
"master_lottery_item_number": data["master_lottery_item_number"].clone(),
|
||||||
"is_new": new
|
"is_new": new
|
||||||
};
|
};
|
||||||
|
if new == 0 {
|
||||||
|
to_push["exchange_item"] = object!{"master_item_id": 19100001, "amount": 50};
|
||||||
|
}
|
||||||
lottery_list.push(to_push).unwrap();
|
lottery_list.push(to_push).unwrap();
|
||||||
}
|
}
|
||||||
} else if lottery_type == 2 {
|
} 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
|
//todo
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
"code": 0,
|
"code": 0,
|
||||||
|
|
Loading…
Add table
Reference in a new issue