Implement more endpoints & overhaul [2/n]

Drop LevelDB and move all the things to SQLite.

Implemented endpoints:
/api <unit, accessoryMaterialAll>
/api <unit, accessoryTab>
/live/continue
/live/partyList
/unit/favoriteAccessory (WIP)
/unit/sale

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-04-28 11:44:56 +08:00
parent 1500821f3e
commit 150ce674ad
218 changed files with 2993 additions and 2160 deletions
-16
View File
@@ -1,15 +1,11 @@
package db
import (
"fmt"
_ "modernc.org/sqlite"
"xorm.io/xorm"
)
var (
Ldb *LdbInstance
MainDb = "assets/main.db"
UserDb = "assets/data.db"
MainEng *xorm.Engine
@@ -17,8 +13,6 @@ var (
)
func init() {
Ldb = GetLdbInstance()
eng, err := xorm.NewEngine("sqlite", MainDb)
if err != nil {
panic(err)
@@ -43,13 +37,3 @@ func init() {
eng.SetMaxIdleConns(5)
UserEng = eng
}
func MatchTokenUid(token, uid string) bool {
res, err := Ldb.Get([]byte(uid))
if err != nil {
fmt.Println(err)
return false
}
return string(res) == token
}