用户给出的 8 条功能 + 一条口径变更,全部带真机/真浏览器验证:
① 录入页姓名后直接显示号码布(原「号码」列保留)
② 录入页批次进度条:`第 2 批 已录 5/8 · 3 条有错`,录完变绿;已录判据复用
entryGuards.judgeEntryRow(与发布防呆同源,不会出现"进度条说录完、发布说缺 8 条")
⑦ 小项列表双击 → 跳到该小项的组别(编辑/删除按钮不误触)
③ 赛事开关 `standings.live_on_publish`(默认开=保持原行为):关闭后分批发布只上屏成绩,
名次/流水/榜单一起等该组录完再结算 —— 代理实读代码后纠正了我的前提:
奖牌榜读的是 results.rank(buildRanked)而非流水汇总,只延迟流水会出现
「有金牌但 0 分」。另提供 POST /api/results/settle 人工兜底 + GET /api/results/settlement 未结算清单
④ 组别「就地更新」PUT /api/events/{id}/categories/{categoryId}:有报名数据时也能改名/改年龄/
改性别/改权重(旧路径是整表替换,一改就被 409 拦下);改名不动报名/成绩/流水(真机逐字节比对);
权重真的变了才触发该组重算(容差 1e-9)
④辅 运动员列表多选+全选,POST /api/athletes/batch 一次请求完成整批停用/彻底删除(逐条回报,
dryRun 预览走同一段 SQL 但不提交、不写审计)——这才是绕开限流的正解
新增 报名项批量:POST /api/entries/batch(scratch/restore/remove)。退赛只动 registered、
跳过 dq/dns 并说明原因;移出是物理删除,必须显式清 score_ledger(该表 entry_id 是
ON DELETE SET NULL,不显式删会留下"人没了分还在"的孤儿流水,验证基线 orphan=0);
退赛同时清 results.rank(否则出现"0 分还挂着金牌")
⑤ GET /api/export/entries.xlsx 报名名单导出(13 列含批次,状态中文与录入页逐字一致)
⑥ 基础数据包:GET /api/export/basedata.xlsx + POST /api/export/basedata/import
(四张表、表头只有一份定义、表头行自动定位、列缺席≠写空、按编码 upsert、绝不删除、
行级中文错误带真实 Excel 行号、枚举走既有校验、新增单位一定是启用)
⑧ 登录有效期面板可配:系统设置新页签,1–720 小时,默认 12h → 24h;滑动续期 +
Cookie 同步刷新(只服务端续期是假的,浏览器侧的 Max-Age 到点仍会丢 Cookie)
身份口径:号码布为唯一标识、证件号退出匹配(号码布不同=同名的两个人,新建并单独报告);
同一份表重复证件号不再报错;两个不同的人共用证件号仍报行级错误(唯一索引保留)
其它对齐:分项成绩表草稿行不再消失(成绩列「分数未录入」、名次/积分 `—`,没成绩的行同占位);
大屏实时赛况单栏铺满(留白 370→78px)、字号上限 56→96px、≥7 行自动拆左右两块;
删除报名项/退赛/权重等改动都会重算并推榜单。
测试:服务端 13 包(连跑两遍)、前端 335 例、vue-tsc + build、Console 18 文件 —— 全绿。
文档:README、docs/ 四份(含 debug/使用说明 副本)、devdocs 05/08/04/13。
版本号 dev_0.1.5 → dev_0.1.6。
180 lines
6.1 KiB
Go
180 lines
6.1 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"`
|
||
}
|
||
|
||
// entryHeatPayload 是批量设置批次的请求体:heat 为 null / 缺省表示清除批次(未分批)。
|
||
type entryHeatPayload struct {
|
||
EntryIDs []int64 `json:"entryIds"`
|
||
Heat *int64 `json:"heat"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
// entryBatchPayload 是报名项批量操作的请求体:
|
||
// action 决定语义(scratch 退赛可恢复 / restore 恢复 / remove 物理移出报名),
|
||
// ids 是勾选的报名项(重复会自动去重),reason 可选、只进审计便于事后对账。
|
||
type entryBatchPayload struct {
|
||
Action string `json:"action"`
|
||
IDs []int64 `json:"ids"`
|
||
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"`
|
||
// LiveEvents 是「实时赛况」人工指定的当前项目 id(最多 2 个)。
|
||
// nil 表示不改动;传 [] 表示清空人工指定。
|
||
LiveEvents *[]int64 `json:"liveEvents"`
|
||
// LiveSource 是当前项目的判定方式(manual / auto);nil 表示不改动。
|
||
LiveSource *string `json:"liveSource"`
|
||
}
|
||
|
||
type settingsStandingsPatch struct {
|
||
IndividualToTeamWeight *float64 `json:"individualToTeamWeight"`
|
||
RankingMode *string `json:"rankingMode"`
|
||
ShowIndividualBoard *bool `json:"showIndividualBoard"`
|
||
ShowIndividualMedals *bool `json:"showIndividualMedals"`
|
||
// LiveOnPublish 是「分批发布时是否实时更新各单位总分与奖牌榜」;nil 表示不改动。
|
||
LiveOnPublish *bool `json:"liveOnPublish"`
|
||
}
|
||
|
||
// sessionSettingsPatch 是 PUT /api/system/session 的请求体:
|
||
// 只改「登录有效期(小时)」这一个系统级配置。
|
||
type sessionSettingsPatch struct {
|
||
SessionHours *int `json:"sessionHours"`
|
||
RequestID string `json:"requestId"`
|
||
}
|
||
|
||
type categoriesPayload struct {
|
||
Categories []categoryDTO `json:"categories"`
|
||
}
|
||
|
||
// athletesBatchPayload 是运动员批量动作的请求体:action 决定停用还是彻底删除。
|
||
type athletesBatchPayload struct {
|
||
Action string `json:"action"`
|
||
IDs []int64 `json:"ids"`
|
||
// DryRun 只统计不改库:前端用它先看清「会删掉多少、重算哪些小项」再确认。
|
||
DryRun bool `json:"dryRun"`
|
||
}
|
||
|
||
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"`
|
||
}
|