Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb17d60101 | |||
| a34c79fe0a |
@@ -164,11 +164,15 @@
|
|||||||
<h2>批量添加比赛</h2>
|
<h2>批量添加比赛</h2>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>比赛数据(每行一条,用逗号分隔)</label>
|
<label>比赛数据(每行一条,用逗号分隔)</label>
|
||||||
<textarea id="batch-match-data" rows="12" placeholder="比赛代码,主队,客队,比赛时间,轮次
|
<textarea id="batch-match-data" rows="14" placeholder="比赛代码,主队,客队,比赛时间,轮次,状态,主队比分,客队比分
|
||||||
例如:
|
|
||||||
M001,阿根廷,法国,2026-07-15 21:00,决赛
|
示例:
|
||||||
M002,巴西,德国,2026-07-14 18:00,半决赛
|
M001,阿根廷,法国,2026-07-15 21:00,决赛,upcoming,-,-
|
||||||
M003,西班牙,荷兰,2026-07-14 21:00,半决赛"></textarea>
|
M002,巴西,德国,2026-07-14 18:00,半决赛,finished,2,1
|
||||||
|
M003,西班牙,荷兰,2026-07-14 21:00,半决赛,upcoming,-,-
|
||||||
|
|
||||||
|
状态:upcoming(即将进行)或 finished(已完成)
|
||||||
|
比分:未进行的比赛用 - 表示"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>轮次(可选,批量设置)</label>
|
<label>轮次(可选,批量设置)</label>
|
||||||
|
|||||||
@@ -429,13 +429,14 @@ async function batchAddMatches() {
|
|||||||
const lines = dataText.split('\n').filter(line => line.trim());
|
const lines = dataText.split('\n').filter(line => line.trim());
|
||||||
let successCount = 0;
|
let successCount = 0;
|
||||||
let failCount = 0;
|
let failCount = 0;
|
||||||
let errors = [];\n
|
let errors = [];
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const parts = line.split(',').map(p => p.trim());
|
const parts = line.split(',').map(p => p.trim());
|
||||||
|
|
||||||
if (parts.length < 3) {
|
if (parts.length < 3) {
|
||||||
failCount++;
|
failCount++;
|
||||||
errors.push(`格式错误: ${line}`);n continue;
|
errors.push(`格式错误: ${line}`);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchData = {
|
const matchData = {
|
||||||
@@ -444,7 +445,9 @@ async function batchAddMatches() {
|
|||||||
away_team: parts[2],
|
away_team: parts[2],
|
||||||
match_time: parts[3] || null,
|
match_time: parts[3] || null,
|
||||||
round_name: parts[4] || defaultRound || '小组赛',
|
round_name: parts[4] || defaultRound || '小组赛',
|
||||||
status: 'upcoming'
|
status: parts[5] || 'upcoming',
|
||||||
|
home_score: (parts[6] && parts[6] !== '-') ? parseInt(parts[6]) : null,
|
||||||
|
away_score: (parts[7] && parts[7] !== '-') ? parseInt(parts[7]) : null
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user