修改DiceLotteryPoolConfig-type改为name映射

This commit is contained in:
2026-03-17 17:09:10 +08:00
parent d4cf708bc1
commit e7b8f4cae9
18 changed files with 64 additions and 115 deletions

View File

@@ -17,14 +17,13 @@ export default {
}, },
/** /**
* 获取 DiceLotteryPoolConfig 列表数据,含 id、name、type、t1_weightt5_weight用于一键测试权重档位类型下拉 * 获取 DiceLotteryPoolConfig 列表数据,含 id、name、t1_weightt5_weight用于一键测试权重档位类型下拉
* type0=付费抽奖券1=免费抽奖券;付费默认选 type=0免费默认选 type=1 * name 映射default=原 type=0killScore=原 type=1up=原 type=2
*/ */
async getOptions(): Promise< async getOptions(): Promise<
Array<{ Array<{
id: number id: number
name: string name: string
type: number
t1_weight: number t1_weight: number
t2_weight: number t2_weight: number
t3_weight: number t3_weight: number
@@ -40,7 +39,6 @@ export default {
return rows.map((r: any) => ({ return rows.map((r: any) => ({
id: Number(r.id), id: Number(r.id),
name: String(r.name ?? r.id ?? ''), name: String(r.name ?? r.id ?? ''),
type: Number(r.type ?? 0),
t1_weight: Number(r.t1_weight ?? 0), t1_weight: Number(r.t1_weight ?? 0),
t2_weight: Number(r.t2_weight ?? 0), t2_weight: Number(r.t2_weight ?? 0),
t3_weight: Number(r.t3_weight ?? 0), t3_weight: Number(r.t3_weight ?? 0),

View File

@@ -73,7 +73,7 @@
// 搜索表单 // 搜索表单
const searchForm = ref({ const searchForm = ref({
name: undefined, name: undefined,
type: undefined // type 字段已移除,改用 name 区分default/killScore/up
}) })
// 搜索处理 // 搜索处理
@@ -82,9 +82,14 @@
getData() getData()
} }
// 奖池类型展示:0=正常 1=强制杀猪 2=T1高倍率 // 奖池类型展示:按 name 映射
const typeFormatter = (row: Record<string, unknown>) => const typeFormatter = (row: Record<string, unknown>) => {
row.type === 0 ? t('page.search.poolTypeNormal') : row.type === 1 ? t('page.search.poolTypeKill') : row.type === 2 ? t('page.search.poolTypeT1') : '-' const n = String(row.name ?? '')
if (n === 'default') return t('page.search.poolTypeNormal')
if (n === 'killScore') return t('page.search.poolTypeKill')
if (n === 'up') return t('page.search.poolTypeT1')
return n || '-'
}
// 权重列带 % // 权重列带 %
const weightFormatter = (prop: string) => (row: Record<string, unknown>) => { const weightFormatter = (prop: string) => (row: Record<string, unknown>) => {
@@ -111,7 +116,7 @@
apiFn: api.list, apiFn: api.list,
columnsFactory: () => [ columnsFactory: () => [
{ prop: 'name', label: 'page.table.name', align: 'center' }, { prop: 'name', label: 'page.table.name', align: 'center' },
{ prop: 'type', label: 'page.table.poolType', width: 100, align: 'center', formatter: typeFormatter }, { prop: 'name', label: 'page.table.poolType', width: 100, align: 'center', formatter: typeFormatter },
{ prop: 'safety_line', label: 'page.table.safetyLine', align: 'center' }, { prop: 'safety_line', label: 'page.table.safetyLine', align: 'center' },
{ {
prop: 't1_weight', prop: 't1_weight',

View File

@@ -25,19 +25,7 @@
show-word-limit show-word-limit
/> />
</el-form-item> </el-form-item>
<el-form-item :label="$t('page.form.poolType')" prop="type"> <!-- dice_lottery_pool_config 已移除 type 字段 name 区分 default/killScore/upname -->
<el-select
v-model="formData.type"
:placeholder="$t('page.form.placeholderPoolType')"
clearable
style="width: 100%"
:disabled="dialogType === 'edit'"
>
<el-option :label="$t('page.form.poolTypeNormal')" :value="0" />
<el-option :label="$t('page.form.poolTypeKill')" :value="1" />
<el-option :label="$t('page.form.poolTypeT1')" :value="2" />
</el-select>
</el-form-item>
<el-form-item :label="$t('page.form.safetyLine')" prop="safety_line"> <el-form-item :label="$t('page.form.safetyLine')" prop="safety_line">
<el-input-number <el-input-number
v-model="formData.safety_line" v-model="formData.safety_line"
@@ -127,7 +115,6 @@
*/ */
const rules = computed<FormRules>(() => ({ const rules = computed<FormRules>(() => ({
name: [{ required: true, message: t('page.form.ruleNameRequired'), trigger: 'blur' }], name: [{ required: true, message: t('page.form.ruleNameRequired'), trigger: 'blur' }],
type: [{ required: true, message: t('page.form.rulePoolTypeRequired'), trigger: 'change' }],
t1_weight: [{ required: true, message: t('page.form.ruleT1Required'), trigger: 'blur' }], t1_weight: [{ required: true, message: t('page.form.ruleT1Required'), trigger: 'blur' }],
t2_weight: [{ required: true, message: t('page.form.ruleT2Required'), trigger: 'blur' }], t2_weight: [{ required: true, message: t('page.form.ruleT2Required'), trigger: 'blur' }],
t3_weight: [{ required: true, message: t('page.form.ruleT3Required'), trigger: 'blur' }], t3_weight: [{ required: true, message: t('page.form.ruleT3Required'), trigger: 'blur' }],
@@ -142,7 +129,6 @@
id: null as number | null, id: null as number | null,
name: '', name: '',
remark: '', remark: '',
type: null as number | null,
safety_line: 0 as number, safety_line: 0 as number,
t1_weight: 0 as number, t1_weight: 0 as number,
t2_weight: 0 as number, t2_weight: 0 as number,
@@ -188,7 +174,6 @@
if (!props.data) return if (!props.data) return
const numKeys = [ const numKeys = [
'id', 'id',
'type',
'safety_line', 'safety_line',
't1_weight', 't1_weight',
't2_weight', 't2_weight',

View File

@@ -13,16 +13,7 @@
<el-input v-model="formData.name" :placeholder="$t('page.search.placeholderName')" clearable /> <el-input v-model="formData.name" :placeholder="$t('page.search.placeholderName')" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-bind="setSpan(6)"> <!-- dice_lottery_pool_config 已移除 type 字段 name 区分 default/killScore/up -->
<el-form-item :label="$t('page.search.poolType')" prop="type">
<el-select
v-model="formData.type"
:options="typeOptions"
:placeholder="$t('page.search.placeholderPoolType')"
clearable
/>
</el-form-item>
</el-col>
</sa-search-bar> </sa-search-bar>
</template> </template>
@@ -42,11 +33,7 @@
const isExpanded = ref<boolean>(false) const isExpanded = ref<boolean>(false)
const { t } = useI18n() const { t } = useI18n()
const typeOptions = computed(() => [ // type 字段已移除
{ name: '0', value: t('page.search.poolTypeNormal') },
{ name: '1', value: t('page.search.poolTypeKill') },
{ name: '2', value: t('page.search.poolTypeT1') }
])
// 表单数据双向绑定 // 表单数据双向绑定
const searchBarRef = ref() const searchBarRef = ref()
const formData = computed({ const formData = computed({

View File

@@ -89,7 +89,7 @@
</div> </div>
<div class="config-row"> <div class="config-row">
<span class="config-label">{{ $t('page.form.configLabelType') }}</span> <span class="config-label">{{ $t('page.form.configLabelType') }}</span>
<span>{{ lotteryConfigTypeText(currentLotteryConfig.type) }}</span> <span>{{ lotteryConfigTypeText(currentLotteryConfig.name) }}</span>
</div> </div>
<div class="config-row"> <div class="config-row">
<span class="config-label">{{ $t('page.form.configLabelWeights') }}</span> <span class="config-label">{{ $t('page.form.configLabelWeights') }}</span>
@@ -265,11 +265,12 @@
/** 当前选中的 DiceLotteryConfig 完整数据(用于展示) */ /** 当前选中的 DiceLotteryConfig 完整数据(用于展示) */
const currentLotteryConfig = ref<Record<string, any> | null>(null) const currentLotteryConfig = ref<Record<string, any> | null>(null)
function lotteryConfigTypeText(type: unknown): string { function lotteryConfigTypeText(name: unknown): string {
const t = Number(type) const n = String(name ?? '')
if (t === 0) return '付费' if (n === 'default') return '默认'
if (t === 1) return '赠送' if (n === 'killScore') return '杀分'
return t ? `类型${t}` : '-' if (n === 'up') return '上分'
return n || '-'
} }
/** 是否为空/自定义权重(未选彩金池或选 0 */ /** 是否为空/自定义权重(未选彩金池或选 0 */

View File

@@ -18,7 +18,7 @@
<ElFormItem label="测试数据档位类型" prop="paid_lottery_config_id"> <ElFormItem label="测试数据档位类型" prop="paid_lottery_config_id">
<ElSelect <ElSelect
v-model="form.paid_lottery_config_id" v-model="form.paid_lottery_config_id"
placeholder="不选则下方自定义档位概率(默认 type=0" placeholder="不选则下方自定义档位概率(默认 default"
clearable clearable
filterable filterable
style="width: 100%" style="width: 100%"
@@ -70,7 +70,7 @@
<ElFormItem label="测试数据档位类型" prop="free_lottery_config_id"> <ElFormItem label="测试数据档位类型" prop="free_lottery_config_id">
<ElSelect <ElSelect
v-model="form.free_lottery_config_id" v-model="form.free_lottery_config_id"
placeholder="不选则下方自定义档位概率(默认 type=1" placeholder="不选则下方自定义档位概率(默认 killScore"
clearable clearable
filterable filterable
style="width: 100%" style="width: 100%"
@@ -153,22 +153,13 @@
free_s_count: 100, free_s_count: 100,
free_n_count: 100 free_n_count: 100
}) })
const lotteryOptions = ref<Array<{ id: number; name: string; type: number }>>([]) const lotteryOptions = ref<Array<{ id: number; name: string }>>([])
/** 将 type 转为数字(接口可能返回字符串 "0"/"1" */ /** 付费抽奖券可选档位name=default */
function tierTypeNum(r: { type?: number | string }): number { const paidLotteryOptions = computed(() => lotteryOptions.value.filter((r) => r.name === 'default'))
const t = r.type ?? 0 /** 免费抽奖券可选档位:优先 name=killScore若无则显示全部以便下拉有选项 */
return typeof t === 'number' ? t : Number(t) || 0
}
/** 付费抽奖券可选档位type=0 */
const paidLotteryOptions = computed(() =>
lotteryOptions.value.filter((r) => tierTypeNum(r) === 0)
)
/**
* 免费抽奖券可选档位:优先 type=1DiceLotteryPoolConfig.type=1若无则显示全部以便下拉有选项
*/
const freeLotteryOptions = computed(() => { const freeLotteryOptions = computed(() => {
const type1List = lotteryOptions.value.filter((r) => tierTypeNum(r) === 1) const list = lotteryOptions.value.filter((r) => r.name === 'killScore')
return type1List.length > 0 ? type1List : lotteryOptions.value return list.length > 0 ? list : lotteryOptions.value
}) })
const running = ref(false) const running = ref(false)
@@ -211,22 +202,16 @@
async function loadLotteryOptions() { async function loadLotteryOptions() {
try { try {
const list = await lotteryPoolApi.getOptions() const list = await lotteryPoolApi.getOptions()
lotteryOptions.value = list.map( lotteryOptions.value = list.map((r: { id: number; name: string }) => ({ id: r.id, name: r.name }))
(r: { id: number; name: string; type?: number | string }) => ({ // 付费抽奖券默认使用 name=default
id: r.id, const normal = list.find((r: { name?: string }) => r.name === 'default')
name: r.name, if (normal) {
type: tierTypeNum(r) form.paid_lottery_config_id = normal.id
})
)
// 付费抽奖券默认使用 type=0 的档位类型
const type0 = list.find((r: { type?: number | string }) => tierTypeNum(r) === 0)
if (type0) {
form.paid_lottery_config_id = type0.id
} }
// 免费抽奖券默认使用 type=1 的档位类型DiceLotteryPoolConfig.type=1若无 type=1 则默认选第一项 // 免费抽奖券默认使用 name=killScore若无则默认选第一项
const type1 = list.find((r: { type?: number | string }) => tierTypeNum(r) === 1) const kill = list.find((r: { name?: string }) => r.name === 'killScore')
if (type1) { if (kill) {
form.free_lottery_config_id = type1.id form.free_lottery_config_id = kill.id
} else if (list.length > 0) { } else if (list.length > 0) {
form.free_lottery_config_id = list[0].id form.free_lottery_config_id = list[0].id
} }
@@ -312,7 +297,7 @@
} }
}) })
// 切换到免费步骤时,若当前选中 id 不在免费档位列表中,则重置为第一个 type=1 的选项,避免显示错误 // 切换到免费步骤时,若当前选中 id 不在免费档位列表中,则重置为第一个 killScore 的选项,避免显示错误
watch(currentStep, (step) => { watch(currentStep, (step) => {
if (step === 1) { if (step === 1) {
const freeOpts = freeLotteryOptions.value const freeOpts = freeLotteryOptions.value

View File

@@ -266,7 +266,7 @@
const importing = ref(false) const importing = ref(false)
const importPaidLotteryConfigId = ref<number | null>(null) const importPaidLotteryConfigId = ref<number | null>(null)
const importFreeLotteryConfigId = ref<number | null>(null) const importFreeLotteryConfigId = ref<number | null>(null)
const lotteryConfigOptions = ref<Array<{ id: number; name: string; type: number }>>([]) const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
function tierWeightsToTableData(t: Record<string, number> | null | undefined) { function tierWeightsToTableData(t: Record<string, number> | null | undefined) {
if (!t || typeof t !== 'object') return [] if (!t || typeof t !== 'object') return []

View File

@@ -39,9 +39,9 @@ return [
'配置ID %s 不存在或档位为空' => 'Config ID %s not found or tier is empty', '配置ID %s 不存在或档位为空' => 'Config ID %s not found or tier is empty',
'该方向下暂无可用路径配置' => 'No path config available for this direction', '该方向下暂无可用路径配置' => 'No path config available for this direction',
// Dice / pool config // Dice / pool config
'奖池配置不存在(需 type=0' => 'Lottery pool config not found (type=0 required)', '奖池配置不存在(需 name=default' => 'Lottery pool config not found (name=default required)',
'暂无可用奖励配置' => 'No available reward config', '暂无可用奖励配置' => 'No available reward config',
'未找到 type=0 的奖池配置,请先创建' => 'No type=0 pool config found, please create one first', '未找到 name=default 的奖池配置,请先创建' => 'No name=default pool config found, please create one first',
// Dice / wallet & tickets // Dice / wallet & tickets
'参数错误:需要有效的 player_id 和 type3=加点4=扣点)' => 'Invalid params: player_id and type are required (3=add, 4=deduct)', '参数错误:需要有效的 player_id 和 type3=加点4=扣点)' => 'Invalid params: player_id and type are required (3=add, 4=deduct)',
'平台币变动必须大于 0' => 'Coin change must be greater than 0', '平台币变动必须大于 0' => 'Coin change must be greater than 0',

View File

@@ -71,10 +71,10 @@ class PlayStartLogic
$lotteryService = LotteryService::getOrCreate($playerId); $lotteryService = LotteryService::getOrCreate($playerId);
$ticketType = LotteryService::drawTicketType($paid, $free); $ticketType = LotteryService::drawTicketType($paid, $free);
$configType0 = DiceLotteryPoolConfig::where('type', 0)->find(); $configType0 = DiceLotteryPoolConfig::where('name', 'default')->find();
$configType1 = DiceLotteryPoolConfig::where('type', 1)->find(); $configType1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
if (!$configType0) { if (!$configType0) {
throw new ApiException('奖池配置不存在(需 type=0'); throw new ApiException('奖池配置不存在(需 name=default');
} }
// 玩家累计盈利:仅统计 lottery_config_id=type=0 的成功对局(中奖金额-100*局数) // 玩家累计盈利:仅统计 lottery_config_id=type=0 的成功对局(中奖金额-100*局数)

View File

@@ -56,8 +56,8 @@ class LotteryService
if (!$player) { if (!$player) {
throw new \RuntimeException('玩家不存在'); throw new \RuntimeException('玩家不存在');
} }
$config0 = DiceLotteryPoolConfig::where('type', 0)->find(); $config0 = DiceLotteryPoolConfig::where('name', 'default')->find();
$config1 = DiceLotteryPoolConfig::where('type', 1)->find(); $config1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
$s = new self($playerId); $s = new self($playerId);
$s->configType0Id = $config0 ? (int) $config0->id : null; $s->configType0Id = $config0 ? (int) $config0->id : null;
$s->configType1Id = $config1 ? (int) $config1->id : null; $s->configType1Id = $config1 ? (int) $config1->id : null;

View File

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

View File

@@ -38,11 +38,11 @@ class DiceLotteryPoolConfigLogic extends BaseLogic
*/ */
public function getCurrentPool(): array public function getCurrentPool(): array
{ {
$configType0 = DiceLotteryPoolConfig::where('type', 0)->find(); $configType0 = DiceLotteryPoolConfig::where('name', 'default')->find();
if (!$configType0) { if (!$configType0) {
throw new ApiException('未找到 type=0 的奖池配置,请先创建'); throw new ApiException('未找到 name=default 的奖池配置,请先创建');
} }
$configType1 = DiceLotteryPoolConfig::where('type', 1)->find(); $configType1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
$row0 = $configType0->toArray(); $row0 = $configType0->toArray();
$profitAmount = isset($row0['profit_amount']) ? (float) $row0['profit_amount'] : (isset($row0['ev']) ? (float) $row0['ev'] : 0.0); $profitAmount = isset($row0['profit_amount']) ? (float) $row0['profit_amount'] : (isset($row0['ev']) ? (float) $row0['ev'] : 0.0);
$pool = [ $pool = [

View File

@@ -333,7 +333,7 @@ class DiceRewardConfigLogic extends BaseLogic
$config = DiceLotteryPoolConfig::find($lotteryConfigId); $config = DiceLotteryPoolConfig::find($lotteryConfigId);
} }
if (!$config) { if (!$config) {
$config = DiceLotteryPoolConfig::where('type', 0)->find(); $config = DiceLotteryPoolConfig::where('name', 'default')->find();
} }
if ($config) { if ($config) {
$tierWeights = [ $tierWeights = [

View File

@@ -16,7 +16,6 @@ use plugin\saiadmin\basic\think\BaseModel;
* @property $id ID * @property $id ID
* @property $name 名称 * @property $name 名称
* @property $remark 备注 * @property $remark 备注
* @property $type 奖池类型
* @property $safety_line 安全线 * @property $safety_line 安全线
* @property $kill_enabled 是否启用杀分0=关闭 1=开启 * @property $kill_enabled 是否启用杀分0=关闭 1=开启
* @property $create_time 创建时间 * @property $create_time 创建时间
@@ -50,13 +49,4 @@ class DiceLotteryPoolConfig extends BaseModel
$query->where('name', 'like', '%'.$value.'%'); $query->where('name', 'like', '%'.$value.'%');
} }
/**
* 奖池类型 搜索type=0/1/2 等)
*/
public function searchTypeAttr($query, $value)
{
if ($value !== '' && $value !== null) {
$query->where('type', '=', $value);
}
}
} }

View File

@@ -78,26 +78,26 @@ class DicePlayer extends BaseModel
if ($name === null || $name === '') { if ($name === null || $name === '') {
$model->setAttr('name', $uid); $model->setAttr('name', $uid);
} }
// 创建玩家时:未指定则自动保存 lottery_config_id 为 DiceLotteryPoolConfig type=0 的 id没有则为 0 // 创建玩家时:未指定则自动保存 lottery_config_id 为 DiceLotteryPoolConfig name=default 的 id没有则为 0
try { try {
$lotteryConfigId = $model->getAttr('lottery_config_id'); $lotteryConfigId = $model->getAttr('lottery_config_id');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$lotteryConfigId = null; $lotteryConfigId = null;
} }
if ($lotteryConfigId === null || $lotteryConfigId === '' || (int) $lotteryConfigId === 0) { if ($lotteryConfigId === null || $lotteryConfigId === '' || (int) $lotteryConfigId === 0) {
$config = DiceLotteryPoolConfig::where('type', 0)->find(); $config = DiceLotteryPoolConfig::where('name', 'default')->find();
$model->setAttr('lottery_config_id', $config ? (int) $config->id : 0); $model->setAttr('lottery_config_id', $config ? (int) $config->id : 0);
} }
// 彩金池权重默认取 type=0 的奖池配置 // 彩金池权重默认取 name=default 的奖池配置
self::setDefaultWeightsFromLotteryConfig($model); self::setDefaultWeightsFromLotteryConfig($model);
} }
/** /**
* 从 DiceLotteryPoolConfig type=0 取 t1_weightt5_weight 作为玩家未设置时的默认值 * 从 DiceLotteryPoolConfig name=default 取 t1_weightt5_weight 作为玩家未设置时的默认值
*/ */
protected static function setDefaultWeightsFromLotteryConfig(DicePlayer $model): void protected static function setDefaultWeightsFromLotteryConfig(DicePlayer $model): void
{ {
$config = DiceLotteryPoolConfig::where('type', 0)->find(); $config = DiceLotteryPoolConfig::where('name', 'default')->find();
if (!$config) { if (!$config) {
return; return;
} }

View File

@@ -69,7 +69,7 @@ The exact implementation is in the dice game logic layer and related services. A
3. Get or create lottery pool: 3. Get or create lottery pool:
- `LotteryService::getOrCreate()` - `LotteryService::getOrCreate()`
- Reads from Redis; if missing, reads from DB (for example, `DiceLotteryPoolConfig::where('type', 0/1)->find()`). - Reads from Redis; if missing, reads from DB (for example, `DiceLotteryPoolConfig::where('name','default/killScore')->find()`).
4. Load concrete pool config for this play: 4. Load concrete pool config for this play:
- `DiceLotteryPoolConfig::find($configId)` - `DiceLotteryPoolConfig::find($configId)`

View File

@@ -67,7 +67,7 @@
3. **获取或创建奖池LotteryService** 3. **获取或创建奖池LotteryService**
- 调用 `LotteryService::getOrCreate()` - 调用 `LotteryService::getOrCreate()`
- 优先从 Redis 中读取奖池信息; - 优先从 Redis 中读取奖池信息;
- 若缓存不存在,则从 DB 中加载:如 `DiceLotteryPoolConfig::where('type', 0/1)->find()` - 若缓存不存在,则从 DB 中加载:如 `DiceLotteryPoolConfig::where('name','default/killScore')->find()`
4. **根据本次玩法加载奖池配置** 4. **根据本次玩法加载奖池配置**
- 调用 `DiceLotteryPoolConfig::find($configId)` - 调用 `DiceLotteryPoolConfig::find($configId)`

View File

@@ -37,9 +37,9 @@ return [
'奖池配置不存在' => 'Lottery config not found', '奖池配置不存在' => 'Lottery config not found',
'配置ID %s 不存在或档位为空' => 'Config ID %s not found or tier is empty', '配置ID %s 不存在或档位为空' => 'Config ID %s not found or tier is empty',
'该方向下暂无可用路径配置' => 'No path config available for this direction', '该方向下暂无可用路径配置' => 'No path config available for this direction',
'奖池配置不存在(需 type=0' => 'Lottery pool config not found (type=0 required)', '奖池配置不存在(需 name=default' => 'Lottery pool config not found (name=default required)',
'暂无可用奖励配置' => 'No available reward config', '暂无可用奖励配置' => 'No available reward config',
'未找到 type=0 的奖池配置,请先创建' => 'No type=0 pool config found, please create one first', '未找到 name=default 的奖池配置,请先创建' => 'No name=default pool config found, please create one first',
'参数错误:需要有效的 player_id 和 type3=加点4=扣点)' => 'Invalid params: player_id and type are required (3=add, 4=deduct)', '参数错误:需要有效的 player_id 和 type3=加点4=扣点)' => 'Invalid params: player_id and type are required (3=add, 4=deduct)',
'平台币变动必须大于 0' => 'Coin change must be greater than 0', '平台币变动必须大于 0' => 'Coin change must be greater than 0',
'玩家不存在' => 'Player not found', '玩家不存在' => 'Player not found',