## 大屏控制(用户:管理面板只能看到本机显示器,看不到局域网设备;也不能给某块屏单独切页) - 服务端:`POST /api/display/command` 新增可选 `targets []string` —— 空 = 广播(公告语义不变), 非空 = 只发给点名的实例并返回命中数;命中 0 个返回 404 +「目标大屏已离线,请刷新在线列表」 (不落审计、公告也不落库)。`DisplaySender` 签名随之扩展,新增 `Hub.SendCommandToInstances`(与按房间的 SendCommand 并存)。 - 服务端:WS `hello` 新增可选 `screen`,`realtime.Instance` 新增 `Screen`(不带 omitempty, 局域网浏览器恒为空串),这样管理端能把「本机显示器」与「在线实例」精确对上。 - 管理端「大屏控制」:写死的「在线看板」占位换成真实列表(5 秒轮询、页面隐藏停表), 列出实例 id / 在线离线 / 落后 / 屏号或「局域网浏览器」/ 当前页 / 来源 / 心跳; 每行可单独切页;本机显示器卡片补「当前页」与逐屏切页;离线时控件置灰并说明原因。 页面下拉改为共用大屏那份页名清单(管理端两处标签随之变为「个人积分奖牌榜」「分项成绩」)。 ## 导出(用户:保留多页工作簿的同时,再要一种全平铺单页;积分榜明细也要能导出) - 新增 `GET /api/export/all-flat.xlsx` → `赛事成绩总表(单页).xlsx`:一个工作簿一张表, 列 = 大项/小项/组别/名次/号码/单位/运动员-队/成绩/积分/状态/备注;前三列取 `EventSheet` 的结构化字段(不解析标题),后 8 列就是 `eventColumns` 本身(append 拼出, 两处不可能漂移)。**既有「全部」(all.xlsx,多 sheet)一字未动。** - 新增 `GET /api/export/teams.xlsx` → `单位积分总明细.xlsx`:一张带「单位」列的总表 + 每个有明细行的单位一张分表;**无明细行的单位不出分表**(空表没信息量,且会把假删除的 隐藏单位名字重新印进导出件);已隐藏但有流水的单位照常出表(它在榜单上)。 - 积分榜页:页头「导出总明细」、单位明细面板「导出该单位明细」;导出页新增「全部(单页)」。 测试:服务端 12 包全绿 / 347 个测试函数;前端 vue-tsc 通过、184 例全过;Console 18 文件。 docs/ 与 devdocs/ 同步(含新增 Q65–Q70 与两轮进度记录)。
141 lines
4.3 KiB
Go
141 lines
4.3 KiB
Go
package httpapi
|
||
|
||
// 本文件是各写接口的请求体契约;字段名与 web/src/shared/types.ts 对齐。
|
||
|
||
type loginInput struct {
|
||
Username string `json:"username"`
|
||
Password string `json:"password"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type saveDraftPayload struct {
|
||
EventID int64 `json:"eventId"`
|
||
CategoryID *int64 `json:"categoryId"`
|
||
Results []draftResultInput `json:"results"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type draftResultInput struct {
|
||
EntryID int64 `json:"entryId"`
|
||
Rank *int `json:"rank"`
|
||
ResultText *string `json:"resultText"`
|
||
ResultValue *float64 `json:"resultValue"`
|
||
Unit *string `json:"unit"`
|
||
IsTie bool `json:"isTie"`
|
||
Status string `json:"status"`
|
||
PointsOverride *float64 `json:"pointsOverride"`
|
||
Note *string `json:"note"`
|
||
}
|
||
|
||
type publishPayload struct {
|
||
EventID int64 `json:"eventId"`
|
||
CategoryID *int64 `json:"categoryId"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type voidResultPayload struct {
|
||
Reason string `json:"reason"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type adjustmentInput struct {
|
||
TeamID int64 `json:"teamId"`
|
||
Delta float64 `json:"delta"`
|
||
Category string `json:"category"`
|
||
Reason string `json:"reason"`
|
||
EventID *int64 `json:"eventId"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type recordBreakInput struct {
|
||
EventID int64 `json:"eventId"`
|
||
EntryID int64 `json:"entryId"`
|
||
Level string `json:"level"`
|
||
ResultValue float64 `json:"resultValue"`
|
||
ResultText string `json:"resultText"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
// displayCommandInput 是大屏控制指令的请求体。
|
||
type displayCommandInput struct {
|
||
Action string `json:"action"`
|
||
Payload any `json:"payload"`
|
||
// Targets 是要定向控制的大屏实例 id(GET /api/display/instances 的 id);
|
||
// 留空表示广播给所有大屏——公告这类全屏指令走的就是广播。
|
||
Targets []string `json:"targets"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type voidAdjustmentPayload struct {
|
||
Reason string `json:"reason"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type settingsPatch struct {
|
||
Event *settingsEventPatch `json:"event"`
|
||
Display *settingsDisplayPatch `json:"display"`
|
||
Standings *settingsStandingsPatch `json:"standings"`
|
||
DefaultProfileID *int64 `json:"defaultProfileId"`
|
||
RequireApproval *bool `json:"requireApproval"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type settingsEventPatch struct {
|
||
Name *string `json:"name"`
|
||
Subtitle *string `json:"subtitle"`
|
||
Host *string `json:"host"`
|
||
LogoPath *string `json:"logoPath"`
|
||
PrimaryColor *string `json:"primaryColor"`
|
||
}
|
||
|
||
type settingsDisplayPatch struct {
|
||
Background *string `json:"background"`
|
||
Logo *string `json:"logo"`
|
||
Title *string `json:"title"`
|
||
Subtitle *string `json:"subtitle"`
|
||
PrimaryColor *string `json:"primaryColor"`
|
||
RotateSeconds *float64 `json:"rotateSeconds"`
|
||
// FontTitle / FontBody 是字体 id;null 表示不改动(清空要传空串)。
|
||
FontTitle *string `json:"fontTitle"`
|
||
FontBody *string `json:"fontBody"`
|
||
}
|
||
|
||
type settingsStandingsPatch struct {
|
||
IndividualToTeamWeight *float64 `json:"individualToTeamWeight"`
|
||
RankingMode *string `json:"rankingMode"`
|
||
ShowIndividualBoard *bool `json:"showIndividualBoard"`
|
||
ShowIndividualMedals *bool `json:"showIndividualMedals"`
|
||
}
|
||
|
||
type categoriesPayload struct {
|
||
Categories []categoryDTO `json:"categories"`
|
||
}
|
||
|
||
type channelsPayload struct {
|
||
Channels []channelDTO `json:"channels"`
|
||
}
|
||
|
||
// ---------- 用户管理 ----------
|
||
|
||
type createUserInput struct {
|
||
Username string `json:"username"`
|
||
DisplayName string `json:"displayName"`
|
||
Role string `json:"role"`
|
||
Password string `json:"password"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
// updateUserInput 只带需要改的字段:nil 表示保持原值。
|
||
type updateUserInput struct {
|
||
DisplayName *string `json:"displayName"`
|
||
Role *string `json:"role"`
|
||
Active *bool `json:"active"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
// resetUserPasswordInput 的 password 留空时由服务端随机生成。
|
||
type resetUserPasswordInput struct {
|
||
Password string `json:"password"`
|
||
RequestID string `json:"requestId"`
|
||
}
|