修改DiceLotteryPoolConfig-type改为name映射
This commit is contained in:
@@ -30,22 +30,20 @@ class DiceLotteryPoolConfigController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 DiceLotteryPoolConfig 列表数据,用于 lottery_config_id 下拉(值为 id,显示为 name),并附带 type、T1-T5 档位权重
|
||||
* type:0=付费抽奖券,1=免费抽奖券;一键测试权重中付费默认选 type=0,免费默认选 type=1
|
||||
* 获取 DiceLotteryPoolConfig 列表数据,用于 lottery_config_id 下拉(值为 id,显示为 name),并附带 T1-T5 档位权重
|
||||
* @param Request $request
|
||||
* @return Response 返回 [ ['id' => int, 'name' => string, 'type' => int, 't1_weight' => int, ... 't5_weight' => int], ... ]
|
||||
* @return Response 返回 [ ['id' => int, 'name' => string, 't1_weight' => int, ... 't5_weight' => int], ... ]
|
||||
*/
|
||||
#[Permission('色子奖池配置列表', 'dice:lottery_pool_config:index:index')]
|
||||
public function getOptions(Request $request): Response
|
||||
{
|
||||
$list = DiceLotteryPoolConfig::field('id,name,type,t1_weight,t2_weight,t3_weight,t4_weight,t5_weight')
|
||||
$list = DiceLotteryPoolConfig::field('id,name,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),
|
||||
|
||||
Reference in New Issue
Block a user