This commit is contained in:
2026-05-01 01:53:16 +08:00
parent c9be987671
commit 96313dd481
10 changed files with 100 additions and 55 deletions

View File

@@ -1911,7 +1911,7 @@ fn claim_puzzle_work_point_incentive_tx(
return Err("无权领取该作品的积分激励".to_string());
}
let claimable_points = puzzle_point_incentive_claimable_points(
let claimable_points = module_puzzle::puzzle_point_incentive_claimable_points(
row.point_incentive_total_half_points,
row.point_incentive_claimed_points,
);
@@ -2571,9 +2571,9 @@ fn upsert_puzzle_profile_save_archive(
"runtimeKind": "puzzle",
"runId": run.run_id,
"entryProfileId": run.entry_profile_id,
"currentProfileId": target.profile_id,
"currentProfileId": target.profile_id.clone(),
"currentLevelIndex": target.level_index,
"currentLevelId": target.level_id,
"currentLevelId": target.level_id.clone(),
"status": target.status.as_str(),
}))
.unwrap_or_else(|_| "{}".to_string());
@@ -2613,6 +2613,8 @@ fn resolve_puzzle_archive_target(
run: &PuzzleRunSnapshot,
current_level: &module_puzzle::PuzzleRuntimeLevelSnapshot,
) -> Result<PuzzleArchiveTarget, String> {
// 中文注释:通关后若已经算出同作品下一关,存档页直接投影到下一关入口;
// 跨作品候选需要玩家选择,不能在存档里提前替玩家切换作品。
let owner_user_id = resolve_puzzle_current_owner_user_id(ctx, &current_level.profile_id);
if current_level.status != PuzzleRuntimeLevelStatus::Cleared {
return Ok(PuzzleArchiveTarget {
@@ -2697,12 +2699,6 @@ fn puzzle_archive_summary_text(status: PuzzleRuntimeLevelStatus) -> String {
.to_string()
}
fn puzzle_point_incentive_claimable_points(total_half_points: u64, claimed_points: u64) -> u64 {
total_half_points
.saturating_div(2)
.saturating_sub(claimed_points)
}
fn accrue_puzzle_point_incentive(
ctx: &TxContext,
profile_id: &str,
@@ -2749,9 +2745,10 @@ fn accrue_puzzle_point_incentive(
play_count: row.play_count,
remix_count: row.remix_count,
like_count: row.like_count,
point_incentive_total_half_points: row
.point_incentive_total_half_points
.saturating_add(spent_points),
point_incentive_total_half_points: module_puzzle::puzzle_point_incentive_total_after_spend(
row.point_incentive_total_half_points,
spent_points,
),
point_incentive_claimed_points: row.point_incentive_claimed_points,
anchor_pack_json: row.anchor_pack_json.clone(),
publish_ready: row.publish_ready,