1.新增默认彩金池配置
2.优化关联彩金池配置的名称显示 3.优化一键测试权重 4.优化底注配置
This commit is contained in:
@@ -24,6 +24,7 @@ class DiceAnteConfigLogic extends DiceBaseLogic
|
||||
public function add(array $data): mixed
|
||||
{
|
||||
return $this->transaction(function () use ($data) {
|
||||
$this->applyNameTitleFromMult($data);
|
||||
$this->normalizeDefaultField($data);
|
||||
$deptId = AdminScopeHelper::resolveConfigDeptId(null, $data['dept_id'] ?? AdminScopeHelper::DEFAULT_TEMPLATE_DEPT);
|
||||
if ((int) ($data['is_default'] ?? 0) === 1) {
|
||||
@@ -38,6 +39,7 @@ class DiceAnteConfigLogic extends DiceBaseLogic
|
||||
$pickedDeptId = AdminScopeHelper::pickRequestDeptId($requestDeptId, $data);
|
||||
$deptId = AdminScopeHelper::resolveConfigDeptId($adminInfo, $pickedDeptId);
|
||||
return $this->transaction(function () use ($id, $data, $deptId, $adminInfo, $pickedDeptId) {
|
||||
$this->applyNameTitleFromMult($data);
|
||||
$this->normalizeDefaultField($data);
|
||||
if ((int) ($data['is_default'] ?? 0) === 1) {
|
||||
$this->clearOtherDefaults((int) $id, $deptId);
|
||||
@@ -92,6 +94,21 @@ class DiceAnteConfigLogic extends DiceBaseLogic
|
||||
$data['is_default'] = ((int) $data['is_default']) === 1 ? 1 : 0;
|
||||
}
|
||||
|
||||
/** 名称、标题随底注倍率自动设为 xN */
|
||||
private function applyNameTitleFromMult(array &$data): void
|
||||
{
|
||||
if (!array_key_exists('mult', $data)) {
|
||||
return;
|
||||
}
|
||||
$mult = (int) $data['mult'];
|
||||
if ($mult <= 0) {
|
||||
return;
|
||||
}
|
||||
$label = 'x' . $mult;
|
||||
$data['name'] = $label;
|
||||
$data['title'] = $label;
|
||||
}
|
||||
|
||||
private function clearOtherDefaults(?int $excludeId = null, int $deptId = AdminScopeHelper::DEFAULT_TEMPLATE_DEPT): void
|
||||
{
|
||||
$query = $this->model->where('is_default', 1);
|
||||
|
||||
Reference in New Issue
Block a user