优化一键测试权重

This commit is contained in:
2026-03-13 15:47:12 +08:00
parent f5eaf8da30
commit 0b26afde70
19 changed files with 991 additions and 274 deletions

View File

@@ -30,20 +30,22 @@ class DiceLotteryPoolConfigController extends BaseController
}
/**
* 获取 DiceLotteryPoolConfig 列表数据,用于 lottery_config_id 下拉(值为 id显示为 name并附带 T1-T5 档位权重
* 获取 DiceLotteryPoolConfig 列表数据,用于 lottery_config_id 下拉(值为 id显示为 name并附带 type、T1-T5 档位权重
* type0=付费抽奖券1=免费抽奖券;一键测试权重中付费默认选 type=0免费默认选 type=1
* @param Request $request
* @return Response 返回 [ ['id' => int, 'name' => string, 't1_weight' => int, ... 't5_weight' => int], ... ]
* @return Response 返回 [ ['id' => int, 'name' => string, 'type' => int, 't1_weight' => int, ... 't5_weight' => int], ... ]
*/
#[Permission('色子奖池配置列表', 'dice:lottery_pool_config:index:index')]
public function getOptions(Request $request): Response
{
$list = DiceLotteryPoolConfig::field('id,name,t1_weight,t2_weight,t3_weight,t4_weight,t5_weight')
$list = DiceLotteryPoolConfig::field('id,name,type,t1_weight,t2_weight,t3_weight,t4_weight,t5_weight')
->order('id', 'asc')
->select();
$data = $list->map(function ($item) {
return [
'id' => (int) $item['id'],
'name' => (string) ($item['name'] ?? ''),
'type' => (int) ($item['type'] ?? 0),
't1_weight' => (int) ($item['t1_weight'] ?? 0),
't2_weight' => (int) ($item['t2_weight'] ?? 0),
't3_weight' => (int) ($item['t3_weight'] ?? 0),