Compare commits

8 Commits

36 changed files with 953 additions and 361 deletions

View File

@@ -117,7 +117,8 @@
right: 0,
left: 0,
bottom: 0, // 增加底部间距
containLabel: true
outerBoundsMode: 'same' as const,
outerBoundsContain: 'axisLabel' as const
}
const options: EChartsOption = {

View File

@@ -75,7 +75,8 @@
right: 20,
bottom: props.showDataZoom ? 80 : 20,
left: 20,
containLabel: true
outerBoundsMode: 'same',
outerBoundsContain: 'axisLabel'
},
tooltip: getTooltipStyle('axis', {
axisPointer: {

View File

@@ -64,7 +64,8 @@
right: 20,
bottom: 20,
left: 20,
containLabel: true
outerBoundsMode: 'same',
outerBoundsContain: 'axisLabel'
},
tooltip: props.showTooltip
? getTooltipStyle('item', {

View File

@@ -345,7 +345,9 @@ export function useChart(options: UseChartOptions = {}) {
right: 15,
bottom: 8,
left: 0,
containLabel: true,
// ECharts 6替代已弃用的 containLabel需配合 outerBounds 布局,避免控制台告警)
outerBoundsMode: 'same' as const,
outerBoundsContain: 'axisLabel' as const,
...baseGrid
}

View File

@@ -36,6 +36,9 @@
"editSuccess": "Updated successfully",
"validateFailed": "Validation failed, please check required fields and format"
},
"toolbar": {
"platformTotalProfit": "Platform Total Profit"
},
"search": {
"player": "Player",
"lotteryPoolConfig": "Lottery Pool Config",

View File

@@ -1,12 +1,13 @@
{
"toolbar": {
"weightRatio": "Weight Ratio",
"weightTest": "Test Weight"
"weightTest": "Test Weights"
},
"search": {
"tier": "Tier",
"clockwise": "Clockwise",
"anticlockwise": "Anticlockwise"
"anticlockwise": "Counter-clockwise",
"optionBigwin": "BIGWIN"
},
"table": {
"startIndex": "Start Index",
@@ -17,5 +18,67 @@
"realEv": "Real EV",
"remark": "Remark",
"weight": "Weight"
},
"weightShared": {
"xAxisEndIndex": "End Index",
"xAxisGridNumber": "Points",
"emptyTier": "No data for this tier",
"sumLineDual": "Tier weight sum (clockwise): {cw}; counter-clockwise: {ccw} (each row 110000, ratio draw within tier, sum not limited)",
"sumLineSingle": "Tier weight sum: {sum} (each row 110000, ratio draw within tier, sum not limited)",
"t4t5NoteSingle": "T4 and T5 have a single outcome; no weight configuration.",
"t4t5NoteDual": "T4 and T5 have a single outcome when hit; no weight configuration.",
"colEndIndexId": "End Index (id)",
"colGridNumber": "Points (grid_number)",
"colDicePoints": "Dice Points",
"colRealEv": "Real EV",
"colUiText": "Display Text",
"colRemark": "Remark",
"colWeightCwDir": "Clockwise weight (direction=0)",
"colWeightCcwDir": "Counter-clockwise weight (direction=1)",
"weightColSuffix": "Weight (1-10000)",
"fetchFail": "Failed to load weight data",
"nothingToSubmit": "Nothing to submit",
"submitFail": "Save failed",
"btnCancel": "Cancel",
"btnSubmit": "Submit",
"saveSuccess": "Saved successfully"
},
"weightEdit": {
"title": "Dice Reward (dice_reward) Weight Ratio",
"globalTip": "You are editing weights on dice_reward (DiceReward), split by end_index into clockwise and counter-clockwise; the draw uses the set for the current direction."
},
"weightRatio": {
"title": "Weight Ratio",
"globalTip": "Configure dice_reward weights: first by direction (clockwise / counter-clockwise), then by tier (T1T5); each row weight 110000, ratio draw within tier.",
"tabClockwise": "Clockwise",
"tabCounterclockwise": "Counter-clockwise"
},
"weightTest": {
"title": "One-Click Weight Test",
"alertTitle": "Bonus pool logic",
"alertBody": "Same as playStart draw: uses name=default safety line and kill switch; when profit is below the line, paid tickets use player tier weights (custom below), free tickets use killScore; when profit reaches the line and kill is on, both use killScore.",
"stepPaid": "Paid ticket",
"stepFree": "Free ticket",
"labelLotteryTypePaid": "Test pool type",
"labelLotteryTypeFree": "Test pool type",
"placeholderPaidPool": "Leave empty for custom tier odds below (default: default)",
"placeholderFreePool": "Leave empty for custom tier odds below (default: killScore)",
"tierProbHint": "Custom tier odds (T1T5), each 0100%, sum of five must not exceed 100%",
"tierFieldLabel": "Tier {tier} (%)",
"tierSumError": "Current sum of five tiers is {sum}%, cannot exceed 100%",
"labelCwCount": "Clockwise spins",
"labelCcwCount": "Counter-clockwise spins",
"placeholderSelect": "Please select",
"btnPrev": "Back",
"btnNext": "Next",
"btnStart": "Start test",
"btnCancel": "Cancel",
"warnTotalSpins": "At least one of paid/free direction spin counts must be greater than 0",
"warnPaidTierSumPositive": "When no paid pool is selected, T1T5 odds sum must be greater than 0",
"warnPaidTierSumMax": "Paid T1T5 odds sum cannot exceed 100%",
"warnFreeTierSumPositive": "When no free pool is selected, T1T5 odds sum must be greater than 0",
"warnFreeTierSumMax": "Free T1T5 odds sum cannot exceed 100%",
"successCreated": "Test job created and will run in background. Check player draw records (test data) for results.",
"failCreate": "Failed to create test job"
}
}

View File

@@ -1,7 +1,74 @@
{
"toolbar": {
"gameRewardConfig": "Game Reward Config",
"createRewardRef": "Create Reward Reference"
"createRewardRef": "Create Reward Reference",
"createRewardRefTitle": "Rule: start_index=config(grid_number).id; clockwise end_index=(start_index+grid_number)%26; counter-clockwise end_index=start_index-grid_number>=0?start_index-grid_number:26+start_index-grid_number"
},
"configPage": {
"tabIndex": "Reward Index",
"tabBigwin": "Big Win Weights",
"tipIndex": "Dice points must be between 5 and 30 and unique in this table.",
"tipBigwin": "Left to right: big-win points (read-only), display text, real EV, remark, weight (0~10000). Points 5 and 30 are fixed at 100%. This tab saves big-win weights only.",
"colId": "Index (id)",
"colDicePoints": "Dice Points",
"colDisplayText": "Display Text",
"colDisplayTextEn": "Display Text (EN)",
"colRealEv": "Real Settlement",
"colTier": "Tier",
"colRemark": "Remark",
"placeholderTierSelect": "Tier",
"placeholderDisplayZh": "Display text (Chinese)",
"placeholderDisplayEn": "Display text (English)",
"placeholderRemark": "Remark",
"btnSave": "Save",
"btnReset": "Reset",
"colBigwinPoints": "Big-Win Points",
"colDisplayInfo": "Display Info",
"colDisplayInfoEn": "Display Info (EN)",
"colRealPrize": "Real Prize",
"colWeightRange": "Weight (0-10000)",
"placeholderDisplayInfoZh": "Display info (Chinese)",
"placeholderDisplayInfoEn": "Display info (English)",
"weightFixedTip": "Points 5 and 30 are fixed at 100%",
"emptyBigwin": "No BIGWIN tier rows. Set tier to BIGWIN in the Reward Index tab first.",
"confirmCreateRefTitle": "Create Reward Reference",
"confirmCreateRefMsg": "Create reward reference by rule: start_index is the id of the cell for grid_number in reward config; clockwise end_index=(start_index+roll)%26; counter-clockwise end_index=start_index-roll if >=0 else 26+start_index-roll. Existing data will be cleared, then 26 points (530) for both directions will be generated. Continue?",
"confirmCreateRefOk": "Create",
"confirmCreateRefCancel": "Cancel",
"createRefSuccess": "Created for 26 dice points (530), clockwise + counter-clockwise: clockwise added {cwNew}, counter-clockwise added {ccwNew}; clockwise updated {cwUp}, counter-clockwise updated {ccwUp}{skippedPart}",
"createRefSuccessSkipped": "; {n} point(s) used fallback start index",
"createRefSuccessSimple": "Created successfully",
"createRefFail": "Failed to create reward reference",
"loadIndexFail": "Failed to load reward index config",
"saveSuccess": "Saved successfully",
"saveFail": "Save failed",
"resetIndexReloaded": "Reward index reloaded from server",
"resetBigwinReloaded": "Big win weights reloaded from server",
"warnNoIndexToSave": "No reward index rows to save",
"warnGridRange": "Dice points must be between {min} and {max}",
"dupJoiner": ", ",
"warnDupGrid": "Duplicate dice points in this table: {list}",
"warnNoBigwinToSave": "No BIGWIN rows to save",
"warnBigwinDupGrid": "Duplicate big-win points in this table: {list}",
"infoNoBigwin": "No BIGWIN rows. Set tier to BIGWIN in the Reward Index tab first."
},
"weightRatio": {
"title": "T1T5 Weight Ratio (Clockwise / Counter-clockwise)",
"globalTip": "Weights come from dice_reward, split by end index (DiceRewardConfig.id) into clockwise and counter-clockwise; draw uses the weight set for the current direction.",
"xAxisEndIndex": "End Index",
"emptyTier": "No data for this tier",
"sumLine": "Tier weight sum (clockwise): {cw}; counter-clockwise: {ccw} (each row 110000, ratio draw within tier, sum not limited)",
"t4t5Note": "T4 and T5 have a single outcome; no weight configuration.",
"colEndIndexId": "End Index (id)",
"colDicePoints": "Dice Points",
"colRealEv": "Real EV",
"colUiText": "Display Text",
"colWeightCw": "Clockwise weight (1-10000)",
"colWeightCcw": "Counter-clockwise weight (1-10000)",
"fetchFail": "Failed to load weight ratio data",
"nothingToSubmit": "Nothing to submit",
"submitFail": "Save failed",
"saveSuccess": "Saved successfully"
},
"search": {
"dicePoints": "Dice Points",

View File

@@ -4,6 +4,8 @@
},
"table": {
"id": "ID",
"clockwiseAbbr": "CW",
"counterclockwiseAbbr": "CCW",
"status": "Status",
"paidDraw": "Paid Draw",
"freeDraw": "Free Draw",
@@ -27,5 +29,51 @@
"ruleTestCountRequired": "Test count is required",
"addSuccess": "Added successfully",
"editSuccess": "Updated successfully"
},
"detail": {
"title": "Test Record Detail",
"sectionBasic": "Basic Info",
"recordId": "Record ID",
"testCount": "Test count",
"testCountSuffix": " runs",
"createTime": "Created at",
"admin": "Operator",
"paidPoolId": "Paid lottery pool config ID",
"freePoolId": "Free lottery pool config ID",
"bigwinSnapshot": "BIGWIN weight snapshot",
"sectionPaidTier": "Paid draw tier odds (T1T5, used in test)",
"sectionFreeTier": "Free draw tier odds (T1T5, used in test)",
"colTier": "Tier",
"colWeight": "Weight",
"colPercent": "Share",
"emptyPaidTier": "No paid tier data (legacy records may only have tier_weights_snapshot)",
"emptyFreeTier": "No free tier data",
"sectionSnapshot": "Weight snapshot (T1T5 / BIGWIN used in test)",
"subCw": "Clockwise (non-BIGWIN)",
"subCcw": "Counter-clockwise (non-BIGWIN)",
"colGridNumber": "Dice points",
"emptyCw": "No clockwise data",
"emptyCcw": "No counter-clockwise data",
"subBigwin": "BIGWIN (DiceRewardConfig snapshot)",
"emptyBigwinTable": "No BIGWIN data",
"sectionResult": "Landing stats (count per grid_number)",
"chartXAxis": "Dice points (grid_number)",
"emptyResult": "No landing data",
"resultTotal": "Total landings: {n}",
"btnImport": "Import to current config",
"importTitle": "Import to production config",
"importDesc": "Import this test record into DiceReward (cell weights), DiceRewardConfig (BIGWIN weight), and DiceLotteryPoolConfig (paid/free T1T5 odds). Select target pools.",
"importPaidLabel": "Import paid tier odds to pool",
"importPaidPlaceholder": "Select a pool (paid pool recommended)",
"importPaidTip": "If empty, uses paid pool ID saved on this record",
"importFreeLabel": "Import free tier odds to pool",
"importFreePlaceholder": "Select a pool (free pool recommended)",
"importFreeTip": "If empty, uses free pool ID saved on this record",
"btnConfirmImport": "Confirm import",
"importSuccess": "Imported. DiceReward, DiceRewardConfig (BIGWIN), and pool config refreshed.",
"importFail": "Import failed",
"dash": "—",
"dirCw": "Clockwise",
"dirCcw": "Counter-clockwise"
}
}

View File

@@ -36,6 +36,9 @@
"editSuccess": "修改成功",
"validateFailed": "表单验证失败,请检查必填项与格式"
},
"toolbar": {
"platformTotalProfit": "平台总盈利"
},
"search": {
"player": "玩家",
"lotteryPoolConfig": "彩金池配置",

View File

@@ -6,7 +6,8 @@
"search": {
"tier": "档位",
"clockwise": "顺时针",
"anticlockwise": "逆时针"
"anticlockwise": "逆时针",
"optionBigwin": "BIGWIN"
},
"table": {
"startIndex": "起始索引",
@@ -17,5 +18,67 @@
"realEv": "实际中奖金额",
"remark": "备注",
"weight": "权重(1-10000)"
},
"weightShared": {
"xAxisEndIndex": "结束索引",
"xAxisGridNumber": "点数",
"emptyTier": "该档位暂无配置数据",
"sumLineDual": "当前档位权重合计(顺时针):{cw};逆时针:{ccw}(各条 1-10000档位内按权重比抽取和不限制",
"sumLineSingle": "当前档位权重合计:{sum}(各条 1-10000档位内按权重比抽取和不限制",
"t4t5NoteSingle": "T4、T5 仅单一结果,无需配置权重。",
"t4t5NoteDual": "T4、T5 档位抽中时仅有一个结果,无需配置权重。",
"colEndIndexId": "结束索引(id)",
"colGridNumber": "点数(grid_number)",
"colDicePoints": "色子点数",
"colRealEv": "实际中奖金额",
"colUiText": "显示文本",
"colRemark": "备注",
"colWeightCwDir": "顺时针权重(direction=0)",
"colWeightCcwDir": "逆时针权重(direction=1)",
"weightColSuffix": "权重(1-10000)",
"fetchFail": "获取权重数据失败",
"nothingToSubmit": "没有可提交的配置",
"submitFail": "保存失败",
"btnCancel": "取消",
"btnSubmit": "提交",
"saveSuccess": "保存成功"
},
"weightEdit": {
"title": "奖励对照表dice_reward权重配比",
"globalTip": "编辑的是奖励对照表dice_reward / DiceReward 模型的权重按结束索引end_index区分顺时针与逆时针两套权重抽奖时按当前方向取对应权重。"
},
"weightRatio": {
"title": "权重配比",
"globalTip": "配置奖励对照表dice_reward的权重一级按方向顺时针/逆时针二级按档位T1-T5各条权重 1-10000档位内按权重比抽取。",
"tabClockwise": "顺时针",
"tabCounterclockwise": "逆时针"
},
"weightTest": {
"title": "一键测试权重",
"alertTitle": "彩金池逻辑说明",
"alertBody": "与 playStart 抽奖逻辑一致:使用 name=default 的安全线、杀分开关;盈利未达安全线时,付费抽奖券使用玩家自身权重(下方自定义档位),免费抽奖券使用 killScore 配置;盈利达到安全线且杀分开启时,付费/免费均使用 killScore 配置。",
"stepPaid": "付费抽奖券",
"stepFree": "免费抽奖券",
"labelLotteryTypePaid": "测试数据档位类型",
"labelLotteryTypeFree": "测试数据档位类型",
"placeholderPaidPool": "不选则下方自定义档位概率(默认 default",
"placeholderFreePool": "不选则下方自定义档位概率(默认 killScore",
"tierProbHint": "自定义档位概率T1T5每档 0-100%,五档之和不能超过 100%",
"tierFieldLabel": "档位 {tier}%",
"tierSumError": "当前五档之和为 {sum}%,不能超过 100%",
"labelCwCount": "顺时针次数",
"labelCcwCount": "逆时针次数",
"placeholderSelect": "请选择",
"btnPrev": "上一步",
"btnNext": "下一步",
"btnStart": "开始测试",
"btnCancel": "取消",
"warnTotalSpins": "付费或免费至少一种方向次数之和大于 0",
"warnPaidTierSumPositive": "付费未选奖池时T1T5 档位概率之和需大于 0",
"warnPaidTierSumMax": "付费档位概率 T1T5 之和不能超过 100%",
"warnFreeTierSumPositive": "免费未选奖池时T1T5 档位概率之和需大于 0",
"warnFreeTierSumMax": "免费档位概率 T1T5 之和不能超过 100%",
"successCreated": "测试任务已创建,后台将自动执行。请在【玩家抽奖记录(测试数据)】中查看生成的测试数据",
"failCreate": "创建测试任务失败"
}
}

View File

@@ -1,7 +1,74 @@
{
"toolbar": {
"gameRewardConfig": "游戏奖励配置",
"createRewardRef": "创建奖励对照"
"createRewardRef": "创建奖励对照",
"createRewardRefTitle": "按规则start_index=config(grid_number).id顺时针 end_index=(start_index+grid_number)%26逆时针 end_index=start_index-grid_number≥0?start_index-grid_number:26+start_index-grid_number"
},
"configPage": {
"tabIndex": "奖励索引",
"tabBigwin": "大奖权重",
"tipIndex": "色子点数须在 530 之间且本表内不重复。",
"tipBigwin": "从左至右:中大奖点数(不可改)、显示信息、实际中奖、备注、权重(0~10000)。点数 5、30 权重固定 100%。本表单独立提交,仅提交大奖权重。",
"colId": "索引(id)",
"colDicePoints": "色子点数",
"colDisplayText": "显示文本",
"colDisplayTextEn": "显示文本(英文)",
"colRealEv": "真实结算",
"colTier": "所属档位",
"colRemark": "备注",
"placeholderTierSelect": "档位",
"placeholderDisplayZh": "显示文本(中文)",
"placeholderDisplayEn": "显示文本(英文)",
"placeholderRemark": "备注",
"btnSave": "保存",
"btnReset": "重置",
"colBigwinPoints": "中大奖点数",
"colDisplayInfo": "显示信息",
"colDisplayInfoEn": "显示信息(英文)",
"colRealPrize": "实际中奖",
"colWeightRange": "权重(0-10000)",
"placeholderDisplayInfoZh": "显示信息(中文)",
"placeholderDisplayInfoEn": "显示信息(英文)",
"weightFixedTip": "点数 5、30 固定 100%",
"emptyBigwin": "暂无 BIGWIN 档位配置,请在「奖励索引」中设置 tier 为 BIGWIN。",
"confirmCreateRefTitle": "创建奖励对照",
"confirmCreateRefMsg": "按规则创建奖励对照:起始索引 start_index=奖励配置中 grid_number 对应格位的 id顺时针 end_index=(start_index+摇取点数)%26逆时针 end_index=start_index-摇取点数≥0 则取该值,否则 26+start_index-摇取点数。先清空现有数据再为 5-30 共 26 个点数、顺/逆时针分别生成。是否继续?",
"confirmCreateRefOk": "确定创建",
"confirmCreateRefCancel": "取消",
"createRefSuccess": "已按 5-30 共 26 个点数、顺时针+逆时针创建:顺时针新增 {cwNew} 条、逆时针新增 {ccwNew} 条;顺时针更新 {cwUp} 条、逆时针更新 {ccwUp} 条{skippedPart}",
"createRefSuccessSkipped": "{n} 个点数使用兜底起始索引",
"createRefSuccessSimple": "创建成功",
"createRefFail": "创建奖励对照失败",
"loadIndexFail": "获取奖励索引配置失败",
"saveSuccess": "保存成功",
"saveFail": "保存失败",
"resetIndexReloaded": "已重新加载奖励索引,恢复为服务器最新数据",
"resetBigwinReloaded": "已重新加载,大奖权重恢复为服务器最新数据",
"warnNoIndexToSave": "暂无奖励索引数据可保存",
"warnGridRange": "色子点数必须在 {min}{max} 之间",
"dupJoiner": "、",
"warnDupGrid": "色子点数在本表内不能重复,重复的点数为:{list}",
"warnNoBigwinToSave": "暂无 BIGWIN 档位配置可保存",
"warnBigwinDupGrid": "大奖权重本表内点数不能重复,重复的点数为:{list}",
"infoNoBigwin": "暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN"
},
"weightRatio": {
"title": "T1-T5 权重配比(顺时针/逆时针)",
"globalTip": "权重来自奖励对照表dice_reward按结束索引DiceRewardConfig.id区分顺时针与逆时针两套权重抽奖时按当前方向取对应权重。",
"xAxisEndIndex": "结束索引",
"emptyTier": "该档位暂无配置数据",
"sumLine": "当前档位权重合计(顺时针):{cw};逆时针:{ccw}(各条 1-10000档位内按权重比抽取和不限制",
"t4t5Note": "T4、T5 档位抽中时仅有一个结果,无需配置权重。",
"colEndIndexId": "结束索引(id)",
"colDicePoints": "色子点数",
"colRealEv": "实际中奖金额",
"colUiText": "显示文本",
"colWeightCw": "顺时针权重(1-10000)",
"colWeightCcw": "逆时针权重(1-10000)",
"fetchFail": "获取权重配比数据失败",
"nothingToSubmit": "没有可提交的配置",
"submitFail": "保存失败",
"saveSuccess": "保存成功"
},
"search": {
"dicePoints": "色子点数(摇取5-30)",

View File

@@ -4,6 +4,8 @@
},
"table": {
"id": "ID",
"clockwiseAbbr": "顺",
"counterclockwiseAbbr": "逆",
"status": "状态",
"paidDraw": "付费抽取",
"freeDraw": "免费抽取",
@@ -27,5 +29,51 @@
"ruleTestCountRequired": "测试次数100/500/1000必需填写",
"addSuccess": "新增成功",
"editSuccess": "修改成功"
},
"detail": {
"title": "测试记录详情",
"sectionBasic": "基本信息",
"recordId": "记录ID",
"testCount": "测试次数",
"testCountSuffix": "次",
"createTime": "创建时间",
"admin": "执行管理员",
"paidPoolId": "付费奖池配置ID",
"freePoolId": "免费奖池配置ID",
"bigwinSnapshot": "BIGWIN 权重快照",
"sectionPaidTier": "付费抽奖档位概率T1-T5测试时使用",
"sectionFreeTier": "免费抽奖档位概率T1-T5测试时使用",
"colTier": "档位",
"colWeight": "权重",
"colPercent": "占比",
"emptyPaidTier": "暂无付费档位数据(旧记录可能仅保存 tier_weights_snapshot",
"emptyFreeTier": "暂无免费档位数据",
"sectionSnapshot": "权重配比快照(测试时使用的 T1-T5/BIGWIN 配置)",
"subCw": "顺时针(非 BIGWIN",
"subCcw": "逆时针(非 BIGWIN",
"colGridNumber": "色子点数",
"emptyCw": "暂无顺时针数据",
"emptyCcw": "暂无逆时针数据",
"subBigwin": "BIGWIN按 DiceRewardConfig 配置快照)",
"emptyBigwinTable": "暂无 BIGWIN 数据",
"sectionResult": "落点统计(各 grid_number 出现次数)",
"chartXAxis": "色子点数 (grid_number)",
"emptyResult": "暂无落点数据",
"resultTotal": "总落点次数:{n}",
"btnImport": "导入到当前配置",
"importTitle": "导入到正式配置",
"importDesc": "将本测试记录导入DiceReward格子权重、DiceRewardConfigBIGWIN weight、DiceLotteryPoolConfig付费/免费 T1-T5 档位概率)。请选择要写入的奖池。",
"importPaidLabel": "导入付费档位概率到奖池",
"importPaidPlaceholder": "选择任意奖池(建议付费池)",
"importPaidTip": "不选则使用本记录保存时的付费奖池配置 ID",
"importFreeLabel": "导入免费档位概率到奖池",
"importFreePlaceholder": "选择任意奖池(建议免费池)",
"importFreeTip": "不选则使用本记录保存时的免费奖池配置 ID",
"btnConfirmImport": "确认导入",
"importSuccess": "导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置",
"importFail": "导入失败",
"dash": "—",
"dirCw": "顺时针",
"dirCcw": "逆时针"
}
}

View File

@@ -7,6 +7,9 @@
<!-- 表格头部 -->
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
<template #left>
<span v-if="totalWinCoin !== null" class="table-summary-inline">
{{ $t('page.toolbar.platformTotalProfit') }}<strong>{{ totalWinCoin }}</strong>
</span>
<!-- <ElSpace wrap>-->
<!-- <ElButton-->
<!-- v-permission="'dice:play_record:index:save'"-->
@@ -126,6 +129,15 @@
direction: undefined
})
/** 当前筛选下平台总盈利付费抽奖次数×100 - 玩家总收益) */
const totalWinCoin = ref<number | null>(null)
const listApi = async (params: Record<string, any>) => {
const res = await api.list(params)
totalWinCoin.value = (res as any)?.total_win_coin ?? null
return res
}
// 搜索处理
const handleSearch = (params: Record<string, any>) => {
Object.assign(searchParams, params)
@@ -170,7 +182,8 @@
refreshData
} = useTable({
core: {
apiFn: api.list,
apiFn: listApi,
apiParams: { limit: 100 },
columnsFactory: () => [
// { type: 'selection' },
{ prop: 'id', label: 'page.table.id', width: 80 },
@@ -219,3 +232,15 @@
// selectedRows
} = useSaiAdmin()
</script>
<style scoped>
.table-summary-inline {
margin-right: 12px;
font-size: 14px;
color: var(--el-text-color-regular);
white-space: nowrap;
}
.table-summary-inline strong {
color: var(--el-color-danger);
}
</style>

View File

@@ -184,9 +184,12 @@
<script setup lang="ts">
import api from '../../../api/play_record/index'
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
const { t } = useI18n()
interface Props {
modelValue: boolean
dialogType: string
@@ -399,15 +402,15 @@
if (props.dialogType === 'add') {
delete payload.id
await api.save(payload)
ElMessage.success($t('page.form.addSuccess'))
ElMessage.success(t('page.form.addSuccess'))
} else {
await api.update(payload)
ElMessage.success($t('page.form.editSuccess'))
ElMessage.success(t('page.form.editSuccess'))
}
emit('success')
handleClose()
} catch (error: any) {
let msg = $t('page.form.validateFailed')
let msg = t('page.form.validateFailed')
if (error?.message) {
msg = error.message
} else if (typeof error === 'string') {

View File

@@ -171,9 +171,11 @@
<script setup lang="ts">
import api from '../../../api/player/index'
import lotteryConfigApi from '../../../api/lottery_pool_config/index'
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
const { t } = useI18n()
const WEIGHT_FIELDS = ['t1_weight', 't2_weight', 't3_weight', 't4_weight', 't5_weight'] as const
interface Props {
@@ -416,7 +418,7 @@
await formRef.value.validate()
const useCustomWeights = isLotteryConfigEmpty()
if (useCustomWeights && Math.abs(weightsSum.value - 100) > 0.01) {
ElMessage.warning($t('page.form.ruleWeightsSumMustBe100'))
ElMessage.warning(t('page.form.ruleWeightsSumMustBe100'))
return
}
const payload = { ...formData }
@@ -428,10 +430,10 @@
}
if (props.dialogType === 'add') {
await api.save(payload)
ElMessage.success($t('page.form.addSuccess'))
ElMessage.success(t('page.form.addSuccess'))
} else {
await api.update(payload)
ElMessage.success($t('page.form.editSuccess'))
ElMessage.success(t('page.form.editSuccess'))
}
emit('success')
handleClose()

View File

@@ -122,6 +122,7 @@
} = useTable({
core: {
apiFn: api.list,
apiParams: { limit: 100 },
columnsFactory: () => {
const usernameFormatter = (row: Record<string, any>) =>
row?.dicePlayer?.username ?? row?.player_id ?? '-'

View File

@@ -81,9 +81,12 @@
<script setup lang="ts">
import api from '../../../api/player_ticket_record/index'
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
const { t } = useI18n()
interface Props {
modelValue: boolean
dialogType: string
@@ -230,10 +233,10 @@
const rest = { ...formData } as Record<string, unknown>
delete rest.id
await api.save(rest)
ElMessage.success($t('page.form.addSuccess'))
ElMessage.success(t('page.form.addSuccess'))
} else {
await api.update(formData)
ElMessage.success($t('page.form.editSuccess'))
ElMessage.success(t('page.form.editSuccess'))
}
emit('success')
handleClose()

View File

@@ -163,6 +163,7 @@
} = useTable({
core: {
apiFn: api.list,
apiParams: { limit: 100 },
columnsFactory: () => [
{ type: 'selection', align: 'center' },
{ prop: 'id', label: 'page.table.id', width: 80, align: 'center' },

View File

@@ -90,9 +90,12 @@
<script setup lang="ts">
import api from '../../../api/player_wallet_record/index'
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
const { t } = useI18n()
interface Props {
modelValue: boolean
dialogType: string
@@ -225,10 +228,10 @@
const payload = { ...formData }
if (props.dialogType === 'add') {
await api.save(payload)
ElMessage.success($t('page.form.addSuccess'))
ElMessage.success(t('page.form.addSuccess'))
} else {
await api.update(payload)
ElMessage.success($t('page.form.editSuccess'))
ElMessage.success(t('page.form.editSuccess'))
}
emit('success')
handleClose()

View File

@@ -15,7 +15,7 @@
<el-option label="T3" value="T3" />
<el-option label="T4" value="T4" />
<el-option label="T5" value="T5" />
<el-option label="BIGWIN" value="BIGWIN" />
<el-option :label="$t('page.search.optionBigwin')" value="BIGWIN" />
</el-select>
</el-form-item>
</el-col>

View File

@@ -1,32 +1,30 @@
<template>
<el-dialog
v-model="visible"
title="奖励对照表dice_reward权重配比"
:title="$t('page.weightEdit.title')"
width="900px"
align-center
:close-on-click-modal="false"
@close="handleClose"
>
<div class="global-tip">
编辑的是<strong>奖励对照表dice_reward / DiceReward 模型</strong
>的权重<strong>结束索引end_index</strong>区分
<strong>顺时针</strong><strong>逆时针</strong>两套权重抽奖时按当前方向取对应权重
{{ $t('page.weightEdit.globalTip') }}
</div>
<div v-loading="loading" class="dialog-body">
<el-tabs v-model="activeTier" type="card">
<el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div>
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
<template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<div class="chart-row">
<ArtBarChart
x-axis-name="结束索引"
:x-axis-name="$t('page.weightShared.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'clockwise')"
height="180px"
/>
<ArtBarChart
x-axis-name="结束索引"
:x-axis-name="$t('page.weightShared.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'counterclockwise')"
height="180px"
@@ -34,42 +32,50 @@
</div>
</div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计顺时针<strong>{{ getTierSum(t, 'clockwise') }}</strong>
逆时针<strong>{{ getTierSum(t, 'counterclockwise') }}</strong>
各条 1-10000和不限制
{{
$t('page.weightShared.sumLineDual', {
cw: getTierSum(t, 'clockwise'),
ccw: getTierSum(t, 'counterclockwise')
})
}}
</div>
<div class="weight-sum weight-sum-t4t5" v-else>T4T5 仅单一结果无需配置权重</div>
<div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column
label="结束索引(id)"
:label="$t('page.weightShared.colEndIndexId')"
prop="id"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column label="色子点数" prop="grid_number" width="80" align="center" />
<el-table-column
label="实际中奖金额"
:label="$t('page.weightShared.colDicePoints')"
prop="grid_number"
width="80"
align="center"
/>
<el-table-column
:label="$t('page.weightShared.colRealEv')"
prop="real_ev"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="显示文本"
:label="$t('page.weightShared.colUiText')"
prop="ui_text"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="备注"
:label="$t('page.weightShared.colRemark')"
prop="remark"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column label="顺时针权重(direction=0)" min-width="160" align="center">
<el-table-column :label="$t('page.weightShared.colWeightCwDir')" min-width="160" align="center">
<template #default="{ row }">
<div class="weight-cell-vertical">
<div class="weight-slider-wrap">
@@ -146,7 +152,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="逆时针权重(direction=1)" min-width="160" align="center">
<el-table-column :label="$t('page.weightShared.colWeightCcwDir')" min-width="160" align="center">
<template #default="{ row }">
<div class="weight-cell-vertical">
<div class="weight-slider-wrap">
@@ -232,8 +238,10 @@
</el-tabs>
</div>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交</el-button>
<el-button @click="handleClose">{{ $t('page.weightShared.btnCancel') }}</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">{{
$t('page.weightShared.btnSubmit')
}}</el-button>
</template>
</el-dialog>
</template>
@@ -242,6 +250,9 @@
import api from '../../../api/reward/index'
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
/** 供模板 v-for 使用 */
@@ -430,7 +441,7 @@
grouped.value = parsePayload(res)
})
.catch(() => {
ElMessage.error('获取权重数据失败')
ElMessage.error(t('page.weightShared.fetchFail'))
})
.finally(() => {
loading.value = false
@@ -456,19 +467,19 @@
function handleSubmit() {
const items = collectItems()
if (items.length === 0) {
ElMessage.info('没有可提交的配置')
ElMessage.info(t('page.weightShared.nothingToSubmit'))
return
}
submitting.value = true
api
.batchUpdateWeights(items)
.then(() => {
ElMessage.success('保存成功')
ElMessage.success(t('page.weightShared.saveSuccess'))
emit('success')
handleClose()
})
.catch((e: { message?: string }) => {
ElMessage.error(e?.message ?? '保存失败')
ElMessage.error(e?.message ?? t('page.weightShared.submitFail'))
})
.finally(() => {
submitting.value = false

View File

@@ -1,78 +1,76 @@
<template>
<el-dialog
v-model="visible"
title="权重配比"
:title="$t('page.weightRatio.title')"
width="900px"
align-center
:close-on-click-modal="false"
@close="handleClose"
>
<div class="global-tip">
配置<strong>奖励对照表dice_reward</strong>的权重一级按<strong>方向</strong>顺时针/逆时针二级按<strong>档位</strong>T1-T5各条权重
1-10000档位内按权重比抽取
{{ $t('page.weightRatio.globalTip') }}
</div>
<div v-loading="loading" class="dialog-body">
<!-- 一级方向懒加载避免逆时针柱状图在隐藏容器内初始化导致不显示二级档位 -->
<el-tabs v-model="activeDirection" type="card" class="direction-tabs" :lazy="true">
<el-tab-pane label="顺时针" name="0">
<el-tab-pane :label="$t('page.weightRatio.tabClockwise')" name="0">
<el-tabs v-model="activeTier" type="card" class="tier-tabs">
<el-tab-pane v-for="t in tierKeys" :key="'cw-' + t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div>
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
<template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<ArtBarChart
:key="'cw-' + activeDirection + '-' + t"
x-axis-name="点数"
:x-axis-name="$t('page.weightShared.xAxisGridNumber')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartDataForCurrentDirection(t)"
height="180px"
/>
</div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计<strong>{{ getTierSumForCurrentDirection(t) }}</strong>
各条 1-10000档位内按权重比抽取和不限制
{{
$t('page.weightShared.sumLineSingle', { sum: getTierSumForCurrentDirection(t) })
}}
</div>
<div class="weight-sum weight-sum-t4t5" v-else
>T4T5 仅单一结果无需配置权重</div
>
<div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column
label="点数(grid_number)"
:label="$t('page.weightShared.colGridNumber')"
prop="grid_number"
width="110"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="结束索引(id)"
:label="$t('page.weightShared.colEndIndexId')"
prop="id"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="实际中奖金额"
:label="$t('page.weightShared.colRealEv')"
prop="real_ev"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="显示文本"
:label="$t('page.weightShared.colUiText')"
prop="ui_text"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="备注"
:label="$t('page.weightShared.colRemark')"
prop="remark"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column
:label="currentDirectionLabel + ' 权重(1-10000)'"
:label="currentWeightColumnLabel"
min-width="200"
align="center"
>
@@ -156,65 +154,64 @@
</el-tab-pane>
</el-tabs>
</el-tab-pane>
<el-tab-pane label="逆时针" name="1">
<el-tab-pane :label="$t('page.weightRatio.tabCounterclockwise')" name="1">
<el-tabs v-model="activeTier" type="card" class="tier-tabs">
<el-tab-pane v-for="t in tierKeys" :key="'ccw-' + t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip">该档位暂无配置数据</div>
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightShared.emptyTier') }}</div>
<template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<ArtBarChart
:key="'ccw-' + activeDirection + '-' + t"
x-axis-name="点数"
:x-axis-name="$t('page.weightShared.xAxisGridNumber')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartDataForCurrentDirection(t)"
height="180px"
/>
</div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计:<strong>{{ getTierSumForCurrentDirection(t) }}</strong>
(各条 1-10000档位内按权重比抽取和不限制
{{
$t('page.weightShared.sumLineSingle', { sum: getTierSumForCurrentDirection(t) })
}}
</div>
<div class="weight-sum weight-sum-t4t5" v-else
>T4、T5 仅单一结果,无需配置权重。</div
>
<div class="weight-sum weight-sum-t4t5" v-else>{{ $t('page.weightShared.t4t5NoteSingle') }}</div>
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column
label="点数(grid_number)"
:label="$t('page.weightShared.colGridNumber')"
prop="grid_number"
width="110"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="结束索引(id)"
:label="$t('page.weightShared.colEndIndexId')"
prop="id"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="实际中奖金额"
:label="$t('page.weightShared.colRealEv')"
prop="real_ev"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="显示文本"
:label="$t('page.weightShared.colUiText')"
prop="ui_text"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="备注"
:label="$t('page.weightShared.colRemark')"
prop="remark"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column
:label="currentDirectionLabel + ' 权重(1-10000)'"
:label="currentWeightColumnLabel"
min-width="200"
align="center"
>
@@ -301,13 +298,14 @@
</el-tabs>
</div>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button @click="handleClose">{{ $t('page.weightShared.btnCancel') }}</el-button>
<el-button
v-permission="'dice:reward:index:batchUpdateWeights'"
type="primary"
:loading="submitting"
@click="handleSubmit"
>提交</el-button>
>{{ $t('page.weightShared.btnSubmit') }}</el-button
>
</template>
</el-dialog>
</template>
@@ -316,6 +314,9 @@
import api from '../../../api/reward/index'
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t, locale } = useI18n()
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
type DirectionKey = 'clockwise' | 'counterclockwise'
@@ -366,9 +367,14 @@
T5: { '0': [], '1': [] }
})
const currentDirectionLabel = computed(() =>
activeDirection.value === '0' ? '顺时针' : '逆时针'
)
const currentWeightColumnLabel = computed(() => {
locale.value
const dirLabel =
activeDirection.value === '0'
? t('page.weightRatio.tabClockwise')
: t('page.weightRatio.tabCounterclockwise')
return `${dirLabel} ${t('page.weightShared.weightColSuffix')}`
})
const tierKeys = TIER_KEYS
@@ -470,7 +476,7 @@
grouped.value = parsePayload(res)
})
.catch(() => {
ElMessage.error('获取权重数据失败')
ElMessage.error(t('page.weightShared.fetchFail'))
})
.finally(() => {
loading.value = false
@@ -499,19 +505,19 @@
function handleSubmit() {
const items = collectItems()
if (items.length === 0) {
ElMessage.info('没有可提交的配置')
ElMessage.info(t('page.weightShared.nothingToSubmit'))
return
}
submitting.value = true
api
.batchUpdateWeights(items)
.then(() => {
ElMessage.success('保存成功')
ElMessage.success(t('page.weightShared.saveSuccess'))
emit('success')
handleClose()
})
.catch((e: { message?: string }) => {
ElMessage.error(e?.message ?? '保存失败')
ElMessage.error(e?.message ?? t('page.weightShared.submitFail'))
})
.finally(() => {
submitting.value = false

View File

@@ -1,33 +1,31 @@
<template>
<ElDialog
v-model="visible"
title="一键测试权重"
:title="$t('page.weightTest.title')"
width="560px"
:close-on-click-modal="false"
destroy-on-close
@close="onClose"
>
<ElAlert
type="info"
:closable="false"
show-icon
class="weight-test-tip"
>
<template #title>彩金池逻辑说明</template>
playStart 抽奖逻辑一致使用 name=default 的安全线杀分开关盈利未达安全线时付费抽奖券使用玩家自身权重下方自定义档位免费抽奖券使用 killScore 配置盈利达到安全线且杀分开启时付费/免费均使用 killScore 配置
<ElAlert type="info" :closable="false" show-icon class="weight-test-tip">
<template #title>{{ $t('page.weightTest.alertTitle') }}</template>
{{ $t('page.weightTest.alertBody') }}
</ElAlert>
<ElForm ref="formRef" :model="form" label-width="140px">
<ElSteps :active="currentStep" finish-status="success" simple class="steps-wrap">
<ElStep title="付费抽奖券" />
<ElStep title="免费抽奖券" />
<ElStep :title="$t('page.weightTest.stepPaid')" />
<ElStep :title="$t('page.weightTest.stepFree')" />
</ElSteps>
<!-- 第一页付费抽奖券 -->
<div v-show="currentStep === 0" class="step-panel">
<ElFormItem label="测试数据档位类型" prop="paid_lottery_config_id">
<ElFormItem
:label="$t('page.weightTest.labelLotteryTypePaid')"
prop="paid_lottery_config_id"
>
<ElSelect
v-model="form.paid_lottery_config_id"
placeholder="不选则下方自定义档位概率(默认 default"
:placeholder="$t('page.weightTest.placeholderPaidPool')"
clearable
filterable
style="width: 100%"
@@ -41,11 +39,13 @@
</ElSelect>
</ElFormItem>
<template v-if="form.paid_lottery_config_id == null">
<div class="tier-label">自定义档位概率T1T5每档 0-100%五档之和不能超过 100%</div>
<div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
<ElRow :gutter="12" class="tier-row">
<ElCol v-for="t in tierKeys" :key="'paid-' + t" :span="8">
<div class="tier-field">
<label class="tier-field-label">档位 {{ t }}%</label>
<label class="tier-field-label">{{
$t('page.weightTest.tierFieldLabel', { tier: t })
}}</label>
<input
type="number"
:value="getPaidTier(t)"
@@ -58,17 +58,25 @@
</div>
</ElCol>
</ElRow>
<div v-if="paidTierSum > 100" class="tier-error"
>当前五档之和为 {{ paidTierSum }}%不能超过 100%</div
>
<div v-if="paidTierSum > 100" class="tier-error">{{
$t('page.weightTest.tierSumError', { sum: paidTierSum })
}}</div>
</template>
<ElFormItem label="顺时针次数" prop="paid_s_count" required>
<ElSelect v-model="form.paid_s_count" placeholder="请选择" style="width: 100%">
<ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="paid_s_count" required>
<ElSelect
v-model="form.paid_s_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect>
</ElFormItem>
<ElFormItem label="逆时针次数" prop="paid_n_count" required>
<ElSelect v-model="form.paid_n_count" placeholder="请选择" style="width: 100%">
<ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="paid_n_count" required>
<ElSelect
v-model="form.paid_n_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect>
</ElFormItem>
@@ -76,10 +84,13 @@
<!-- 第二页免费抽奖券 -->
<div v-show="currentStep === 1" class="step-panel">
<ElFormItem label="测试数据档位类型" prop="free_lottery_config_id">
<ElFormItem
:label="$t('page.weightTest.labelLotteryTypeFree')"
prop="free_lottery_config_id"
>
<ElSelect
v-model="form.free_lottery_config_id"
placeholder="不选则下方自定义档位概率(默认 killScore"
:placeholder="$t('page.weightTest.placeholderFreePool')"
clearable
filterable
style="width: 100%"
@@ -93,11 +104,13 @@
</ElSelect>
</ElFormItem>
<template v-if="form.free_lottery_config_id == null">
<div class="tier-label">自定义档位概率T1T5每档 0-100%五档之和不能超过 100%</div>
<div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
<ElRow :gutter="12" class="tier-row">
<ElCol v-for="t in tierKeys" :key="'free-' + t" :span="8">
<div class="tier-field">
<label class="tier-field-label">档位 {{ t }}%</label>
<label class="tier-field-label">{{
$t('page.weightTest.tierFieldLabel', { tier: t })
}}</label>
<input
type="number"
:value="getFreeTier(t)"
@@ -110,17 +123,25 @@
</div>
</ElCol>
</ElRow>
<div v-if="freeTierSum > 100" class="tier-error"
>当前五档之和为 {{ freeTierSum }}%不能超过 100%</div
>
<div v-if="freeTierSum > 100" class="tier-error">{{
$t('page.weightTest.tierSumError', { sum: freeTierSum })
}}</div>
</template>
<ElFormItem label="顺时针次数" prop="free_s_count" required>
<ElSelect v-model="form.free_s_count" placeholder="请选择" style="width: 100%">
<ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="free_s_count" required>
<ElSelect
v-model="form.free_s_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect>
</ElFormItem>
<ElFormItem label="逆时针次数" prop="free_n_count" required>
<ElSelect v-model="form.free_n_count" placeholder="请选择" style="width: 100%">
<ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="free_n_count" required>
<ElSelect
v-model="form.free_n_count"
:placeholder="$t('page.weightTest.placeholderSelect')"
style="width: 100%"
>
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
</ElSelect>
</ElFormItem>
@@ -128,19 +149,23 @@
</ElForm>
<template #footer>
<ElButton v-if="currentStep > 0" :disabled="running" @click="currentStep--">上一步</ElButton>
<ElButton v-if="currentStep < 1" type="primary" :disabled="running" @click="currentStep++"
>下一步</ElButton
>
<ElButton v-if="currentStep > 0" :disabled="running" @click="currentStep--">{{
$t('page.weightTest.btnPrev')
}}</ElButton>
<ElButton v-if="currentStep < 1" type="primary" :disabled="running" @click="currentStep++">{{
$t('page.weightTest.btnNext')
}}</ElButton>
<ElButton
v-if="currentStep === 1"
v-permission="'dice:reward:index:startWeightTest'"
type="primary"
:loading="running"
@click="handleStart"
>开始测试</ElButton
>{{ $t('page.weightTest.btnStart') }}</ElButton
>
<ElButton :disabled="running" @click="visible = false">取消</ElButton>
<ElButton :disabled="running" @click="visible = false">{{
$t('page.weightTest.btnCancel')
}}</ElButton>
</template>
</ElDialog>
</template>
@@ -148,6 +173,10 @@
<script setup lang="ts">
import api from '../../../api/reward/index'
import lotteryPoolApi from '../../../api/lottery_pool_config/index'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const countOptions = [0, 100, 500, 1000, 5000]
const tierKeys = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
@@ -169,7 +198,9 @@
})
const lotteryOptions = ref<Array<{ id: number; name: string }>>([])
/** 付费抽奖券可选档位name=default */
const paidLotteryOptions = computed(() => lotteryOptions.value.filter((r) => r.name === 'default'))
const paidLotteryOptions = computed(() =>
lotteryOptions.value.filter((r) => r.name === 'default')
)
/** 免费抽奖券可选档位:优先 name=killScore若无则显示全部以便下拉有选项 */
const freeLotteryOptions = computed(() => {
const list = lotteryOptions.value.filter((r) => r.name === 'killScore')
@@ -216,7 +247,10 @@
async function loadLotteryOptions() {
try {
const list = await lotteryPoolApi.getOptions()
lotteryOptions.value = list.map((r: { id: number; name: string }) => ({ id: r.id, name: r.name }))
lotteryOptions.value = list.map((r: { id: number; name: string }) => ({
id: r.id,
name: r.name
}))
// 付费抽奖券默认使用 name=default
const normal = list.find((r: { name?: string }) => r.name === 'default')
if (normal) {
@@ -229,7 +263,7 @@
} else if (list.length > 0) {
form.free_lottery_config_id = list[0].id
}
} catch (_) {
} catch {
lotteryOptions.value = []
}
}
@@ -256,7 +290,7 @@
function validateForm(): boolean {
if (form.paid_s_count + form.paid_n_count + form.free_s_count + form.free_n_count <= 0) {
ElMessage.warning('付费或免费至少一种方向次数之和大于 0')
ElMessage.warning(t('page.weightTest.warnTotalSpins'))
return false
}
const needPaidTier = form.paid_lottery_config_id == null
@@ -264,22 +298,22 @@
if (needPaidTier) {
const sum = paidTierSum.value
if (sum <= 0) {
ElMessage.warning('付费未选奖池时T1T5 档位概率之和需大于 0')
ElMessage.warning(t('page.weightTest.warnPaidTierSumPositive'))
return false
}
if (sum > 100) {
ElMessage.warning('付费档位概率 T1T5 之和不能超过 100%')
ElMessage.warning(t('page.weightTest.warnPaidTierSumMax'))
return false
}
}
if (needFreeTier) {
const sum = freeTierSum.value
if (sum <= 0) {
ElMessage.warning('免费未选奖池时T1T5 档位概率之和需大于 0')
ElMessage.warning(t('page.weightTest.warnFreeTierSumPositive'))
return false
}
if (sum > 100) {
ElMessage.warning('免费档位概率 T1T5 之和不能超过 100%')
ElMessage.warning(t('page.weightTest.warnFreeTierSumMax'))
return false
}
}
@@ -291,13 +325,11 @@
running.value = true
try {
await api.startWeightTest(buildPayload())
ElMessage.success(
'测试任务已创建,后台将自动执行。请在【玩家抽奖记录(测试数据)】中查看生成的测试数据'
)
ElMessage.success(t('page.weightTest.successCreated'))
visible.value = false
emit('success')
} catch (e: any) {
ElMessage.error(e?.message || '创建测试任务失败')
ElMessage.error(e?.message || t('page.weightTest.failCreate'))
} finally {
running.value = false
}

View File

@@ -10,7 +10,7 @@
:loading="createRewardLoading"
@click="handleCreateRewardReference"
v-ripple
title="按规则start_index=config(grid_number).id顺时针 end_index=(start_index+grid_number)%26逆时针 end_index=start_index-grid_number≥0?start_index-grid_number:26+start_index-grid_number"
:title="$t('page.toolbar.createRewardRefTitle')"
>
{{ $t('page.toolbar.createRewardRef') }}
</ElButton>
@@ -18,9 +18,9 @@
</template>
<ElTabs v-model="activeTab" type="card" class="top-tabs">
<ElTabPane label="奖励索引" name="index">
<ElTabPane :label="$t('page.configPage.tabIndex')" name="index">
<div class="tab-panel">
<div class="panel-tip">色子点数须在 530 之间且本表内不重复</div>
<div class="panel-tip">{{ $t('page.configPage.tipIndex') }}</div>
<div class="table-scroll-wrap">
<ElTable
v-loading="loading"
@@ -29,12 +29,12 @@
size="default"
class="config-table"
>
<ElTableColumn label="索引(id)" prop="id" width="60" align="center">
<ElTableColumn :label="$t('page.configPage.colId')" prop="id" width="60" align="center">
<template #default="{ row }">
<span>{{ row.id }}</span>
</template>
</ElTableColumn>
<ElTableColumn label="色子点数" min-width="100" align="center">
<ElTableColumn :label="$t('page.configPage.colDicePoints')" min-width="100" align="center">
<template #default="{ row }">
<ElInputNumber
v-model="row.grid_number"
@@ -46,17 +46,25 @@
/>
</template>
</ElTableColumn>
<ElTableColumn label="显示文本" min-width="100" align="center">
<ElTableColumn :label="$t('page.configPage.colDisplayText')" min-width="100" align="center">
<template #default="{ row }">
<ElInput v-model="row.ui_text" size="small" placeholder="显示文本(中文)" />
<ElInput
v-model="row.ui_text"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayZh')"
/>
</template>
</ElTableColumn>
<ElTableColumn label="显示文本(英文)" min-width="120" align="center">
<ElTableColumn :label="$t('page.configPage.colDisplayTextEn')" min-width="120" align="center">
<template #default="{ row }">
<ElInput v-model="row.ui_text_en" size="small" placeholder="显示文本(英文)" />
<ElInput
v-model="row.ui_text_en"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayEn')"
/>
</template>
</ElTableColumn>
<ElTableColumn label="真实结算" min-width="110" align="center">
<ElTableColumn :label="$t('page.configPage.colRealEv')" min-width="110" align="center">
<template #default="{ row }">
<ElInputNumber
v-model="row.real_ev"
@@ -66,11 +74,11 @@
/>
</template>
</ElTableColumn>
<ElTableColumn label="所属档位" width="100" align="center">
<ElTableColumn :label="$t('page.configPage.colTier')" width="100" align="center">
<template #default="{ row }">
<ElSelect
v-model="row.tier"
placeholder="档位"
:placeholder="$t('page.configPage.placeholderTierSelect')"
clearable
size="small"
class="full-width"
@@ -83,9 +91,13 @@
</ElSelect>
</template>
</ElTableColumn>
<ElTableColumn label="备注" min-width="140" align="center">
<ElTableColumn :label="$t('page.configPage.colRemark')" min-width="140" align="center">
<template #default="{ row }">
<ElInput v-model="row.remark" size="small" placeholder="备注" />
<ElInput
v-model="row.remark"
size="small"
:placeholder="$t('page.configPage.placeholderRemark')"
/>
</template>
</ElTableColumn>
</ElTable>
@@ -96,18 +108,15 @@
type="primary"
:loading="savingIndex"
@click="handleSaveIndex"
>保存</ElButton
>{{ $t('page.configPage.btnSave') }}</ElButton
>
<ElButton @click="handleResetIndex">重置</ElButton>
<ElButton @click="handleResetIndex">{{ $t('page.configPage.btnReset') }}</ElButton>
</div>
</div>
</ElTabPane>
<ElTabPane label="大奖权重" name="bigwin">
<ElTabPane :label="$t('page.configPage.tabBigwin')" name="bigwin">
<div class="tab-panel">
<div class="panel-tip"
>从左至右中大奖点数不可改显示信息实际中奖备注权重(0~10000)点数 530
权重固定 100%本表单独立提交仅提交大奖权重</div
>
<div class="panel-tip">{{ $t('page.configPage.tipBigwin') }}</div>
<div class="table-scroll-wrap">
<ElTable
v-loading="loading"
@@ -116,22 +125,30 @@
size="default"
class="config-table bigwin-table"
>
<ElTableColumn label="中大奖点数" width="100" align="center">
<ElTableColumn :label="$t('page.configPage.colBigwinPoints')" width="100" align="center">
<template #default="{ row }">
<span class="readonly-value">{{ row.grid_number }}</span>
</template>
</ElTableColumn>
<ElTableColumn label="显示信息" min-width="140" align="center">
<ElTableColumn :label="$t('page.configPage.colDisplayInfo')" min-width="140" align="center">
<template #default="{ row }">
<ElInput v-model="row.ui_text" size="small" placeholder="显示信息(中文)" />
<ElInput
v-model="row.ui_text"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayInfoZh')"
/>
</template>
</ElTableColumn>
<ElTableColumn label="显示信息(英文)" min-width="160" align="center">
<ElTableColumn :label="$t('page.configPage.colDisplayInfoEn')" min-width="160" align="center">
<template #default="{ row }">
<ElInput v-model="row.ui_text_en" size="small" placeholder="显示信息(英文)" />
<ElInput
v-model="row.ui_text_en"
size="small"
:placeholder="$t('page.configPage.placeholderDisplayInfoEn')"
/>
</template>
</ElTableColumn>
<ElTableColumn label="实际中奖" min-width="120" align="center">
<ElTableColumn :label="$t('page.configPage.colRealPrize')" min-width="120" align="center">
<template #default="{ row }">
<ElInputNumber
v-model="row.real_ev"
@@ -141,12 +158,16 @@
/>
</template>
</ElTableColumn>
<ElTableColumn label="备注" min-width="140" align="center">
<ElTableColumn :label="$t('page.configPage.colRemark')" min-width="140" align="center">
<template #default="{ row }">
<ElInput v-model="row.remark" size="small" placeholder="备注" />
<ElInput
v-model="row.remark"
size="small"
:placeholder="$t('page.configPage.placeholderRemark')"
/>
</template>
</ElTableColumn>
<ElTableColumn label="权重(0-10000)" min-width="220" align="center">
<ElTableColumn :label="$t('page.configPage.colWeightRange')" min-width="220" align="center">
<template #default="{ row }">
<div class="weight-cell">
<ElSlider
@@ -167,15 +188,15 @@
class="weight-input"
/>
</div>
<span v-if="isBigwinWeightDisabled(row)" class="weight-tip"
>点数 530 固定 100%</span
>
<span v-if="isBigwinWeightDisabled(row)" class="weight-tip">{{
$t('page.configPage.weightFixedTip')
}}</span>
</template>
</ElTableColumn>
</ElTable>
</div>
<div v-if="bigwinRows.length === 0 && !loading" class="empty-tip">
暂无 BIGWIN 档位配置请在奖励索引中设置 tier BIGWIN
{{ $t('page.configPage.emptyBigwin') }}
</div>
<div class="tab-footer">
<ElButton
@@ -183,9 +204,9 @@
type="primary"
:loading="savingBigwin"
@click="handleSaveBigwin"
>保存</ElButton
>{{ $t('page.configPage.btnSave') }}</ElButton
>
<ElButton @click="handleResetBigwin">重置</ElButton>
<ElButton @click="handleResetBigwin">{{ $t('page.configPage.btnReset') }}</ElButton>
</div>
</div>
</ElTabPane>
@@ -196,8 +217,11 @@
<script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus'
import { useI18n } from 'vue-i18n'
import api from '../../api/reward_config/index'
const { t } = useI18n()
/** 第一页:奖励索引行(来自 DiceRewardConfig 表) */
interface IndexRow {
id: number
@@ -247,11 +271,11 @@
async function handleCreateRewardReference() {
try {
await ElMessageBox.confirm(
'按规则创建奖励对照:起始索引 start_index=奖励配置中 grid_number 对应格位的 id顺时针 end_index=(start_index+摇取点数)%26逆时针 end_index=start_index-摇取点数≥0 则取该值,否则 26+start_index-摇取点数。先清空现有数据再为 5-30 共 26 个点数、顺/逆时针分别生成。是否继续?',
'创建奖励对照',
t('page.configPage.confirmCreateRefMsg'),
t('page.configPage.confirmCreateRefTitle'),
{
confirmButtonText: '确定创建',
cancelButtonText: '取消',
confirmButtonText: t('page.configPage.confirmCreateRefOk'),
cancelButtonText: t('page.configPage.confirmCreateRefCancel'),
type: 'warning'
}
)
@@ -262,14 +286,23 @@
try {
const res: any = await api.createRewardReference()
const data = res?.data ?? res
const msg =
typeof data === 'object' && data !== null
? `已按 5-30 共26个点数、顺时针+逆时针创建:顺时针新增 ${data.created_clockwise ?? 0} 条、逆时针新增 ${data.created_counterclockwise ?? 0} 条;顺时针更新 ${data.updated_clockwise ?? 0} 条、逆时针更新 ${data.updated_counterclockwise ?? 0}${(data.skipped ?? 0) > 0 ? `${data.skipped} 个点数使用兜底起始索引` : ''}`
: '创建成功'
let msg = t('page.configPage.createRefSuccessSimple')
if (typeof data === 'object' && data !== null) {
const skipped = Number(data.skipped ?? 0)
const skippedPart =
skipped > 0 ? t('page.configPage.createRefSuccessSkipped', { n: skipped }) : ''
msg = t('page.configPage.createRefSuccess', {
cwNew: data.created_clockwise ?? 0,
ccwNew: data.created_counterclockwise ?? 0,
cwUp: data.updated_clockwise ?? 0,
ccwUp: data.updated_counterclockwise ?? 0,
skippedPart
})
}
ElMessage.success(msg)
loadIndexList()
} catch (e: any) {
ElMessage.error(e?.message ?? '创建奖励对照失败')
ElMessage.error(e?.message ?? t('page.configPage.createRefFail'))
} finally {
createRewardLoading.value = false
}
@@ -288,7 +321,7 @@
indexRowsSnapshot = rows.map((r) => ({ ...r }))
})
.catch(() => {
ElMessage.error('获取奖励索引配置失败')
ElMessage.error(t('page.configPage.loadIndexFail'))
})
.finally(() => {
loading.value = false
@@ -319,18 +352,20 @@
function validateIndexFormForSave(): string | null {
const toSave = indexRows.value.filter((r) => r.tier !== 'BIGWIN')
if (toSave.length === 0) {
return '暂无奖励索引数据可保存'
return t('page.configPage.warnNoIndexToSave')
}
const nums = toSave.map((r) => Number(r.grid_number))
const outOfRange = nums.filter(
(n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX
)
if (outOfRange.length > 0) {
return `色子点数必须在 ${GRID_NUMBER_MIN}${GRID_NUMBER_MAX} 之间`
return t('page.configPage.warnGridRange', { min: GRID_NUMBER_MIN, max: GRID_NUMBER_MAX })
}
const duplicates = findDuplicateValues(nums)
if (duplicates.length > 0) {
return `色子点数在本表内不能重复,重复的点数为:${duplicates.join('、')}`
return t('page.configPage.warnDupGrid', {
list: duplicates.join(t('page.configPage.dupJoiner'))
})
}
return null
}
@@ -355,10 +390,10 @@
remark: r.remark
}))
await api.batchUpdate(indexPayload)
ElMessage.success('保存成功')
ElMessage.success(t('page.configPage.saveSuccess'))
indexRowsSnapshot = indexRows.value.map((r) => ({ ...r }))
} catch (e: any) {
ElMessage.error(e?.message ?? '保存失败')
ElMessage.error(e?.message ?? t('page.configPage.saveFail'))
} finally {
savingIndex.value = false
}
@@ -367,25 +402,27 @@
/** 奖励索引页:重置为本页数据(重新拉取列表) */
function handleResetIndex() {
loadIndexList()
ElMessage.info('已重新加载奖励索引,恢复为服务器最新数据')
ElMessage.info(t('page.configPage.resetIndexReloaded'))
}
/** 大奖权重表单校验:点数在本表内不重复 */
function validateBigwinFormForSave(): string | null {
const rows = bigwinRows.value
if (rows.length === 0) {
return '暂无 BIGWIN 档位配置可保存'
return t('page.configPage.warnNoBigwinToSave')
}
const nums = rows.map((r) => Number(r.grid_number))
const outOfRange = nums.filter(
(n) => Number.isNaN(n) || n < GRID_NUMBER_MIN || n > GRID_NUMBER_MAX
)
if (outOfRange.length > 0) {
return `色子点数必须在 ${GRID_NUMBER_MIN}${GRID_NUMBER_MAX} 之间`
return t('page.configPage.warnGridRange', { min: GRID_NUMBER_MIN, max: GRID_NUMBER_MAX })
}
const duplicates = findDuplicateValues(nums)
if (duplicates.length > 0) {
return `大奖权重本表内点数不能重复,重复的点数为:${duplicates.join('、')}`
return t('page.configPage.warnBigwinDupGrid', {
list: duplicates.join(t('page.configPage.dupJoiner'))
})
}
return null
}
@@ -394,7 +431,7 @@
async function handleSaveBigwin() {
const rows = bigwinRows.value
if (rows.length === 0) {
ElMessage.info('暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN')
ElMessage.info(t('page.configPage.infoNoBigwin'))
return
}
const err = validateBigwinFormForSave()
@@ -421,10 +458,10 @@
: Math.max(0, Math.min(10000, Math.floor(r.weight)))
}))
await api.saveBigwinWeightsByGrid(weightItems)
ElMessage.success('保存成功')
ElMessage.success(t('page.configPage.saveSuccess'))
loadIndexList()
} catch (e: any) {
ElMessage.error(e?.message ?? '保存失败')
ElMessage.error(e?.message ?? t('page.configPage.saveFail'))
} finally {
savingBigwin.value = false
}
@@ -433,7 +470,7 @@
/** 大奖权重页重置重新拉取列表BIGWIN 数据随之更新) */
function handleResetBigwin() {
loadIndexList()
ElMessage.info('已重新加载,大奖权重恢复为服务器最新数据')
ElMessage.info(t('page.configPage.resetBigwinReloaded'))
}
onMounted(() => {

View File

@@ -113,7 +113,7 @@
/**
* 表单验证规则(权重已迁移至权重配比弹窗)
*/
const rules = reactive<FormRules>({
const rules = computed<FormRules>(() => ({
grid_number: [{ required: true, message: t('page.form.ruleDicePointsRequired'), trigger: 'blur' }],
ui_text: [{ required: true, message: t('page.form.ruleUiTextRequired'), trigger: 'blur' }],
ui_text_en: [{ max: 255, message: t('page.form.ruleUiTextEnMax'), trigger: 'blur' }],
@@ -122,7 +122,7 @@
weight: [
{ type: 'number', min: 0, max: 10000, message: t('page.form.ruleBigWinWeightRange'), trigger: 'blur' }
]
})
}))
/** 点数 5、30 固定 100% 中大奖,权重不可改 */
const isBigwinWeightDisabled = computed(

View File

@@ -1,29 +1,29 @@
<template>
<el-dialog
v-model="visible"
title="T1-T5 权重配比(顺时针/逆时针)"
:title="$t('page.weightRatio.title')"
width="900px"
align-center
:close-on-click-modal="false"
@close="handleClose"
>
<div class="global-tip">
权重来自<strong>奖励对照表dice_reward</strong><strong>结束索引DiceRewardConfig.id</strong>区分<strong>顺时针</strong><strong>逆时针</strong>两套权重抽奖时按当前方向取对应权重
{{ $t('page.weightRatio.globalTip') }}
</div>
<el-tabs v-model="activeTier" type="card">
<el-tab-pane v-for="t in tierKeys" :key="t" :label="t" :name="t">
<div v-if="getTierItems(t).length === 0" class="empty-tip"> 该档位暂无配置数据 </div>
<div v-if="getTierItems(t).length === 0" class="empty-tip">{{ $t('page.weightRatio.emptyTier') }}</div>
<template v-else>
<div class="chart-wrap" v-if="t !== 'T4' && t !== 'T5'">
<div class="chart-row">
<ArtBarChart
x-axis-name="结束索引"
:x-axis-name="$t('page.weightRatio.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'clockwise')"
height="180px"
/>
<ArtBarChart
x-axis-name="结束索引"
:x-axis-name="$t('page.weightRatio.xAxisEndIndex')"
:x-axis-data="getTierChartLabels(t)"
:data="getTierChartData(t, 'counterclockwise')"
height="180px"
@@ -31,20 +31,41 @@
</div>
</div>
<div class="weight-sum" v-if="t !== 'T4' && t !== 'T5'">
当前档位权重合计顺时针<strong>{{ getTierSumForValidation(t, 'clockwise') }}</strong>
逆时针<strong>{{ getTierSumForValidation(t, 'counterclockwise') }}</strong>
各条 1-10000档位内按权重比抽取和不限制
{{
$t('page.weightRatio.sumLine', {
cw: getTierSumForValidation(t, 'clockwise'),
ccw: getTierSumForValidation(t, 'counterclockwise')
})
}}
</div>
<div class="weight-sum weight-sum-t4t5" v-else>
T4T5 档位抽中时仅有一个结果无需配置权重
{{ $t('page.weightRatio.t4t5Note') }}
</div>
<el-table :data="getTierItems(t)" border size="small" class="weight-table">
<el-table-column label="结束索引(id)" prop="id" width="90" align="center" show-overflow-tooltip />
<el-table-column label="色子点数" prop="grid_number" width="80" align="center" />
<el-table-column label="实际中奖金额" prop="real_ev" width="90" align="center" show-overflow-tooltip />
<el-table-column label="显示文本" prop="ui_text" min-width="70" align="center" show-overflow-tooltip />
<el-table-column label="备注" prop="remark" min-width="70" align="center" show-overflow-tooltip />
<el-table-column label="顺时针权重(1-10000)" min-width="160" align="center">
<el-table-column
:label="$t('page.weightRatio.colEndIndexId')"
prop="id"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column :label="$t('page.weightRatio.colDicePoints')" prop="grid_number" width="80" align="center" />
<el-table-column
:label="$t('page.weightRatio.colRealEv')"
prop="real_ev"
width="90"
align="center"
show-overflow-tooltip
/>
<el-table-column
:label="$t('page.weightRatio.colUiText')"
prop="ui_text"
min-width="70"
align="center"
show-overflow-tooltip
/>
<el-table-column :label="$t('page.table.remark')" prop="remark" min-width="70" align="center" show-overflow-tooltip />
<el-table-column :label="$t('page.weightRatio.colWeightCw')" min-width="160" align="center">
<template #default="{ row }">
<div class="weight-cell-vertical">
<div class="weight-slider-wrap">
@@ -87,7 +108,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="逆时针权重(1-10000)" min-width="160" align="center">
<el-table-column :label="$t('page.weightRatio.colWeightCcw')" min-width="160" align="center">
<template #default="{ row }">
<div class="weight-cell-vertical">
<div class="weight-slider-wrap">
@@ -135,13 +156,14 @@
</el-tab-pane>
</el-tabs>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
<el-button
v-permission="'dice:reward_config:index:batchUpdateWeights'"
type="primary"
:loading="submitting"
@click="handleSubmit"
>提交</el-button>
>{{ $t('table.form.submit') }}</el-button
>
</template>
</el-dialog>
</template>
@@ -150,6 +172,9 @@
import api from '../../../api/reward_config/index'
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
type DirectionKey = 'clockwise' | 'counterclockwise'
@@ -340,7 +365,7 @@
grouped.value = parseWeightRatioPayload(res)
})
.catch(() => {
ElMessage.error('获取权重配比数据失败')
ElMessage.error(t('page.weightRatio.fetchFail'))
})
}
@@ -363,19 +388,19 @@
function handleSubmit() {
const items = collectItems()
if (items.length === 0) {
ElMessage.info('没有可提交的配置')
ElMessage.info(t('page.weightRatio.nothingToSubmit'))
return
}
submitting.value = true
api
.batchUpdateWeights(items)
.then(() => {
ElMessage.success('保存成功')
ElMessage.success(t('page.weightRatio.saveSuccess'))
emit('success')
handleClose()
})
.catch((e: { message?: string }) => {
ElMessage.error(e?.message ?? '保存失败')
ElMessage.error(e?.message ?? t('page.weightRatio.submitFail'))
})
.finally(() => {
submitting.value = false

View File

@@ -42,11 +42,17 @@
</template>
<!-- 付费抽取顺时针逆时针抽取次数兼容旧数据用 s_count/n_count -->
<template #paid_draw="{ row }">
<span> {{ getPaidS(row) }} / {{ getPaidN(row) }}</span>
<span
>{{ $t('page.table.clockwiseAbbr') }} {{ getPaidS(row) }} /
{{ $t('page.table.counterclockwiseAbbr') }} {{ getPaidN(row) }}</span
>
</template>
<!-- 免费抽取顺时针逆时针抽取次数 -->
<template #free_draw="{ row }">
<span> {{ row.free_s_count ?? 0 }} / {{ row.free_n_count ?? 0 }}</span>
<span
>{{ $t('page.table.clockwiseAbbr') }} {{ row.free_s_count ?? 0 }} /
{{ $t('page.table.counterclockwiseAbbr') }} {{ row.free_n_count ?? 0 }}</span
>
</template>
<!-- 平台赚取金额 -->
<template #platform_profit="{ row }">
@@ -127,7 +133,7 @@
if (s === -1) return t('page.table.statusFail')
if (s === 1) return t('page.table.statusDone')
if (s === 0 || s === 2) return t('page.table.statusTesting')
return '—'
return t('page.detail.dash')
}
// 付费抽取次数(兼容旧数据:无 paid_s_count 时用 s_count
@@ -144,9 +150,10 @@
// 平台赚取金额展示(未完成或空显示 —)
function formatPlatformProfit(v: unknown): string {
if (v === null || v === undefined || v === '') return '—'
const dash = t('page.detail.dash')
if (v === null || v === undefined || v === '') return dash
const n = Number(v)
if (Number.isNaN(n)) return '—'
if (Number.isNaN(n)) return dash
return String(n)
}

View File

@@ -1,7 +1,7 @@
<template>
<el-drawer
v-model="visible"
title="测试记录详情"
:title="$t('page.detail.title')"
:size="drawerSize"
direction="rtl"
destroy-on-close
@@ -9,37 +9,39 @@
>
<template v-if="record">
<div class="detail-section">
<div class="section-title">基本信息</div>
<div class="section-title">{{ $t('page.detail.sectionBasic') }}</div>
<el-descriptions :column="2" border size="small">
<el-descriptions-item label="记录ID">
<el-descriptions-item :label="$t('page.detail.recordId')">
{{ record.id }}
</el-descriptions-item>
<el-descriptions-item label="测试次数">{{ record.test_count }} </el-descriptions-item>
<el-descriptions-item label="创建时间">
{{ record.create_time || '—' }}
<el-descriptions-item :label="$t('page.detail.testCount')"
>{{ record.test_count }}{{ $t('page.detail.testCountSuffix') }}</el-descriptions-item
>
<el-descriptions-item :label="$t('page.detail.createTime')">
{{ record.create_time || $t('page.detail.dash') }}
</el-descriptions-item>
<el-descriptions-item label="执行管理员">
{{ record.admin_name ?? record.admin_id ?? '—' }}
<el-descriptions-item :label="$t('page.detail.admin')">
{{ record.admin_name ?? record.admin_id ?? $t('page.detail.dash') }}
</el-descriptions-item>
<el-descriptions-item label="付费奖池配置ID">
{{ record.paid_lottery_config_id ?? record.lottery_config_id ?? '—' }}
<el-descriptions-item :label="$t('page.detail.paidPoolId')">
{{ record.paid_lottery_config_id ?? record.lottery_config_id ?? $t('page.detail.dash') }}
</el-descriptions-item>
<el-descriptions-item label="免费奖池配置ID">
{{ record.free_lottery_config_id ?? '—' }}
<el-descriptions-item :label="$t('page.detail.freePoolId')">
{{ record.free_lottery_config_id ?? $t('page.detail.dash') }}
</el-descriptions-item>
<el-descriptions-item label="BIGWIN 权重快照">
<el-descriptions-item :label="$t('page.detail.bigwinSnapshot')">
<template v-if="bigwinWeightDisplay.length">
<span v-for="item in bigwinWeightDisplay" :key="item.grid" class="mr-2">
{{ item.grid }}:{{ item.weight }}
</span>
</template>
<template v-else></template>
<template v-else>{{ $t('page.detail.dash') }}</template>
</el-descriptions-item>
</el-descriptions>
</div>
<div class="detail-section">
<div class="section-title">付费抽奖档位概率T1-T5测试时使用</div>
<div class="section-title">{{ $t('page.detail.sectionPaidTier') }}</div>
<el-table
v-if="paidTierTableData.length"
:data="paidTierTableData"
@@ -48,17 +50,17 @@
class="tier-weights-table"
max-height="160"
>
<el-table-column prop="tier" label="档位" width="80" align="center" />
<el-table-column prop="weight" label="权重" width="100" align="center" />
<el-table-column prop="percent" label="占比" width="100" align="center" />
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="100" align="center" />
<el-table-column prop="percent" :label="$t('page.detail.colPercent')" width="100" align="center" />
</el-table>
<div v-else class="empty-tip">
暂无付费档位数据旧记录可能仅保存 tier_weights_snapshot
{{ $t('page.detail.emptyPaidTier') }}
</div>
</div>
<div class="detail-section">
<div class="section-title">免费抽奖档位概率T1-T5测试时使用</div>
<div class="section-title">{{ $t('page.detail.sectionFreeTier') }}</div>
<el-table
v-if="freeTierTableData.length"
:data="freeTierTableData"
@@ -67,18 +69,18 @@
class="tier-weights-table"
max-height="160"
>
<el-table-column prop="tier" label="档位" width="80" align="center" />
<el-table-column prop="weight" label="权重" width="100" align="center" />
<el-table-column prop="percent" label="占比" width="100" align="center" />
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="100" align="center" />
<el-table-column prop="percent" :label="$t('page.detail.colPercent')" width="100" align="center" />
</el-table>
<div v-else class="empty-tip">暂无免费档位数据</div>
<div v-else class="empty-tip">{{ $t('page.detail.emptyFreeTier') }}</div>
</div>
<div class="detail-section">
<div class="section-title">权重配比快照测试时使用的 T1-T5/BIGWIN 配置</div>
<div class="section-title">{{ $t('page.detail.sectionSnapshot') }}</div>
<div class="snapshot-group">
<div class="snapshot-subtitle">顺时针 BIGWIN</div>
<div class="snapshot-subtitle">{{ $t('page.detail.subCw') }}</div>
<el-table
:data="snapshotClockwise"
border
@@ -86,15 +88,15 @@
max-height="180"
class="snapshot-table"
>
<el-table-column prop="tier" label="档位" width="80" align="center" />
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" />
<el-table-column prop="weight" label="权重" width="90" align="center" />
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
</el-table>
<div v-if="!snapshotClockwise.length" class="empty-tip">暂无顺时针数据</div>
<div v-if="!snapshotClockwise.length" class="empty-tip">{{ $t('page.detail.emptyCw') }}</div>
</div>
<div class="snapshot-group">
<div class="snapshot-subtitle">逆时针 BIGWIN</div>
<div class="snapshot-subtitle">{{ $t('page.detail.subCcw') }}</div>
<el-table
:data="snapshotCounterclockwise"
border
@@ -102,15 +104,15 @@
max-height="180"
class="snapshot-table"
>
<el-table-column prop="tier" label="档位" width="80" align="center" />
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" />
<el-table-column prop="weight" label="权重" width="90" align="center" />
<el-table-column prop="tier" :label="$t('page.detail.colTier')" width="80" align="center" />
<el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
</el-table>
<div v-if="!snapshotCounterclockwise.length" class="empty-tip">暂无逆时针数据</div>
<div v-if="!snapshotCounterclockwise.length" class="empty-tip">{{ $t('page.detail.emptyCcw') }}</div>
</div>
<div class="snapshot-group">
<div class="snapshot-subtitle">BIGWIN DiceRewardConfig 配置快照</div>
<div class="snapshot-subtitle">{{ $t('page.detail.subBigwin') }}</div>
<el-table
:data="bigwinTableData"
border
@@ -118,25 +120,25 @@
max-height="180"
class="snapshot-table"
>
<el-table-column prop="grid_number" label="色子点数" width="100" align="center" />
<el-table-column prop="weight" label="权重" width="90" align="center" />
<el-table-column prop="grid_number" :label="$t('page.detail.colGridNumber')" width="100" align="center" />
<el-table-column prop="weight" :label="$t('page.detail.colWeight')" width="90" align="center" />
</el-table>
<div v-if="!bigwinTableData.length" class="empty-tip">暂无 BIGWIN 数据</div>
<div v-if="!bigwinTableData.length" class="empty-tip">{{ $t('page.detail.emptyBigwinTable') }}</div>
</div>
</div>
<div class="detail-section">
<div class="section-title">落点统计 grid_number 出现次数</div>
<div class="section-title">{{ $t('page.detail.sectionResult') }}</div>
<div class="chart-wrap">
<ArtBarChart
x-axis-name="色子点数 (grid_number)"
:x-axis-name="$t('page.detail.chartXAxis')"
:x-axis-data="chartLabels"
:data="chartData"
height="280px"
/>
</div>
<div v-if="resultTotal === 0" class="empty-tip">暂无落点数据</div>
<div v-else class="result-summary">总落点次数{{ resultTotal }}</div>
<div v-if="resultTotal === 0" class="empty-tip">{{ $t('page.detail.emptyResult') }}</div>
<div v-else class="result-summary">{{ $t('page.detail.resultTotal', { n: resultTotal }) }}</div>
</div>
<div class="detail-section footer-actions">
@@ -146,7 +148,7 @@
:loading="importing"
@click="openImport"
>
导入到当前配置
{{ $t('page.detail.btnImport') }}
</el-button>
</div>
</template>
@@ -154,21 +156,19 @@
<!-- 导入弹窗 -->
<el-dialog
v-model="importVisible"
title="导入到正式配置"
:title="$t('page.detail.importTitle')"
width="520px"
align-center
:close-on-click-modal="false"
>
<p class="import-desc">
将本测试记录导入<strong>DiceReward</strong>格子权重
<strong>DiceRewardConfig</strong>BIGWIN weight
<strong>DiceLotteryPoolConfig</strong>付费/免费 T1-T5 档位概率请选择要写入的奖池
{{ $t('page.detail.importDesc') }}
</p>
<el-form label-width="160px">
<el-form-item label="导入付费档位概率到奖池">
<el-form-item :label="$t('page.detail.importPaidLabel')">
<el-select
v-model="importPaidLotteryConfigId"
placeholder="选择任意奖池(建议付费池)"
:placeholder="$t('page.detail.importPaidPlaceholder')"
clearable
filterable
style="width: 100%"
@@ -180,12 +180,12 @@
:value="opt.id"
/>
</el-select>
<div class="form-tip">不选则使用本记录保存时的付费奖池配置 ID</div>
<div class="form-tip">{{ $t('page.detail.importPaidTip') }}</div>
</el-form-item>
<el-form-item label="导入免费档位概率到奖池">
<el-form-item :label="$t('page.detail.importFreeLabel')">
<el-select
v-model="importFreeLotteryConfigId"
placeholder="选择任意奖池(建议免费池)"
:placeholder="$t('page.detail.importFreePlaceholder')"
clearable
filterable
style="width: 100%"
@@ -197,17 +197,18 @@
:value="opt.id"
/>
</el-select>
<div class="form-tip">不选则使用本记录保存时的免费奖池配置 ID</div>
<div class="form-tip">{{ $t('page.detail.importFreeTip') }}</div>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="importVisible = false">取消</el-button>
<el-button @click="importVisible = false">{{ $t('common.cancel') }}</el-button>
<el-button
v-permission="'dice:reward_config_record:index:importFromRecord'"
type="primary"
:loading="importing"
@click="confirmImport"
>确认导入</el-button>
>{{ $t('page.detail.btnConfirmImport') }}</el-button
>
</template>
</el-dialog>
</el-drawer>
@@ -218,6 +219,9 @@
import recordApi from '../../../api/reward_config_record/index'
import lotteryConfigApi from '../../../api/lottery_pool_config/index'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
const { t, locale } = useI18n()
const GRID_NUMBERS = [
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@@ -278,22 +282,24 @@
const importFreeLotteryConfigId = ref<number | null>(null)
const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
function tierWeightsToTableData(t: Record<string, number> | null | undefined) {
if (!t || typeof t !== 'object') return []
function tierWeightsToTableData(weightsMap: Record<string, number> | null | undefined) {
const dash = t('page.detail.dash')
if (!weightsMap || typeof weightsMap !== 'object') return []
const tiers = ['T1', 'T2', 'T3', 'T4', 'T5']
const rows = tiers.map((tier) => {
const w = t[tier] ?? t[tier.toLowerCase()] ?? 0
const w = weightsMap[tier] ?? weightsMap[tier.toLowerCase()] ?? 0
return { tier, weight: w }
})
const total = rows.reduce((sum, r) => sum + r.weight, 0)
return rows.map((r) => ({
tier: r.tier,
weight: r.weight,
percent: total > 0 ? `${((r.weight / total) * 100).toFixed(1)}%` : '—'
percent: total > 0 ? `${((r.weight / total) * 100).toFixed(1)}%` : dash
}))
}
const paidTierTableData = computed(() => {
locale.value
const r = props.record
const paidFromRecord = r?.paid_tier_weights
const snapshot = r?.tier_weights_snapshot
@@ -315,6 +321,7 @@
})
const freeTierTableData = computed(() => {
locale.value
const r = props.record
const freeFromRecord = r?.free_tier_weights
const snapshot = r?.tier_weights_snapshot
@@ -362,6 +369,8 @@
})
const snapshotTableData = computed(() => {
locale.value
const dash = t('page.detail.dash')
const snapshot = props.record?.weight_config_snapshot as
| Array<{
tier?: string
@@ -374,11 +383,12 @@
return snapshot.map((item) => {
const dir = item.direction
return {
tier: item.tier ?? '—',
tier: item.tier ?? dash,
direction: dir,
direction_label: dir === 0 ? '顺时针' : dir === 1 ? '逆时针' : '—',
grid_number: item.grid_number ?? '—',
weight: item.weight ?? '—'
direction_label:
dir === 0 ? t('page.detail.dirCw') : dir === 1 ? t('page.detail.dirCcw') : dash,
grid_number: item.grid_number ?? dash,
weight: item.weight ?? dash
}
})
})
@@ -468,11 +478,11 @@
paid_lottery_config_id: importPaidLotteryConfigId.value ?? undefined,
free_lottery_config_id: importFreeLotteryConfigId.value ?? undefined
})
ElMessage.success('导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置')
ElMessage.success(t('page.detail.importSuccess'))
importVisible.value = false
emit('import-done')
} catch (e: any) {
ElMessage.error(e?.message ?? '导入失败')
ElMessage.error(e?.message ?? t('page.detail.importFail'))
} finally {
importing.value = false
}

View File

@@ -77,18 +77,14 @@ class PlayStartLogic
throw new ApiException('Lottery pool config not found (name=default required)');
}
// 玩家累计盈利:仅统计 lottery_config_id=type=0 的成功对局(中奖金额-100*局数
$playerQuery = DicePlayRecord::where('player_id', $playerId)
->where('lottery_config_id', $configType0->id)
->where('status', self::RECORD_STATUS_SUCCESS);
$playerWinSum = (float) $playerQuery->sum('win_coin');
$playerPlayCount = (int) $playerQuery->count();
$playerProfitTotal = $playerWinSum - 100.0 * $playerPlayCount;
// 彩金池累计盈利:用于判断是否触发杀分(不再依赖单个玩家累计盈利
// 该值来自 dice_lottery_pool_config.profit_amount
$poolProfitTotal = $configType0->profit_amount ?? 0;
$safetyLine = (int) ($configType0->safety_line ?? 0);
$killEnabled = ((int) ($configType0->kill_enabled ?? 1)) === 1;
// 盈利>=安全线且开启杀分:付费/免费都用 killScore盈利<安全线:付费用玩家权重,免费用 killScore无则用 default
// 记录 lottery_config_id用池权重时记对应池付费用玩家权重时记 default
$usePoolWeights = ($ticketType === self::LOTTERY_TYPE_PAID && $killEnabled && $playerProfitTotal >= $safetyLine && $configType1 !== null)
$usePoolWeights = ($ticketType === self::LOTTERY_TYPE_PAID && $killEnabled && $poolProfitTotal >= $safetyLine && $configType1 !== null)
|| ($ticketType === self::LOTTERY_TYPE_FREE);
$config = $usePoolWeights
? (($ticketType === self::LOTTERY_TYPE_FREE && $configType1 === null) ? $configType0 : $configType1)
@@ -109,6 +105,13 @@ class PlayStartLogic
Log::warning("档位 {$tier} 方向 {$direction} 无任何 DiceReward重新摇取档位");
continue;
}
if ($usePoolWeights) {
$tierRewards = self::filterOutSuperWinOnlyGrids($tierRewards);
if (empty($tierRewards)) {
Log::warning("档位 {$tier} 方向 {$direction} 杀分档位下排除 5/30 后无可用奖励,重新摇取档位");
continue;
}
}
try {
$chosen = self::drawRewardByWeight($tierRewards);
} catch (\RuntimeException $e) {
@@ -133,36 +136,44 @@ class PlayStartLogic
$rewardWinCoin = $isTierT5 ? $realEv : (100 + $realEv);
// 豹子判定5/30 必豹子10/15/20/25 按 DiceRewardConfig 中 BIGWIN 该点数的 weight 判定0-1000010000=100%
// 杀分档位不触发豹子5/30 已在上方抽取时排除10/15/20/25 仅生成非豹子组合
$superWinCoin = 0;
$isWin = 0;
$bigWinRealEv = 0.0;
if (in_array($rollNumber, self::SUPER_WIN_GRID_NUMBERS, true)) {
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
$doSuperWin = $alwaysSuperWin;
if (!$doSuperWin) {
$bigWinWeight = 10000;
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
}
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
} else {
if ($bigWinConfig !== null) {
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
}
}
if ($doSuperWin) {
$rollArray = $this->getSuperWinRollArray($rollNumber);
$isWin = 1;
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
// 中 BIGWIN 豹子:不走原奖励流程,不记录原奖励,不触发 T5 再来一次,仅发放豹子奖金
$rewardWinCoin = 0;
$realEv = 0;
$isTierT5 = false;
} else {
if ($usePoolWeights) {
// 杀分档位:绝不触发豹子,仅生成非豹子组合,不发放豹子奖金
$isWin = 0;
$superWinCoin = 0.0;
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
} else {
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
$doSuperWin = $alwaysSuperWin;
if (!$doSuperWin) {
$bigWinWeight = 10000;
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
}
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
} else {
if ($bigWinConfig !== null) {
$bigWinRealEv = (float) ($bigWinConfig['real_ev'] ?? 0);
}
}
if ($doSuperWin) {
$rollArray = $this->getSuperWinRollArray($rollNumber);
$isWin = 1;
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
// 中 BIGWIN 豹子:不走原奖励流程,不记录原奖励,不触发 T5 再来一次,仅发放豹子奖金
$rewardWinCoin = 0;
$realEv = 0;
$isTierT5 = false;
} else {
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
}
}
} else {
$rollArray = $this->generateRollArrayFromSum($rollNumber);
@@ -254,8 +265,10 @@ class PlayStartLogic
$p->save();
// 玩家累计盈利累加在 type=0 彩金池上:每局按“当前中奖金额(含 BIGWIN - 抽奖券费用 100”
$perPlayProfit = $winCoin - 100.0;
// 彩金池累计盈利累加在 name=default 彩金池上:
// 付费券:每局按“当前中奖金额(含 BIGWIN - 抽奖券费用 100”
// 免费券:取消票价成本 100只计入中奖金额
$perPlayProfit = ($ticketType === self::LOTTERY_TYPE_PAID) ? ($winCoin - 100.0) : $winCoin;
$addProfit = $perPlayProfit;
try {
DiceLotteryPoolConfig::where('id', $type0ConfigId)->update([
@@ -330,6 +343,21 @@ class PlayStartLogic
/** 该组配置权重均为 0 时抛出,供调用方重试 */
private const EXCEPTION_WEIGHT_ALL_ZERO = 'REWARD_WEIGHT_ALL_ZERO';
/** 杀分档位需排除的豹子号5 和 30 只能组成豹子,无法生成非豹子组合 */
private const KILL_MODE_EXCLUDE_GRIDS = [5, 30];
/**
* 杀分档位下排除 grid_number=5/30 的奖励5/30 只能豹子,无法剔除)
* @return array 排除后的奖励列表,保持索引连续
*/
private static function filterOutSuperWinOnlyGrids(array $rewards): array
{
return array_values(array_filter($rewards, function ($r) {
$g = (int) ($r['grid_number'] ?? 0);
return !in_array($g, self::KILL_MODE_EXCLUDE_GRIDS, true);
}));
}
/**
* 按权重抽取一条配置:仅 weight>0 参与抽取weight=0 不会被摇到)
* 使用 [0, total) 浮点随机,支持最小权重 0.1%(如 weight=0.1),避免整数随机导致小权重失真
@@ -463,6 +491,14 @@ class PlayStartLogic
if (empty($tierRewards)) {
continue;
}
// 免费券或 killScore 池:与实际流程一致,排除 5/30 且不触发豹子
$useKillMode = ($lotteryType === 1) || ($config !== null && (string) ($config->name ?? '') === 'killScore');
if ($useKillMode) {
$tierRewards = self::filterOutSuperWinOnlyGrids($tierRewards);
if (empty($tierRewards)) {
continue;
}
}
try {
$chosen = self::drawRewardByWeight($tierRewards);
} catch (\RuntimeException $e) {
@@ -488,27 +524,34 @@ class PlayStartLogic
$isWin = 0;
$bigWinRealEv = 0.0;
if (in_array($rollNumber, self::SUPER_WIN_GRID_NUMBERS, true)) {
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
$doSuperWin = $alwaysSuperWin;
if (!$doSuperWin) {
$bigWinWeight = 10000;
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
}
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
}
if ($bigWinConfig !== null && isset($bigWinConfig['real_ev'])) {
$bigWinRealEv = (float) $bigWinConfig['real_ev'];
}
if ($doSuperWin) {
$rollArray = $this->getSuperWinRollArray($rollNumber);
$isWin = 1;
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
$rewardWinCoin = 0;
} else {
if ($useKillMode) {
// 杀分档位:绝不触发豹子,仅生成非豹子组合,不发放豹子奖金
$isWin = 0;
$superWinCoin = 0.0;
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
} else {
$bigWinConfig = DiceRewardConfig::getCachedByTierAndGridNumber('BIGWIN', $rollNumber);
$alwaysSuperWin = in_array($rollNumber, self::SUPER_WIN_ALWAYS_GRID_NUMBERS, true);
$doSuperWin = $alwaysSuperWin;
if (!$doSuperWin) {
$bigWinWeight = 10000;
if ($bigWinConfig !== null && isset($bigWinConfig['weight'])) {
$bigWinWeight = min(10000, max(0, (int) $bigWinConfig['weight']));
}
$roll = (random_int(0, PHP_INT_MAX - 1) / (float) PHP_INT_MAX);
$doSuperWin = $bigWinWeight > 0 && $roll < ($bigWinWeight / 10000.0);
}
if ($bigWinConfig !== null && isset($bigWinConfig['real_ev'])) {
$bigWinRealEv = (float) $bigWinConfig['real_ev'];
}
if ($doSuperWin) {
$rollArray = $this->getSuperWinRollArray($rollNumber);
$isWin = 1;
$superWinCoin = $bigWinRealEv > 0 ? $bigWinRealEv : self::SUPER_WIN_BONUS;
$rewardWinCoin = 0;
} else {
$rollArray = $this->generateNonSuperWinRollArrayWithSum($rollNumber);
}
}
} else {
$rollArray = $this->generateRollArrayFromSum($rollNumber);

View File

@@ -60,7 +60,16 @@ class DicePlayRecordController extends BaseController
'diceRewardConfig',
'diceLotteryPoolConfig',
]);
// 按当前筛选条件统计:平台总盈利 = 付费抽奖(lottery_type=0)次数×100 - 玩家总收益(win_coin 求和)
$sumQuery = clone $query;
$playerTotalWin = (float) $sumQuery->sum('win_coin');
$paidCountQuery = clone $query;
$paidCount = (int) $paidCountQuery->where('lottery_type', 0)->count();
$totalWinCoin = $paidCount * 100 - $playerTotalWin;
$data = $this->logic->getList($query);
$data['total_win_coin'] = $totalWinCoin;
return $this->success($data);
}

View File

@@ -22,6 +22,8 @@ class DicePlayRecordLogic extends BaseLogic
public function __construct()
{
$this->model = new DicePlayRecord();
// 默认按主键倒序:最新数据优先展示
$this->setOrderType('DESC');
}
/**

View File

@@ -22,6 +22,8 @@ class DicePlayerTicketRecordLogic extends BaseLogic
public function __construct()
{
$this->model = new DicePlayerTicketRecord();
// 默认按主键倒序:最新数据优先展示
$this->setOrderType('DESC');
}
/**

View File

@@ -23,6 +23,8 @@ class DicePlayerWalletRecordLogic extends BaseLogic
public function __construct()
{
$this->model = new DicePlayerWalletRecord();
// 默认按主键倒序:最新数据优先展示
$this->setOrderType('DESC');
}
/**

View File

@@ -20,6 +20,8 @@ class DiceRewardConfigRecordLogic extends BaseLogic
public function __construct()
{
$this->model = new DiceRewardConfigRecord();
// 默认按主键倒序:最新数据优先展示
$this->setOrderType('DESC');
}
/**

View File

@@ -80,8 +80,8 @@ class WeightTestRunner
DiceRewardConfig::clearRequestInstance();
DiceReward::clearRequestInstance();
//“玩家”盈利: 玩家累计盈利:仅统计 lottery_config_id=default 的成功对局win_coin - 100与 PlayStartLogic 一致
$playerProfitTotal = 0.0;
// 彩金池累计盈利:用于判断是否触发杀分(不再依赖单个玩家累计盈利)
$poolProfitTotal = $configType0->profit_amount ?? 0;
$playLogic = new PlayStartLogic();
$resultCounts = [];
@@ -91,22 +91,22 @@ class WeightTestRunner
try {
for ($i = 0; $i < $paidS; $i++) {
$usePoolWeights = $killEnabled && $playerProfitTotal >= $safetyLine && $configType1 !== null;
$usePoolWeights = $killEnabled && $poolProfitTotal >= $safetyLine && $configType1 !== null;
$paidConfig = $usePoolWeights ? $configType1 : $configType0;
$customWeights = $usePoolWeights ? null : $paidTierWeights;
$row = $playLogic->simulateOnePlay($paidConfig, 0, 0, $customWeights);
$this->accumulateProfitForDefault($row, 0, $paidConfig, $configType0, $playerProfitTotal);
$this->accumulateProfitForDefault($row, 0, $paidConfig, $configType0, $poolProfitTotal);
$this->aggregate($row, $resultCounts, $tierCounts);
$buffer[] = $this->rowForInsert($row, $recordId);
$done++;
$this->flushIfNeeded($buffer, $recordId, $done, $total, $resultCounts, $tierCounts);
}
for ($i = 0; $i < $paidN; $i++) {
$usePoolWeights = $killEnabled && $playerProfitTotal >= $safetyLine && $configType1 !== null;
$usePoolWeights = $killEnabled && $poolProfitTotal >= $safetyLine && $configType1 !== null;
$paidConfig = $usePoolWeights ? $configType1 : $configType0;
$customWeights = $usePoolWeights ? null : $paidTierWeights;
$row = $playLogic->simulateOnePlay($paidConfig, 1, 0, $customWeights);
$this->accumulateProfitForDefault($row, 0, $paidConfig, $configType0, $playerProfitTotal);
$this->accumulateProfitForDefault($row, 0, $paidConfig, $configType0, $poolProfitTotal);
$this->aggregate($row, $resultCounts, $tierCounts);
$buffer[] = $this->rowForInsert($row, $recordId);
$done++;
@@ -114,6 +114,7 @@ class WeightTestRunner
}
for ($i = 0; $i < $freeS; $i++) {
$row = $playLogic->simulateOnePlay($freeConfig, 0, 1, null);
$this->accumulateProfitForDefault($row, 1, $freeConfig, $configType0, $poolProfitTotal);
$this->aggregate($row, $resultCounts, $tierCounts);
$buffer[] = $this->rowForInsert($row, $recordId);
$done++;
@@ -121,6 +122,7 @@ class WeightTestRunner
}
for ($i = 0; $i < $freeN; $i++) {
$row = $playLogic->simulateOnePlay($freeConfig, 1, 1, null);
$this->accumulateProfitForDefault($row, 1, $freeConfig, $configType0, $poolProfitTotal);
$this->aggregate($row, $resultCounts, $tierCounts);
$buffer[] = $this->rowForInsert($row, $recordId);
$done++;
@@ -139,18 +141,19 @@ class WeightTestRunner
}
/**
* 仅当付费抽奖且使用 default 池时累加玩家盈利win_coin - 100,与 PlayStartLogic 一致
* @param object $usedConfig 本次使用的奖池配置
* 累加彩金池累计盈利,用于触发杀分,与 PlayStartLogic 一致
* @param int $lotteryType 0=付费券1=免费券
* @param object $usedConfig 本次使用的奖池配置(仅用于校验非空)
* @param object $configType0 name=default 的彩金池
* @param float $playerProfitTotal 实际为“彩金池累计盈利”滚动值
*/
private function accumulateProfitForDefault(array $row, int $lotteryType, $usedConfig, $configType0, float &$playerProfitTotal): void
{
if ($lotteryType !== 0 || $usedConfig === null || $configType0 === null || !isset($row['win_coin'])) {
if (($lotteryType !== 0 && $lotteryType !== 1) || $usedConfig === null || $configType0 === null || !isset($row['win_coin'])) {
return;
}
if ((int) $usedConfig->id === (int) $configType0->id) {
$playerProfitTotal += (float) $row['win_coin'] - 100.0;
}
$winCoin = (float) $row['win_coin'];
$playerProfitTotal += $lotteryType === 0 ? ($winCoin - 100.0) : $winCoin;
}
private function aggregate(array $row, array &$resultCounts, array &$tierCounts): void

View File

@@ -18,7 +18,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
*/
protected $rule = [
'name' => 'require',
'type' => 'require',
't1_weight' => 'require',
't2_weight' => 'require',
't3_weight' => 'require',
@@ -31,7 +30,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
*/
protected $message = [
'name' => '名称必须填写',
'type' => '奖池类型必须填写',
't1_weight' => 'T1池权重必须填写',
't2_weight' => 'T2池权重必须填写',
't3_weight' => 'T3池权重必须填写',
@@ -45,7 +43,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
protected $scene = [
'save' => [
'name',
'type',
't1_weight',
't2_weight',
't3_weight',
@@ -54,7 +51,6 @@ class DiceLotteryPoolConfigValidate extends BaseValidate
],
'update' => [
'name',
'type',
't1_weight',
't2_weight',
't3_weight',