优化一键测试权重
This commit is contained in:
@@ -79,20 +79,31 @@ class DiceRewardController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键测试权重:创建测试记录并启动单进程后台执行,实时写入 dice_play_record_test,更新 dice_reward_config_record 进度
|
||||
* 参数:lottery_config_id 奖池配置,s_count 顺时针次数 100/500/1000/5000,n_count 逆时针次数 100/500/1000/5000
|
||||
* 一键测试权重:创建测试记录并启动单进程后台执行,按付费/免费、顺逆方向交替写入 dice_play_record_test
|
||||
* 参数:lottery_config_id 可选,不选则传 paid_tier_weights / free_tier_weights 自定义档位;
|
||||
* paid_s_count, paid_n_count, free_s_count, free_n_count;或兼容旧版 s_count, n_count
|
||||
*/
|
||||
#[Permission('奖励对照列表', 'dice:reward:index:index')]
|
||||
public function startWeightTest(Request $request): Response
|
||||
{
|
||||
$lotteryConfigId = (int) $request->post('lottery_config_id', 0);
|
||||
$sCount = (int) $request->post('s_count', 100);
|
||||
$nCount = (int) $request->post('n_count', 100);
|
||||
$post = is_array($request->post()) ? $request->post() : [];
|
||||
$params = [
|
||||
'lottery_config_id' => $post['lottery_config_id'] ?? null,
|
||||
'paid_lottery_config_id' => $post['paid_lottery_config_id'] ?? null,
|
||||
'free_lottery_config_id' => $post['free_lottery_config_id'] ?? null,
|
||||
's_count' => $post['s_count'] ?? null,
|
||||
'n_count' => $post['n_count'] ?? null,
|
||||
'paid_s_count' => $post['paid_s_count'] ?? null,
|
||||
'paid_n_count' => $post['paid_n_count'] ?? null,
|
||||
'free_s_count' => $post['free_s_count'] ?? null,
|
||||
'free_n_count' => $post['free_n_count'] ?? null,
|
||||
'paid_tier_weights' => $post['paid_tier_weights'] ?? null,
|
||||
'free_tier_weights' => $post['free_tier_weights'] ?? null,
|
||||
];
|
||||
$adminId = isset($this->adminInfo['id']) ? (int) $this->adminInfo['id'] : null;
|
||||
try {
|
||||
$logic = new DiceRewardConfigRecordLogic();
|
||||
$recordId = $logic->createWeightTestRecord($lotteryConfigId, $sCount, $nCount, $adminId);
|
||||
// 由独立进程 WeightTestProcess 定时轮询 status=0 并执行,不占用 HTTP 资源
|
||||
$recordId = $logic->createWeightTestRecord($params, $adminId);
|
||||
return $this->success(['record_id' => $recordId]);
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user