From 4664847f101c73cec6d0490e44c72d300f5a997c Mon Sep 17 00:00:00 2001 From: Sean Du Date: Tue, 28 Apr 2026 20:25:42 +0800 Subject: [PATCH] Minor cleanup and fixes Signed-off-by: Sean Du --- .gitignore | 1 + README.md | 2 +- assets/.gitignore | 3 +++ internal/handler/webui/upload.go | 4 ++-- internal/model/ghome/devicekey.go | 4 ++++ internal/model/login/authkey.go | 4 ++++ internal/model/user/useraccessorywear.go | 2 +- internal/model/user/userdeck.go | 2 +- internal/model/user/userdeckunit.go | 2 +- internal/model/user/userlivegoal.go | 4 ++++ internal/model/user/userliveinprogress.go | 4 ++++ internal/model/user/userliverecord.go | 4 ++++ internal/model/user/userunitdata.go | 4 ++++ internal/session/session.go | 4 +++- internal/startup/defaultuser.go | 1 - main.go | 1 + 16 files changed, 38 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6b262b6..ca4e993 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ config.json data temp +.codex .idea .vscode diff --git a/README.md b/README.md index 038e557..7b4644f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ LoveLive! 学园偶像祭 自用私服。 详见 `doc` 目录。 ## 视频教程 - - [合集·SIF、AS 私服(本地服)搭建教程](https://space.bilibili.com/671443/channel/collectiondetail?sid=2148053) + - [合集·SIF、AS 私服(本地服)搭建教程](https://space.bilibili.com/671443/lists/2148053) ## 特别感谢 diff --git a/assets/.gitignore b/assets/.gitignore index d634ecb..c82c5d9 100644 --- a/assets/.gitignore +++ b/assets/.gitignore @@ -1,2 +1,5 @@ data.db +data.db-shm +data.db-wal + load.db diff --git a/internal/handler/webui/upload.go b/internal/handler/webui/upload.go index f63afa6..e830e3e 100644 --- a/internal/handler/webui/upload.go +++ b/internal/handler/webui/upload.go @@ -34,8 +34,8 @@ func upload(ctx *gin.Context) { return } - lines := strings.Split(content, "\n") - for _, rawLine := range lines { + lines := strings.SplitSeq(content, "\n") + for rawLine := range lines { line := strings.TrimSpace(rawLine) if line == "" { continue diff --git a/internal/model/ghome/devicekey.go b/internal/model/ghome/devicekey.go index e3c4c4c..187b655 100644 --- a/internal/model/ghome/devicekey.go +++ b/internal/model/ghome/devicekey.go @@ -5,3 +5,7 @@ type DeviceKey struct { DeviceID string `xorm:"device_id"` RandKey string `xorm:"rand_key"` } + +func (DeviceKey) TableName() string { + return "device_key" +} diff --git a/internal/model/login/authkey.go b/internal/model/login/authkey.go index 64310be..58eb812 100644 --- a/internal/model/login/authkey.go +++ b/internal/model/login/authkey.go @@ -7,3 +7,7 @@ type AuthKey struct { ServerToken string `xorm:"server_token"` InsertDate string `xorm:"insert_date"` } + +func (AuthKey) TableName() string { + return "auth_key" +} diff --git a/internal/model/user/useraccessorywear.go b/internal/model/user/useraccessorywear.go index 8a2f74b..38fc36a 100644 --- a/internal/model/user/useraccessorywear.go +++ b/internal/model/user/useraccessorywear.go @@ -7,6 +7,6 @@ type UserAccessoryWear struct { UserID int `xorm:"user_id"` } -func (u *UserAccessoryWear) TableName() string { +func (UserAccessoryWear) TableName() string { return "user_accessory_wear" } diff --git a/internal/model/user/userdeck.go b/internal/model/user/userdeck.go index 058442b..4e77970 100644 --- a/internal/model/user/userdeck.go +++ b/internal/model/user/userdeck.go @@ -9,6 +9,6 @@ type UserDeck struct { InsertDate int64 `xorm:"insert_date"` } -func (u *UserDeck) TableName() string { +func (UserDeck) TableName() string { return "user_deck" } diff --git a/internal/model/user/userdeckunit.go b/internal/model/user/userdeckunit.go index 8f6e027..6950c49 100644 --- a/internal/model/user/userdeckunit.go +++ b/internal/model/user/userdeckunit.go @@ -21,6 +21,6 @@ type UserDeckUnit struct { InsertDate int64 `xorm:"insert_date"` } -func (u *UserDeckUnit) TableName() string { +func (UserDeckUnit) TableName() string { return "user_deck_unit" } diff --git a/internal/model/user/userlivegoal.go b/internal/model/user/userlivegoal.go index 39b13b3..f11814b 100644 --- a/internal/model/user/userlivegoal.go +++ b/internal/model/user/userlivegoal.go @@ -9,3 +9,7 @@ type UserLiveGoal struct { GoalType constant.LiveGoalType `xorm:"goal_type"` CompletedAt int64 `xorm:"completed_at"` } + +func (UserLiveGoal) TableName() string { + return "user_live_goal" +} diff --git a/internal/model/user/userliveinprogress.go b/internal/model/user/userliveinprogress.go index 06b57b7..2cfa9af 100644 --- a/internal/model/user/userliveinprogress.go +++ b/internal/model/user/userliveinprogress.go @@ -5,3 +5,7 @@ type UserLiveInProgress struct { DeckID int `xorm:"deck_id"` UserID int `xorm:"user_id"` } + +func (UserLiveInProgress) TableName() string { + return "user_live_in_progress" +} diff --git a/internal/model/user/userliverecord.go b/internal/model/user/userliverecord.go index 23b78fa..f66a6e0 100644 --- a/internal/model/user/userliverecord.go +++ b/internal/model/user/userliverecord.go @@ -23,6 +23,10 @@ type UserLiveRecord struct { UpdateDate string `xorm:"insert_date"` } +func (UserLiveRecord) TableName() string { + return "user_live_record" +} + // TODO: 转移到 schema 下 type NotesList struct { TimingSec float64 `json:"timing_sec"` diff --git a/internal/model/user/userunitdata.go b/internal/model/user/userunitdata.go index aad8458..358f1eb 100644 --- a/internal/model/user/userunitdata.go +++ b/internal/model/user/userunitdata.go @@ -8,3 +8,7 @@ type UserUnitData struct { UserID int `xorm:"user_id"` InsertDate int64 `xorm:"insert_date"` } + +func (UserUnitData) TableName() string { + return "user_unit_data" +} diff --git a/internal/session/session.go b/internal/session/session.go index 194fd2b..5e51559 100644 --- a/internal/session/session.go +++ b/internal/session/session.go @@ -6,6 +6,7 @@ import ( "honoka-chan/internal/utils" "honoka-chan/pkg/db" "log" + "net/http" "github.com/gin-gonic/gin" "xorm.io/xorm" @@ -75,6 +76,7 @@ func (ss *Session) Respond(resp any) { return } + ss.Ctx.Header("Content-Type", "application/json") ss.Ctx.Header("X-Message-Sign", utils.GenXMS(data)) - ss.Ctx.String(200, string(data)) + ss.Ctx.String(http.StatusOK, string(data)) } diff --git a/internal/startup/defaultuser.go b/internal/startup/defaultuser.go index 33482a5..d43d843 100644 --- a/internal/startup/defaultuser.go +++ b/internal/startup/defaultuser.go @@ -22,5 +22,4 @@ func CreateDefaultUser() { log.Printf("默认用户创建成功, 账号: %s, 密码: %s\n", defaultPhone, defaultPassword) return } - log.Printf("默认用户已存在, 账号: %s\n", defaultPhone) } diff --git a/main.go b/main.go index 867b038..0b5c879 100644 --- a/main.go +++ b/main.go @@ -45,6 +45,7 @@ func main() { "/agreement/all", "/integration/appReport/initialize", "/report/ge/app", + "/v1/account/reportRole", }, }))