迁移游戏配置手动操作
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
let adminGameConfigControlsBound = false;
|
let adminGameConfigControlsBound = false;
|
||||||
|
|
||||||
|
const MYSTERY_BOX_META = {
|
||||||
|
normal: { name: "普通箱", icon: "📦" },
|
||||||
|
rare: { name: "稀有箱", icon: "💎" },
|
||||||
|
trap: { name: "黑化箱", icon: "☠️" },
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取后台 layout 注入的 CSRF token。
|
* 读取后台 layout 注入的 CSRF token。
|
||||||
*
|
*
|
||||||
@@ -221,6 +227,174 @@ async function toggleGame(button) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员手动投放神秘箱子。
|
||||||
|
*
|
||||||
|
* @param {HTMLButtonElement} button 投放按钮
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function dropMysteryBox(button) {
|
||||||
|
const boxType = button.getAttribute("data-game-drop-box-type") || "normal";
|
||||||
|
const dropUrl = button.getAttribute("data-game-drop-box-url") || "";
|
||||||
|
const meta = MYSTERY_BOX_META[boxType] || MYSTERY_BOX_META.normal;
|
||||||
|
|
||||||
|
if (!dropUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.adminDialog?.confirm(
|
||||||
|
`确定要向 <b>#1 房间</b> 投放一个「${meta.name}」吗?<br><span style="color:#64748b; font-size:12px;">箱子投放后将立即在公屏广播暗号,用户限时领取。</span>`,
|
||||||
|
`投放${meta.name}`,
|
||||||
|
() => {
|
||||||
|
fetch(dropUrl, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"X-CSRF-TOKEN": getCsrfToken(),
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Accept": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ box_type: boxType }),
|
||||||
|
})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
window.adminDialog?.alert(
|
||||||
|
data.message || (data.ok ? "投放成功!" : "投放失败"),
|
||||||
|
data.ok ? "投放成功" : "投放失败",
|
||||||
|
data.ok ? meta.icon : "❌",
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.catch(() => window.adminDialog?.alert("网络错误,请重试", "网络错误", "🌐"));
|
||||||
|
},
|
||||||
|
meta.icon,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载双色球当前期次状态。
|
||||||
|
*
|
||||||
|
* @param {HTMLButtonElement} button 状态加载按钮
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function loadLotteryStatus(button) {
|
||||||
|
const currentUrl = button.getAttribute("data-game-lottery-current-url") || "";
|
||||||
|
const statusPanel = document.getElementById("lottery-issue-status");
|
||||||
|
|
||||||
|
if (!currentUrl || !statusPanel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
statusPanel.innerHTML = '<span class="text-gray-400">⏳ 加载中…</span>';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(currentUrl, {
|
||||||
|
headers: { "Accept": "application/json" },
|
||||||
|
});
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (!data.issue) {
|
||||||
|
statusPanel.innerHTML = '<span class="text-orange-500">⚠️ 当前无进行中期次,可手动开新期</span>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const issue = data.issue;
|
||||||
|
const pool = Number(issue.pool_amount).toLocaleString();
|
||||||
|
const statusMap = {
|
||||||
|
open: "🟢 购票中",
|
||||||
|
closed: "🔴 已停售",
|
||||||
|
settled: "✅ 已开奖",
|
||||||
|
};
|
||||||
|
const superTag = issue.is_super_issue ? " 🎊<b>超级期</b>" : "";
|
||||||
|
const drawAt = issue.draw_at ? issue.draw_at.replace("T", " ") : "--";
|
||||||
|
|
||||||
|
statusPanel.innerHTML = `第 <b>${issue.issue_no}</b> 期${superTag} · 状态:${statusMap[issue.status] || issue.status}
|
||||||
|
· 奖池:<b style="color:#dc2626">💰 ${pool} 金币</b>
|
||||||
|
· 预计开奖:${drawAt}
|
||||||
|
· 已购:${issue.total_tickets || 0} 注`;
|
||||||
|
} catch (error) {
|
||||||
|
statusPanel.innerHTML = '<span class="text-red-400">❌ 加载失败</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动开启新一期双色球。
|
||||||
|
*
|
||||||
|
* @param {HTMLButtonElement} button 开期按钮
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function openLotteryIssue(button) {
|
||||||
|
const openUrl = button.getAttribute("data-game-lottery-open-url") || "";
|
||||||
|
|
||||||
|
if (!openUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.adminDialog?.confirm(
|
||||||
|
'确定要手动开启新一期双色球吗?<br><span style="color:#64748b;font-size:12px;">仅在无进行中期次时生效,开奖时间将使用当前配置的 draw_hour:draw_minute。</span>',
|
||||||
|
"手动开新期",
|
||||||
|
() => {
|
||||||
|
fetch(openUrl, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"X-CSRF-TOKEN": getCsrfToken(),
|
||||||
|
"Accept": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
window.adminDialog?.alert(data.message, data.ok ? "操作成功" : "操作失败", data.ok ? "✅" : "❌");
|
||||||
|
if (data.ok) {
|
||||||
|
const statusButton = document.querySelector("[data-game-lottery-current-url]");
|
||||||
|
if (statusButton instanceof HTMLButtonElement) {
|
||||||
|
void loadLotteryStatus(statusButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => window.adminDialog?.alert("网络错误,请重试", "网络错误", "🌐"));
|
||||||
|
},
|
||||||
|
"➕",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制提前开奖,用于测试或管理需要。
|
||||||
|
*
|
||||||
|
* @param {HTMLButtonElement} button 强制开奖按钮
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function forceLotteryDraw(button) {
|
||||||
|
const drawUrl = button.getAttribute("data-game-lottery-force-url") || "";
|
||||||
|
|
||||||
|
if (!drawUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.adminDialog?.confirm(
|
||||||
|
'确定要<b style="color:red">立即强制开奖</b>吗?<br><span style="color:#64748b;font-size:12px;">将对当前 closed 或 open 期次立即执行开奖,此操作不可撤销!</span>',
|
||||||
|
"强制开奖确认",
|
||||||
|
() => {
|
||||||
|
fetch(drawUrl, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"X-CSRF-TOKEN": getCsrfToken(),
|
||||||
|
"Accept": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
window.adminDialog?.alert(data.message, data.ok ? "开奖完成" : "操作失败", data.ok ? "🎊" : "❌");
|
||||||
|
if (data.ok) {
|
||||||
|
const statusButton = document.querySelector("[data-game-lottery-current-url]");
|
||||||
|
if (statusButton instanceof HTMLButtonElement) {
|
||||||
|
void loadLotteryStatus(statusButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => window.adminDialog?.alert("网络错误,请重试", "网络错误", "🌐"));
|
||||||
|
},
|
||||||
|
"🎊",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定游戏管理页通用操作按钮。
|
* 绑定游戏管理页通用操作按钮。
|
||||||
*
|
*
|
||||||
@@ -248,6 +422,56 @@ export function bindAdminGameConfigControls() {
|
|||||||
if (toggleButton instanceof HTMLButtonElement) {
|
if (toggleButton instanceof HTMLButtonElement) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
void toggleGame(toggleButton);
|
void toggleGame(toggleButton);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dropBoxButton = event.target.closest("[data-game-drop-box-type]");
|
||||||
|
if (dropBoxButton instanceof HTMLButtonElement) {
|
||||||
|
event.preventDefault();
|
||||||
|
dropMysteryBox(dropBoxButton);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lotteryStatusButton = event.target.closest("[data-game-lottery-current-url]");
|
||||||
|
if (lotteryStatusButton instanceof HTMLButtonElement) {
|
||||||
|
event.preventDefault();
|
||||||
|
void loadLotteryStatus(lotteryStatusButton);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lotteryOpenButton = event.target.closest("[data-game-lottery-open-url]");
|
||||||
|
if (lotteryOpenButton instanceof HTMLButtonElement) {
|
||||||
|
event.preventDefault();
|
||||||
|
openLotteryIssue(lotteryOpenButton);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lotteryForceButton = event.target.closest("[data-game-lottery-force-url]");
|
||||||
|
if (lotteryForceButton instanceof HTMLButtonElement) {
|
||||||
|
event.preventDefault();
|
||||||
|
forceLotteryDraw(lotteryForceButton);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("mouseover", (event) => {
|
||||||
|
if (!(event.target instanceof Element)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hoverButton = event.target.closest("[data-game-hover-opacity]");
|
||||||
|
if (hoverButton instanceof HTMLElement) {
|
||||||
|
hoverButton.style.opacity = hoverButton.getAttribute("data-game-hover-opacity") || "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("mouseout", (event) => {
|
||||||
|
if (!(event.target instanceof Element)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hoverButton = event.target.closest("[data-game-hover-opacity]");
|
||||||
|
if (hoverButton instanceof HTMLElement) {
|
||||||
|
hoverButton.style.opacity = "1";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,19 +157,22 @@
|
|||||||
<div class="mt-4 pt-4 border-t border-gray-100">
|
<div class="mt-4 pt-4 border-t border-gray-100">
|
||||||
<div class="text-xs font-bold text-gray-600 mb-2">🎯 手动投放箱子</div>
|
<div class="text-xs font-bold text-gray-600 mb-2">🎯 手动投放箱子</div>
|
||||||
<div class="flex items-center gap-3 flex-wrap">
|
<div class="flex items-center gap-3 flex-wrap">
|
||||||
<button onclick="dropBox('normal', {{ $game->id }})"
|
<button type="button" data-game-drop-box-type="normal"
|
||||||
style="padding:8px 16px; background:linear-gradient(135deg,#059669,#10b981); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;"
|
data-game-drop-box-url="{{ route('admin.mystery-box.drop') }}"
|
||||||
onmouseover="this.style.opacity='.85'" onmouseout="this.style.opacity='1'">
|
data-game-hover-opacity=".85"
|
||||||
|
style="padding:8px 16px; background:linear-gradient(135deg,#059669,#10b981); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;">
|
||||||
📦 投放普通箱
|
📦 投放普通箱
|
||||||
</button>
|
</button>
|
||||||
<button onclick="dropBox('rare', {{ $game->id }})"
|
<button type="button" data-game-drop-box-type="rare"
|
||||||
style="padding:8px 16px; background:linear-gradient(135deg,#7c3aed,#a78bfa); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;"
|
data-game-drop-box-url="{{ route('admin.mystery-box.drop') }}"
|
||||||
onmouseover="this.style.opacity='.85'" onmouseout="this.style.opacity='1'">
|
data-game-hover-opacity=".85"
|
||||||
|
style="padding:8px 16px; background:linear-gradient(135deg,#7c3aed,#a78bfa); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;">
|
||||||
💎 投放稀有箱
|
💎 投放稀有箱
|
||||||
</button>
|
</button>
|
||||||
<button onclick="dropBox('trap', {{ $game->id }})"
|
<button type="button" data-game-drop-box-type="trap"
|
||||||
style="padding:8px 16px; background:linear-gradient(135deg,#7f1d1d,#ef4444); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;"
|
data-game-drop-box-url="{{ route('admin.mystery-box.drop') }}"
|
||||||
onmouseover="this.style.opacity='.85'" onmouseout="this.style.opacity='1'">
|
data-game-hover-opacity=".85"
|
||||||
|
style="padding:8px 16px; background:linear-gradient(135deg,#7f1d1d,#ef4444); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;">
|
||||||
☠️ 投放黑化箱
|
☠️ 投放黑化箱
|
||||||
</button>
|
</button>
|
||||||
<span class="text-xs text-gray-400">直接向 #1 房间投放,立即广播暗号</span>
|
<span class="text-xs text-gray-400">直接向 #1 房间投放,立即广播暗号</span>
|
||||||
@@ -187,19 +190,19 @@
|
|||||||
<span class="text-red-400">⏳ 点击下方「加载期次状态」查看当前状态</span>
|
<span class="text-red-400">⏳ 点击下方「加载期次状态」查看当前状态</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-3 flex-wrap">
|
<div class="flex items-center gap-3 flex-wrap">
|
||||||
<button onclick="lotteryLoadStatus()"
|
<button type="button" data-game-lottery-current-url="{{ url('/lottery/current') }}"
|
||||||
style="padding:8px 16px; background:linear-gradient(135deg,#475569,#64748b); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;"
|
data-game-hover-opacity=".85"
|
||||||
onmouseover="this.style.opacity='.85'" onmouseout="this.style.opacity='1'">
|
style="padding:8px 16px; background:linear-gradient(135deg,#475569,#64748b); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;">
|
||||||
🔄 加载期次状态
|
🔄 加载期次状态
|
||||||
</button>
|
</button>
|
||||||
<button onclick="lotteryOpenIssue()"
|
<button type="button" data-game-lottery-open-url="{{ route('admin.lottery.open-issue') }}"
|
||||||
style="padding:8px 16px; background:linear-gradient(135deg,#059669,#10b981); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;"
|
data-game-hover-opacity=".85"
|
||||||
onmouseover="this.style.opacity='.85'" onmouseout="this.style.opacity='1'">
|
style="padding:8px 16px; background:linear-gradient(135deg,#059669,#10b981); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;">
|
||||||
➕ 手动开新期
|
➕ 手动开新期
|
||||||
</button>
|
</button>
|
||||||
<button onclick="lotteryForceDraw()"
|
<button type="button" data-game-lottery-force-url="{{ route('admin.lottery.force-draw') }}"
|
||||||
style="padding:8px 16px; background:linear-gradient(135deg,#dc2626,#ef4444); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;"
|
data-game-hover-opacity=".85"
|
||||||
onmouseover="this.style.opacity='.85'" onmouseout="this.style.opacity='1'">
|
style="padding:8px 16px; background:linear-gradient(135deg,#dc2626,#ef4444); color:#fff; border:none; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:opacity .15s;">
|
||||||
🎊 立即强制开奖
|
🎊 立即强制开奖
|
||||||
</button>
|
</button>
|
||||||
<span class="text-xs text-gray-400">开新期仅在无进行中期次时生效;强制开奖将提前结束当期</span>
|
<span class="text-xs text-gray-400">开新期仅在无进行中期次时生效;强制开奖将提前结束当期</span>
|
||||||
@@ -219,140 +222,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
/**
|
|
||||||
* 管理员手动投放神秘箱子
|
|
||||||
*
|
|
||||||
* @param {string} boxType 箱子类型:normal | rare | trap
|
|
||||||
*/
|
|
||||||
function dropBox(boxType) {
|
|
||||||
const typeNames = {
|
|
||||||
normal: '普通箱',
|
|
||||||
rare: '稀有箱',
|
|
||||||
trap: '黑化箱'
|
|
||||||
};
|
|
||||||
const typeIcons = {
|
|
||||||
normal: '📦',
|
|
||||||
rare: '💎',
|
|
||||||
trap: '☠️'
|
|
||||||
};
|
|
||||||
const name = typeNames[boxType] || boxType;
|
|
||||||
const icon = typeIcons[boxType] || '📦';
|
|
||||||
|
|
||||||
window.adminDialog.confirm(
|
|
||||||
`确定要向 <b>#1 房间</b> 投放一个「${name}」吗?<br><span style="color:#64748b; font-size:12px;">箱子投放后将立即在公屏广播暗号,用户限时领取。</span>`,
|
|
||||||
`投放${name}`,
|
|
||||||
() => {
|
|
||||||
fetch('/admin/mystery-box/drop', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
box_type: boxType
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(data => {
|
|
||||||
window.adminDialog.alert(
|
|
||||||
data.message || (data.ok ? '投放成功!' : '投放失败'),
|
|
||||||
data.ok ? '投放成功' : '投放失败',
|
|
||||||
data.ok ? icon : '❌'
|
|
||||||
);
|
|
||||||
})
|
|
||||||
.catch(() => window.adminDialog.alert('网络错误,请重试', '网络错误', '🌐'));
|
|
||||||
},
|
|
||||||
icon
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载双色球当前期次状态
|
|
||||||
*/
|
|
||||||
function lotteryLoadStatus() {
|
|
||||||
const box = document.getElementById('lottery-issue-status');
|
|
||||||
box.innerHTML = '<span class="text-gray-400">⏳ 加载中…</span>';
|
|
||||||
fetch('/lottery/current', {
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(data => {
|
|
||||||
if (!data.issue) {
|
|
||||||
box.innerHTML = '<span class="text-orange-500">⚠️ 当前无进行中期次,可手动开新期</span>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const iss = data.issue;
|
|
||||||
const pool = Number(iss.pool_amount).toLocaleString();
|
|
||||||
const statusMap = {
|
|
||||||
open: '🟢 购票中',
|
|
||||||
closed: '🔴 已停售',
|
|
||||||
settled: '✅ 已开奖'
|
|
||||||
};
|
|
||||||
const superTag = iss.is_super_issue ? ' 🎊<b>超级期</b>' : '';
|
|
||||||
const drawAt = iss.draw_at ? iss.draw_at.replace('T', ' ') : '--';
|
|
||||||
box.innerHTML = `第 <b>${iss.issue_no}</b> 期${superTag} · 状态:${statusMap[iss.status] || iss.status}
|
|
||||||
· 奖池:<b style="color:#dc2626">💰 ${pool} 金币</b>
|
|
||||||
· 预计开奖:${drawAt}
|
|
||||||
· 已购:${iss.total_tickets || 0} 注`;
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
box.innerHTML = '<span class="text-red-400">❌ 加载失败</span>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手动开启新一期双色球
|
|
||||||
*/
|
|
||||||
function lotteryOpenIssue() {
|
|
||||||
window.adminDialog.confirm(
|
|
||||||
'确定要手动开启新一期双色球吗?<br><span style="color:#64748b;font-size:12px;">仅在无进行中期次时生效,开奖时间将使用当前配置的 draw_hour:draw_minute。</span>',
|
|
||||||
'手动开新期', () => {
|
|
||||||
fetch('/admin/lottery/open-issue', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
|
||||||
'Accept': 'application/json'
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(d => {
|
|
||||||
window.adminDialog.alert(d.message, d.ok ? '操作成功' : '操作失败', d.ok ? '✅' : '❌');
|
|
||||||
if (d.ok) lotteryLoadStatus();
|
|
||||||
})
|
|
||||||
.catch(() => window.adminDialog.alert('网络错误,请重试', '网络错误', '🌐'));
|
|
||||||
}, '➕'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 强制提前开奖(用于测试或管理需要)
|
|
||||||
*/
|
|
||||||
function lotteryForceDraw() {
|
|
||||||
window.adminDialog.confirm(
|
|
||||||
'确定要<b style="color:red">立即强制开奖</b>吗?<br><span style="color:#64748b;font-size:12px;">将对当前 closed 或 open 期次立即执行开奖,此操作不可撤销!</span>',
|
|
||||||
'强制开奖确认', () => {
|
|
||||||
fetch('/admin/lottery/force-draw', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
|
||||||
'Accept': 'application/json'
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(r => r.json())
|
|
||||||
.then(d => {
|
|
||||||
window.adminDialog.alert(d.message, d.ok ? '开奖完成' : '操作失败', d.ok ? '🎊' : '❌');
|
|
||||||
if (d.ok) lotteryLoadStatus();
|
|
||||||
})
|
|
||||||
.catch(() => window.adminDialog.alert('网络错误,请重试', '网络错误', '🌐'));
|
|
||||||
}, '🎊'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@php
|
@php
|
||||||
|
|||||||
Reference in New Issue
Block a user