修复databi

This commit is contained in:
zhx 2026-06-12 03:39:36 +08:00
parent 300d53a0cd
commit 5400f1dd57
4 changed files with 53 additions and 20 deletions

View File

@ -24,7 +24,9 @@ export function DatabiHeader({
appOptions = [], appOptions = [],
countryId, countryId,
countryOptions = defaultCountryOptions, countryOptions = defaultCountryOptions,
error = "",
filtersLoading = false, filtersLoading = false,
loading = false,
onScreenChange, onScreenChange,
onAppChange, onAppChange,
onCountryChange, onCountryChange,
@ -143,7 +145,10 @@ export function DatabiHeader({
value={countryId} value={countryId}
valueLabel={countryLabel} valueLabel={countryLabel}
/> />
<span className="live-dot">实时</span> <span className={error ? "live-dot live-dot--warn" : "live-dot"} title={error || ""}>
{error ? "异常" : loading ? "刷新中" : "实时"}
</span>
{error ? <span className="header-error">{error}</span> : null}
</div> </div>
</header> </header>
); );

View File

@ -13,11 +13,19 @@ const eventLabels = {
page_open: "页面打开", page_open: "页面打开",
config_load_success: "配置成功", config_load_success: "配置成功",
config_load_failed: "配置失败", config_load_failed: "配置失败",
gesture_select: "选择手势",
match_api: "匹配接口",
match_cancel: "取消匹配",
stake_selected: "选择档位", stake_selected: "选择档位",
stake_select: "选择档位",
match_click: "点击匹配", match_click: "点击匹配",
match_success: "匹配成功", match_success: "匹配成功",
animation_start: "进入开奖", animation_start: "进入开奖",
preload_complete: "预加载完成",
reveal_enter: "进入开奖",
roll_api: "开奖接口",
settlement_show: "结算展示", settlement_show: "结算展示",
play_again: "再来一局",
play_again_click: "再来一局", play_again_click: "再来一局",
exit_click: "退出" exit_click: "退出"
}; };

View File

@ -688,6 +688,15 @@
box-shadow: 0 0 14px rgba(247, 163, 58, 0.72); box-shadow: 0 0 14px rgba(247, 163, 58, 0.72);
} }
.header-error {
max-width: 220px;
overflow: hidden;
color: #f7a33a;
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.metric-grid { .metric-grid {
display: grid; display: grid;
grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-columns: repeat(7, minmax(0, 1fr));

View File

@ -1,4 +1,5 @@
import AddCircleOutlineOutlined from "@mui/icons-material/AddCircleOutlineOutlined"; import AddCircleOutlineOutlined from "@mui/icons-material/AddCircleOutlineOutlined";
import RemoveCircleOutlineOutlined from "@mui/icons-material/RemoveCircleOutlineOutlined";
import RefreshOutlined from "@mui/icons-material/RefreshOutlined"; import RefreshOutlined from "@mui/icons-material/RefreshOutlined";
import SettingsOutlined from "@mui/icons-material/SettingsOutlined"; import SettingsOutlined from "@mui/icons-material/SettingsOutlined";
import MenuItem from "@mui/material/MenuItem"; import MenuItem from "@mui/material/MenuItem";
@ -108,7 +109,7 @@ export function SelfGamePage() {
label: "机器人", label: "机器人",
width: "minmax(190px, .9fr)", width: "minmax(190px, .9fr)",
render: (game) => render: (game) =>
`${game.robotEnabled ? "启用" : "关闭"} · ${game.robotMatchWaitMs}ms · 胜率 ${game.robotUserWinRatePercent ?? 50}%`, `${game.robotEnabled ? "启用" : "关闭"} · ${game.robotMatchWaitMs}ms · 玩家胜率 ${game.robotUserWinRatePercent ?? 50}%`,
}, },
{ {
key: "updated", key: "updated",
@ -119,15 +120,26 @@ export function SelfGamePage() {
{ {
key: "actions", key: "actions",
label: "操作", label: "操作",
width: "128px", width: "176px",
render: (game) => ( render: (game) => (
<AdminRowActions> <AdminRowActions>
<AdminActionIconButton disabled={!canUpdate} label="配置骰子" onClick={() => openConfig(game)}> <AdminActionIconButton disabled={!canUpdate} label="配置骰子" onClick={() => openConfig(game)}>
<SettingsOutlined fontSize="small" /> <SettingsOutlined fontSize="small" />
</AdminActionIconButton> </AdminActionIconButton>
<AdminActionIconButton disabled={!canUpdate} label="调整奖池" onClick={() => openPool(game)}> <AdminActionIconButton
disabled={!canUpdate}
label="增加奖池"
onClick={() => openPool(game, "in")}
>
<AddCircleOutlineOutlined fontSize="small" /> <AddCircleOutlineOutlined fontSize="small" />
</AdminActionIconButton> </AdminActionIconButton>
<AdminActionIconButton
disabled={!canUpdate}
label="扣除奖池"
onClick={() => openPool(game, "out")}
>
<RemoveCircleOutlineOutlined fontSize="small" />
</AdminActionIconButton>
</AdminRowActions> </AdminRowActions>
), ),
}, },
@ -141,9 +153,13 @@ export function SelfGamePage() {
setActiveAction("config"); setActiveAction("config");
}; };
const openPool = (game) => { const openPool = (game, direction) => {
setActiveGame(game); setActiveGame(game);
setPoolForm(defaultPoolForm); setPoolForm({
...defaultPoolForm,
direction,
reason: direction === "out" ? "admin_deduct" : "admin_adjust",
});
setActiveAction("pool"); setActiveAction("pool");
}; };
@ -179,7 +195,7 @@ export function SelfGamePage() {
reason: poolForm.reason, reason: poolForm.reason,
}); });
await load(); await load();
showToast("奖池已调整", "success"); showToast(poolForm.direction === "out" ? "奖池已扣除" : "奖池已增加", "success");
closeDialog(); closeDialog();
} catch (err) { } catch (err) {
showToast(err.message || "调整奖池失败", "error"); showToast(err.message || "调整奖池失败", "error");
@ -285,8 +301,8 @@ function ConfigDialog({ form, loading, open, setForm, onClose, onSubmit }) {
onChange={(event) => setForm({ ...form, robotMatchWaitMs: event.target.value })} onChange={(event) => setForm({ ...form, robotMatchWaitMs: event.target.value })}
/> />
<TextField <TextField
helperText="50 为正常规则" helperText="机器人局真人玩家胜率,50 为正常规则"
label="机器人胜率 %" label="玩家胜率 %"
type="number" type="number"
value={form.robotUserWinRatePercent} value={form.robotUserWinRatePercent}
slotProps={{ htmlInput: { max: 100, min: 0 } }} slotProps={{ htmlInput: { max: 100, min: 0 } }}
@ -304,29 +320,24 @@ function ConfigDialog({ form, loading, open, setForm, onClose, onSubmit }) {
} }
function PoolDialog({ form, loading, open, setForm, onClose, onSubmit }) { function PoolDialog({ form, loading, open, setForm, onClose, onSubmit }) {
const isDeduct = form.direction === "out";
return ( return (
<AdminFormDialog <AdminFormDialog
loading={loading} loading={loading}
open={open} open={open}
submitLabel="确认调整" submitLabel={isDeduct ? "确认扣除" : "确认增加"}
title="调整奖池" title={isDeduct ? "扣除奖池" : "增加奖池"}
onClose={onClose} onClose={onClose}
onSubmit={onSubmit} onSubmit={onSubmit}
> >
<AdminFormFieldGrid> <AdminFormFieldGrid>
<TextField disabled label="方向" value={isDeduct ? "扣除" : "增加"} />
<TextField <TextField
label="方向" helperText={isDeduct ? "不能扣成负数" : ""}
select
value={form.direction}
onChange={(event) => setForm({ ...form, direction: event.target.value })}
>
<MenuItem value="in">增加</MenuItem>
<MenuItem value="out">减少</MenuItem>
</TextField>
<TextField
label="金币" label="金币"
type="number" type="number"
value={form.amountCoin} value={form.amountCoin}
slotProps={{ htmlInput: { min: 1 } }}
onChange={(event) => setForm({ ...form, amountCoin: event.target.value })} onChange={(event) => setForm({ ...form, amountCoin: event.target.value })}
/> />
<TextField <TextField