优化一键测试权重

This commit is contained in:
2026-03-27 14:14:59 +08:00
parent 0bdab95ab7
commit e2273ef41c
13 changed files with 403 additions and 285 deletions

View File

@@ -22,17 +22,16 @@ use think\model\relation\HasMany;
* @property int|null $lottery_config_id 测试时使用的奖池配置 ID兼容旧付费+免费共用)
* @property int|null $paid_lottery_config_id 付费抽奖奖池配置 ID默认 type=0
* @property int|null $free_lottery_config_id 免费抽奖奖池配置 ID默认 type=1
* @property int $total_play_count 总模拟次数s_count+n_count
* @property int $total_play_count 总模拟次数
* @property int $over_play_count 已完成次数
* @property int $status 状态 -1失败 0进行中 1成功
* @property string|null $remark 失败时记录原因
* @property int|null $ante 底注/注数dice_ante_config.mult
* @property int $s_count 顺时针模拟次数(兼容旧数据)
* @property int $n_count 逆时针模拟次数(兼容旧数据)
* @property int $paid_s_count 付费抽奖顺时针次数
* @property int $paid_n_count 付费抽奖逆时针次数
* @property int $free_s_count 免费抽奖顺时针次数
* @property int $free_n_count 免费抽奖逆时针次数
* @property int $chain_free_mode 1=链式再来一次免费抽奖
* @property int $paid_planned_spins 计划付费抽奖次数(顺+逆)
* @property int $play_again_count 再来一次次数(T5触发次数)
* @property array|null $paid_tier_weights 付费自定义档位权重 T1-T5
* @property array|null $free_tier_weights 免费自定义档位权重 T1-T5
* @property array $result_counts 落点统计 grid_number=>出现次数
@@ -85,6 +84,18 @@ class DiceRewardConfigRecord extends BaseModel
return round($paidAmount - $sumWinCoin, 2);
}
/**
* 根据关联的 DicePlayRecordTest 统计再来一次次数reward_tier=T5
* @param int $recordId
* @return int
*/
public static function computePlayAgainCountFromRelated(int $recordId): int
{
return (int) DicePlayRecordTest::where('reward_config_record_id', $recordId)
->where('reward_tier', 'T5')
->count();
}
/**
* 根据关联的 DicePlayRecordTest 统计落点次数
* result_counts = [grid_number => 出现次数],只统计 roll_number 在 5-30 之间的记录