优化玩家DicePlayer权重输入方式
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\dice\controller\lottery_config;
|
||||
|
||||
use app\dice\model\lottery_config\DiceLotteryConfig;
|
||||
use plugin\saiadmin\basic\BaseController;
|
||||
use app\dice\logic\lottery_config\DiceLotteryConfigLogic;
|
||||
use app\dice\validate\lottery_config\DiceLotteryConfigValidate;
|
||||
@@ -28,6 +29,21 @@ class DiceLotteryConfigController extends BaseController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 DiceLotteryConfig 列表数据,仅含 id、name,用于 lottery_config_id 下拉(值为 id,显示为 name)
|
||||
* @param Request $request
|
||||
* @return Response 返回 [ ['id' => int, 'name' => string], ... ]
|
||||
*/
|
||||
#[Permission('色子奖池配置列表', 'dice:lottery_config:index:index')]
|
||||
public function getOptions(Request $request): Response
|
||||
{
|
||||
$list = DiceLotteryConfig::field('id,name')->order('id', 'asc')->select();
|
||||
$data = $list->map(function ($item) {
|
||||
return ['id' => (int) $item['id'], 'name' => (string) ($item['name'] ?? '')];
|
||||
})->toArray();
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
* @param Request $request
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\dice\controller\player;
|
||||
|
||||
use app\dice\model\lottery_config\DiceLotteryConfig;
|
||||
use plugin\saiadmin\basic\BaseController;
|
||||
use app\dice\logic\player\DicePlayerLogic;
|
||||
use app\dice\validate\player\DicePlayerValidate;
|
||||
@@ -28,6 +29,21 @@ class DicePlayerController extends BaseController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取彩金池配置选项(DiceLotteryConfig.id、name),供前端 lottery_config_id 下拉使用
|
||||
* @param Request $request
|
||||
* @return Response 返回 [ ['id' => int, 'name' => string], ... ]
|
||||
*/
|
||||
#[Permission('大富翁-玩家列表', 'dice:player:index:index')]
|
||||
public function getLotteryConfigOptions(Request $request): Response
|
||||
{
|
||||
$list = DiceLotteryConfig::field('id,name')->order('id', 'asc')->select();
|
||||
$data = $list->map(function ($item) {
|
||||
return ['id' => (int) $item['id'], 'name' => (string) ($item['name'] ?? '')];
|
||||
})->toArray();
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
* @param Request $request
|
||||
|
||||
Reference in New Issue
Block a user