Skip to content

Commit

Permalink
修正新数据追加位置
Browse files Browse the repository at this point in the history
  • Loading branch information
ningnao committed Jul 22, 2024
1 parent afb059e commit 3156869
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/gacha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@ pub(crate) async fn get_gacha_data(player_id: String, server_sender: &Sender<Mes
gacha_data_by_type.insert(0, gacha_data.clone());
}

// 追加旧数据
gacha_data_by_type.append(saved_gacha_data_by_type);
// 保存追加旧数据后的新数据
saved_gacha_data.insert(card_pool_type, gacha_data_by_type);
// 在旧数据后追加新数据
let mut saved_gacha_data_by_type = saved_gacha_data_by_type.clone();
saved_gacha_data_by_type.append(&mut gacha_data_by_type);
// 保存
saved_gacha_data.insert(card_pool_type, saved_gacha_data_by_type);
}
Err(err) => {
return Err(Error::from(err));
Expand Down

0 comments on commit 3156869

Please sign in to comment.