V2 推送 LINE 改依環境決定目標,移除卡片底部說明文字

根本原因:
V2 原本把推送目標寫死在測試對話(target: local),部署到 NAS 後也只會
私訊測試對象,無法推到正式羽球群;另外卡片底部的「搭檔不重複・實力平衡
排點」說明文字對群組成員沒有意義。

影響:
- NAS 正式環境(LINE_TARGET_MODE=prod)推送到勝皇羽球團群組
- 本機開發(local)維持推到測試對話,按鈕會標示「推送到 LINE(測試)」
- LINE 卡片不再顯示底部說明文字

修法:
前端移除寫死的 target 參數,交由 server 依 LINE_TARGET_MODE 解析目標;
按鈕文字與推送成功訊息改為依環境顯示;buildLineFlexMessageV2 移除 footer。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-20 11:32:41 +08:00
co-authored by Claude Fable 5
parent 1ff149621f
commit ae8dba99b7
3 changed files with 3 additions and 18 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
- 人數 4~7 人時只排 2 號場地 8 局;未滿 4 人無法排賽程
- `讀取指定日期` 可把之前上傳的 V2 賽程從資料庫回填到畫面;該日還沒賽程時會自動改載入出席名單(V1 格式的舊資料請到 `/v1` 讀取)
- 上傳沿用原本的 `badminton` 表:`personnel` 存全部出席者、`battlecombination``"0"` / `"1"` 分別存 2、3 號場地的 16 組搭檔(依序每 2 組為一局的對戰雙方)
- `推送到 LINE` 固定推到測試群組(`LINE_TARGET_ID_LOCAL`),不會推到正式羽球群;一樣要按兩次確認
- `推送到 LINE` 跟著 `LINE_TARGET_MODE` 走:NAS 正式環境(`prod`)推到羽球群、本機開發(`local`)推到測試對話;一樣要按兩次確認,`local` 模式時按鈕會標示「測試」
## V1 功能說明(`/v1`
-14
View File
@@ -499,20 +499,6 @@ function buildLineFlexMessageV2(time, courts) {
],
})),
},
footer: {
type: 'box',
layout: 'vertical',
paddingAll: '10px',
contents: [
{
type: 'text',
text: '搭檔不重複・實力平衡排點',
size: 'xxs',
color: '#9AA89E',
align: 'center',
},
],
},
})),
},
}
+2 -3
View File
@@ -322,7 +322,7 @@ function AppV2() {
await pushScheduleToLine(timeKey, schedule)
setActionState('sharing')
setActionMessage(`已推送到 LINE 測試群組${timeKey}`)
setActionMessage(`已推送到 LINE${timeKey}`)
} catch (pushError) {
setActionState('error')
setActionMessage(
@@ -441,7 +441,7 @@ function AppV2() {
onClick={() => void pushToLine()}
disabled={actionState === 'saving' || actionState === 'loading'}
>
{linePushArmed ? '確認推送到 LINE' : '推送到 LINE(測試'}
{linePushArmed ? '確認推送到 LINE' : showTestBadge ? '推送到 LINE(測試)' : '推送到 LINE'}
</button>
) : null}
</div>
@@ -803,7 +803,6 @@ async function pushScheduleToLine(time: string, schedule: ScheduleRound[]) {
},
body: JSON.stringify({
time,
target: 'local',
courts: courtGames.map(([court, games]) => ({
court,
games: games.map((game, gameIndex) => ({