@@ -1,13 +1,23 @@
|
||||
package item
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/pkg/utils"
|
||||
itemapischema "honoka-chan/internal/schema/api/item"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
func itemList() (res any, err error) {
|
||||
itemResp := utils.ReadAllText("assets/serverdata/item.json")
|
||||
err = json.Unmarshal([]byte(itemResp), &res)
|
||||
itemData, err := honokautils.LoadServerData[itemapischema.ListData]("item_data.json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = itemapischema.ListResp{
|
||||
Result: itemData,
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ func loginTopInfo(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
now := time.Now()
|
||||
|
||||
friendsRequestCnt64, err := ss.UserEng.Table(new(usermodel.UserFriend)).
|
||||
friendsRequestCnt, err := ss.UserEng.Table(new(usermodel.UserFriend)).
|
||||
Where("user_id = ?", ss.UserID).
|
||||
Where("status = ?", usermodel.FriendStatusAwaitingApproval).
|
||||
Where("is_new = ?", true).
|
||||
@@ -22,7 +22,7 @@ func loginTopInfo(ctx *gin.Context) (res any, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
friendsApprovalWaitCnt64, err := ss.UserEng.Table(new(usermodel.UserFriend)).
|
||||
friendsApprovalWaitCnt, err := ss.UserEng.Table(new(usermodel.UserFriend)).
|
||||
Where("user_id = ?", ss.UserID).
|
||||
Where("status = ?", usermodel.FriendStatusPending).
|
||||
Count()
|
||||
@@ -30,7 +30,7 @@ func loginTopInfo(ctx *gin.Context) (res any, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
friendGreetCnt64, err := ss.UserEng.Table(new(usermodel.UserGreet)).
|
||||
friendGreetCnt, err := ss.UserEng.Table(new(usermodel.UserGreet)).
|
||||
Where("receiver_id = ?", ss.UserID).
|
||||
Where("deleted_from_receiver = ?", false).
|
||||
Where("readed = ?", false).
|
||||
@@ -39,10 +39,6 @@ func loginTopInfo(ctx *gin.Context) (res any, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
friendsRequestCnt := int(friendsRequestCnt64)
|
||||
friendsApprovalWaitCnt := int(friendsApprovalWaitCnt64)
|
||||
friendGreetCnt := int(friendGreetCnt64)
|
||||
|
||||
res = loginapischema.TopInfoResp{
|
||||
Result: loginapischema.TopInfoData{
|
||||
FriendActionCnt: friendGreetCnt,
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package profile
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
"honoka-chan/pkg/utils"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
func cardRanking() (res any, err error) {
|
||||
var result []any
|
||||
love := utils.ReadAllText("assets/serverdata/love.json")
|
||||
err = json.Unmarshal([]byte(love), &result)
|
||||
cardRankingData, err := honokautils.LoadServerData[[]profileapischema.CardRankingData]("card_ranking_data.json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = profileapischema.CardRankingResp{
|
||||
Result: result,
|
||||
Result: cardRankingData,
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
|
||||
@@ -72,7 +72,7 @@ func profileInfo(ctx *gin.Context, targetUserID int) (res any, err error) {
|
||||
UnitMax: 5000,
|
||||
EnergyMax: targetPref.EffectiveEnergyMax(),
|
||||
FriendMax: 99,
|
||||
UnitCnt: int(unitCount),
|
||||
UnitCnt: unitCount,
|
||||
InviteCode: targetPref.InviteCode,
|
||||
ElapsedTimeFromLogin: formatProfileElapsedTime(lastLoginTime),
|
||||
Introduction: targetPref.UserDesc,
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
package stamp
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/pkg/utils"
|
||||
stampapischema "honoka-chan/internal/schema/api/stamp"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
func stampInfo() (res any, err error) {
|
||||
stampResp := utils.ReadAllText("assets/serverdata/stamp.json")
|
||||
err = json.Unmarshal([]byte(stampResp), &res)
|
||||
stampData, err := honokautils.LoadServerData[stampapischema.InfoData]("stamp_data.json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = stampapischema.InfoResp{
|
||||
Result: stampData,
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/pkg/utils"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
func unitAccessoryTab() (res any, err error) {
|
||||
data := utils.ReadAllText("assets/serverdata/accessoryTab.json")
|
||||
resp := unitapischema.AccessoryTabResp{}
|
||||
err = json.Unmarshal([]byte(data), &resp)
|
||||
tabList, err := honokautils.LoadServerData[[]unitapischema.TabList]("accessory_tab_list.json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.TimeStamp = time.Now().Unix()
|
||||
|
||||
return resp, err
|
||||
res = unitapischema.AccessoryTabResp{
|
||||
Result: unitapischema.AccessoryTabData{
|
||||
TabList: tabList,
|
||||
},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package eventscenario
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
eventscenarioschema "honoka-chan/internal/schema/eventscenario"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func startup(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
startReq := eventscenarioschema.StartUpReq{}
|
||||
err := honokautils.ParseRequestData(ctx, &startReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(eventscenarioschema.StartUpResp{
|
||||
ResponseData: eventscenarioschema.StartUpData{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("main.php", "POST", "/eventscenario/startup", middleware.Common, startup)
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func list(ctx *gin.Context) {
|
||||
|
||||
ss.Respond(friendschema.ListResp{
|
||||
ResponseData: friendschema.ListData{
|
||||
ItemCount: int(totalCount),
|
||||
ItemCount: totalCount,
|
||||
FriendList: friendList,
|
||||
NewFriendList: []any{},
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -96,7 +96,7 @@ func search(ctx *gin.Context) {
|
||||
UnitMax: 5000,
|
||||
EnergyMax: positiveIntOrDefault(row.EnergyMax, usermodel.DefaultUserEnergyMax),
|
||||
FriendMax: 99,
|
||||
UnitCnt: int(unitCount),
|
||||
UnitCnt: unitCount,
|
||||
ElapsedTimeFromLogin: formatElapsedTime(row.LastLoginTime),
|
||||
Comment: row.UserDesc,
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
_ "honoka-chan/internal/handler/background"
|
||||
_ "honoka-chan/internal/handler/download"
|
||||
_ "honoka-chan/internal/handler/event"
|
||||
_ "honoka-chan/internal/handler/eventscenario"
|
||||
_ "honoka-chan/internal/handler/friend"
|
||||
_ "honoka-chan/internal/handler/gdpr"
|
||||
_ "honoka-chan/internal/handler/ghome"
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/constant"
|
||||
"honoka-chan/internal/middleware"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
commonschema "honoka-chan/internal/schema/common"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
liverecordschema "honoka-chan/internal/schema/liverecord"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"honoka-chan/pkg/utils"
|
||||
@@ -173,7 +173,7 @@ func preciseScore(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// DeckInfo
|
||||
var deckInfo usermodel.DeckInfo
|
||||
var deckInfo liverecordschema.DeckInfo
|
||||
err = json.Unmarshal([]byte(record.DeckInfoJSON), &deckInfo)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
|
||||
@@ -25,11 +25,10 @@ func reward(ctx *gin.Context) {
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
// fmt.Println(ctx.MustGet("request_data").(string))
|
||||
|
||||
difficultyID := playRewardReq.LiveDifficultyID
|
||||
_, liveInfo := ss.GetLiveInfo(difficultyID)
|
||||
_, progress := ss.GetLiveInProgress() // TODO: 添加返回指定状态码的方法
|
||||
_, progress := ss.GetLiveInProgress()
|
||||
_, deckInfo := ss.GetDeckInfo(progress.DeckID)
|
||||
deckInfo.LiveDifficultyID = difficultyID
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ func userGreetingHistory(ctx *gin.Context) {
|
||||
|
||||
ss.Respond(noticeschema.UserGreetingResp{
|
||||
ResponseData: noticeschema.UserGreetingData{
|
||||
ItemCount: int(totalCount),
|
||||
ItemCount: totalCount,
|
||||
HasNext: totalCount > int64(len(rows)),
|
||||
NoticeList: noticeList,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package scenario
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/session"
|
||||
"honoka-chan/pkg/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func reward(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
data := utils.ReadAllText("assets/serverdata/reward.json")
|
||||
var resp map[string]any
|
||||
err := json.Unmarshal([]byte(data), &resp)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(resp)
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("main.php", "POST", "/scenario/reward", middleware.Common, reward)
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package subscenario
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/session"
|
||||
"honoka-chan/pkg/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func reward(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
data := utils.ReadAllText("assets/serverdata/subreward.json")
|
||||
var resp map[string]any
|
||||
err := json.Unmarshal([]byte(data), &resp)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(resp)
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("main.php", "POST", "/subscenario/reward", middleware.Common, reward)
|
||||
}
|
||||
@@ -1,70 +1,69 @@
|
||||
package unitmodel
|
||||
|
||||
type CommonUnitData struct {
|
||||
ID int `xorm:"id pk autoincr" json:"-"`
|
||||
UnitNumber int `xorm:"unit_number" json:"-"`
|
||||
UnitID int `xorm:"unit_id" json:"unit_id"`
|
||||
UnitTypeID int `xorm:"unit_type_id" json:"unit_type_id"`
|
||||
Name string `xorm:"name" json:"name"`
|
||||
Eponym string `xorm:"eponym" json:"eponym"`
|
||||
Rarity int `xorm:"rarity" json:"rarity"`
|
||||
Attribute int `xorm:"attribute" json:"attribute"`
|
||||
Smile int `xorm:"smile" json:"smile"`
|
||||
Cute int `xorm:"cute" json:"cute"`
|
||||
Cool int `xorm:"cool" json:"cool"`
|
||||
Exp int `xorm:"exp" json:"exp"`
|
||||
Level int `xorm:"level" json:"level"`
|
||||
MaxLevel int `xorm:"max_level" json:"max_level"`
|
||||
LevelLimitID int `xorm:"level_limit_id" json:"level_limit_id"`
|
||||
Rank int `xorm:"rank" json:"rank"`
|
||||
MaxRank int `xorm:"max_rank" json:"max_rank"`
|
||||
Love int `xorm:"love" json:"love"`
|
||||
MaxLove int `xorm:"max_love" json:"max_love"`
|
||||
UnitSkillExp int `xorm:"unit_skill_exp" json:"unit_skill_exp"`
|
||||
UnitSkillLevel int `xorm:"unit_skill_level" json:"unit_skill_level"`
|
||||
MaxHp int `xorm:"max_hp" json:"max_hp"`
|
||||
UnitRemovableSkillCapacity int `xorm:"unit_removable_skill_capacity" json:"unit_removable_skill_capacity"`
|
||||
IsRankMax bool `xorm:"is_rank_max" json:"is_rank_max"`
|
||||
IsLoveMax bool `xorm:"is_love_max" json:"is_love_max"`
|
||||
IsLevelMax bool `xorm:"is_level_max" json:"is_level_max"`
|
||||
IsSigned bool `xorm:"is_signed" json:"is_signed"`
|
||||
IsSkillLevelMax bool `xorm:"is_skill_level_max" json:"is_skill_level_max"`
|
||||
IsRemovableSkillCapacityMax bool `xorm:"is_removable_skill_capacity_max" json:"is_removable_skill_capacity_max"`
|
||||
InsertDate int64 `xorm:"insert_date" json:"insert_date"`
|
||||
ID int `xorm:"id pk autoincr"`
|
||||
UnitNumber int `xorm:"unit_number"`
|
||||
UnitID int `xorm:"unit_id"`
|
||||
UnitTypeID int `xorm:"unit_type_id"`
|
||||
Name string `xorm:"name"`
|
||||
Eponym string `xorm:"eponym"`
|
||||
Rarity int `xorm:"rarity"`
|
||||
Attribute int `xorm:"attribute"`
|
||||
Smile int `xorm:"smile"`
|
||||
Cute int `xorm:"cute"`
|
||||
Cool int `xorm:"cool"`
|
||||
Exp int `xorm:"exp"`
|
||||
Level int `xorm:"level"`
|
||||
MaxLevel int `xorm:"max_level"`
|
||||
LevelLimitID int `xorm:"level_limit_id"`
|
||||
Rank int `xorm:"rank"`
|
||||
MaxRank int `xorm:"max_rank"`
|
||||
Love int `xorm:"love"`
|
||||
MaxLove int `xorm:"max_love"`
|
||||
UnitSkillExp int `xorm:"unit_skill_exp"`
|
||||
UnitSkillLevel int `xorm:"unit_skill_level"`
|
||||
MaxHp int `xorm:"max_hp"`
|
||||
UnitRemovableSkillCapacity int `xorm:"unit_removable_skill_capacity"`
|
||||
IsRankMax bool `xorm:"is_rank_max"`
|
||||
IsLoveMax bool `xorm:"is_love_max"`
|
||||
IsLevelMax bool `xorm:"is_level_max"`
|
||||
IsSigned bool `xorm:"is_signed"`
|
||||
IsSkillLevelMax bool `xorm:"is_skill_level_max"`
|
||||
IsRemovableSkillCapacityMax bool `xorm:"is_removable_skill_capacity_max"`
|
||||
InsertDate int64 `xorm:"insert_date"`
|
||||
}
|
||||
|
||||
type UnitDataMap struct {
|
||||
UnitOwningUserID int `xorm:"unit_owning_user_id pk autoincr"`
|
||||
FavoriteFlag bool `xorm:"favorite_flag"`
|
||||
DisplayRank int `xorm:"display_rank"`
|
||||
|
||||
ID int `xorm:"id pk autoincr" json:"-"`
|
||||
UnitID int `xorm:"unit_id" json:"unit_id"`
|
||||
UnitTypeID int `xorm:"unit_type_id" json:"unit_type_id"`
|
||||
Name string `xorm:"name" json:"name"`
|
||||
Eponym string `xorm:"eponym" json:"eponym"`
|
||||
Rarity int `xorm:"rarity" json:"rarity"`
|
||||
Attribute int `xorm:"attribute" json:"attribute"`
|
||||
Smile int `xorm:"smile" json:"smile"`
|
||||
Cute int `xorm:"cute" json:"cute"`
|
||||
Cool int `xorm:"cool" json:"cool"`
|
||||
Exp int `xorm:"exp" json:"exp"`
|
||||
Level int `xorm:"level" json:"level"`
|
||||
MaxLevel int `xorm:"max_level" json:"max_level"`
|
||||
LevelLimitID int `xorm:"level_limit_id" json:"level_limit_id"`
|
||||
Rank int `xorm:"rank" json:"rank"`
|
||||
MaxRank int `xorm:"max_rank" json:"max_rank"`
|
||||
Love int `xorm:"love" json:"love"`
|
||||
MaxLove int `xorm:"max_love" json:"max_love"`
|
||||
UnitSkillExp int `xorm:"unit_skill_exp" json:"unit_skill_exp"`
|
||||
UnitSkillLevel int `xorm:"unit_skill_level" json:"unit_skill_level"`
|
||||
MaxHp int `xorm:"max_hp" json:"max_hp"`
|
||||
UnitRemovableSkillCapacity int `xorm:"unit_removable_skill_capacity" json:"unit_removable_skill_capacity"`
|
||||
IsRankMax bool `xorm:"is_rank_max" json:"is_rank_max"`
|
||||
IsLoveMax bool `xorm:"is_love_max" json:"is_love_max"`
|
||||
IsLevelMax bool `xorm:"is_level_max" json:"is_level_max"`
|
||||
IsSigned bool `xorm:"is_signed" json:"is_signed"`
|
||||
IsSkillLevelMax bool `xorm:"is_skill_level_max" json:"is_skill_level_max"`
|
||||
IsRemovableSkillCapacityMax bool `xorm:"is_removable_skill_capacity_max" json:"is_removable_skill_capacity_max"`
|
||||
InsertDate int64 `xorm:"insert_date" json:"insert_date"`
|
||||
ID int `xorm:"id pk autoincr"`
|
||||
UnitOwningUserID int `xorm:"unit_owning_user_id pk autoincr"`
|
||||
UnitID int `xorm:"unit_id"`
|
||||
UnitTypeID int `xorm:"unit_type_id"`
|
||||
Name string `xorm:"name"`
|
||||
Eponym string `xorm:"eponym"`
|
||||
Rarity int `xorm:"rarity"`
|
||||
Attribute int `xorm:"attribute"`
|
||||
Smile int `xorm:"smile"`
|
||||
Cute int `xorm:"cute"`
|
||||
Cool int `xorm:"cool"`
|
||||
Exp int `xorm:"exp"`
|
||||
Level int `xorm:"level"`
|
||||
MaxLevel int `xorm:"max_level"`
|
||||
LevelLimitID int `xorm:"level_limit_id"`
|
||||
Rank int `xorm:"rank"`
|
||||
MaxRank int `xorm:"max_rank"`
|
||||
DisplayRank int `xorm:"display_rank"`
|
||||
Love int `xorm:"love"`
|
||||
MaxLove int `xorm:"max_love"`
|
||||
UnitSkillExp int `xorm:"unit_skill_exp"`
|
||||
UnitSkillLevel int `xorm:"unit_skill_level"`
|
||||
MaxHp int `xorm:"max_hp"`
|
||||
UnitRemovableSkillCapacity int `xorm:"unit_removable_skill_capacity"`
|
||||
IsRankMax bool `xorm:"is_rank_max"`
|
||||
IsLoveMax bool `xorm:"is_love_max"`
|
||||
IsLevelMax bool `xorm:"is_level_max"`
|
||||
IsSigned bool `xorm:"is_signed"`
|
||||
IsSkillLevelMax bool `xorm:"is_skill_level_max"`
|
||||
IsRemovableSkillCapacityMax bool `xorm:"is_removable_skill_capacity_max"`
|
||||
FavoriteFlag bool `xorm:"favorite_flag"`
|
||||
InsertDate int64 `xorm:"insert_date"`
|
||||
}
|
||||
|
||||
@@ -26,123 +26,3 @@ type UserLiveRecord struct {
|
||||
func (UserLiveRecord) TableName() string {
|
||||
return "user_live_record"
|
||||
}
|
||||
|
||||
// TODO: 转移到 schema 下
|
||||
type NotesList struct {
|
||||
TimingSec float64 `json:"timing_sec"`
|
||||
NotesAttribute int `json:"notes_attribute"`
|
||||
NotesLevel int `json:"notes_level"`
|
||||
Effect int `json:"effect"`
|
||||
EffectValue int `json:"effect_value"`
|
||||
Position int `json:"position"`
|
||||
}
|
||||
|
||||
type LiveInfo struct {
|
||||
LiveDifficultyID int `json:"live_difficulty_id"`
|
||||
IsRandom bool `json:"is_random"`
|
||||
AcFlag int `json:"ac_flag"`
|
||||
SwingFlag int `json:"swing_flag"`
|
||||
NotesList []NotesList `json:"notes_list"`
|
||||
}
|
||||
|
||||
// TODO: 转移到 schema 下
|
||||
type PreciseList struct {
|
||||
Count int `json:"count"`
|
||||
Effect int `json:"effect"`
|
||||
Accuracy int `json:"accuracy"`
|
||||
Tap float64 `json:"tap"`
|
||||
IsSame bool `json:"is_same"`
|
||||
Release any `json:"release"`
|
||||
Position int `json:"position"`
|
||||
NoteNumber int `json:"note_number"`
|
||||
FirstTouch any `json:"first_touch"`
|
||||
Tp bool `json:"tp"`
|
||||
Tpf any `json:"tpf"`
|
||||
}
|
||||
|
||||
// TODO: 转移到 schema 下
|
||||
type TotalStatus struct {
|
||||
Hp int `json:"hp"`
|
||||
Smile int `json:"smile"`
|
||||
Cute int `json:"cute"`
|
||||
Cool int `json:"cool"`
|
||||
}
|
||||
|
||||
type CenterBonus struct {
|
||||
Hp int `json:"hp"`
|
||||
Smile int `json:"smile"`
|
||||
Cute int `json:"cute"`
|
||||
Cool int `json:"cool"`
|
||||
}
|
||||
|
||||
type SiBonus struct {
|
||||
Hp int `json:"hp"`
|
||||
Smile int `json:"smile"`
|
||||
Cute int `json:"cute"`
|
||||
Cool int `json:"cool"`
|
||||
}
|
||||
|
||||
type AccessoryInfo struct {
|
||||
AccessoryOwningUserID int `json:"accessory_owning_user_id"`
|
||||
AccessoryID int `json:"accessory_id"`
|
||||
Exp int `json:"exp"`
|
||||
NextExp int `json:"next_exp"`
|
||||
Level int `json:"level"`
|
||||
MaxLevel int `json:"max_level"`
|
||||
RankUpCount int `json:"rank_up_count"`
|
||||
FavoriteFlag bool `json:"favorite_flag"`
|
||||
}
|
||||
|
||||
type UnitList struct {
|
||||
UnitID int `json:"unit_id"`
|
||||
Position int `json:"position"`
|
||||
Level int `json:"level"`
|
||||
LevelLimitID int `json:"level_limit_id"`
|
||||
DisplayRank int `json:"display_rank"`
|
||||
Love int `json:"love"`
|
||||
UnitSkillLevel int `json:"unit_skill_level"`
|
||||
IsRankMax bool `json:"is_rank_max"`
|
||||
IsLoveMax bool `json:"is_love_max"`
|
||||
IsLevelMax bool `json:"is_level_max"`
|
||||
IsSigned bool `json:"is_signed"`
|
||||
Rank int `json:"rank"`
|
||||
MaxHp int `json:"max_hp"`
|
||||
UnitRemovableSkillCapacity int `json:"unit_removable_skill_capacity"`
|
||||
RemovableSkillIds []int `json:"removable_skill_ids"`
|
||||
TotalStatus TotalStatus `json:"total_status"`
|
||||
SiBonus SiBonus `json:"si_bonus"`
|
||||
AccessoryInfo *AccessoryInfo `json:"accessory_info,omitempty"`
|
||||
}
|
||||
|
||||
type DeckInfo struct {
|
||||
LiveDifficultyID int `json:"live_difficulty_id"`
|
||||
TotalStatus TotalStatus `json:"total_status"`
|
||||
CenterBonus CenterBonus `json:"center_bonus"`
|
||||
SiBonus SiBonus `json:"si_bonus"`
|
||||
UnitList []UnitList `json:"unit_list"`
|
||||
}
|
||||
|
||||
// TODO: 转移到 schema 下
|
||||
type Icon struct {
|
||||
NormalID int `json:"normal_id"`
|
||||
JustID int `json:"just_id"`
|
||||
SlideID int `json:"slide_id"`
|
||||
}
|
||||
|
||||
type LiveSetting struct {
|
||||
NotesSpeed float64 `json:"notes_speed"`
|
||||
CutinBrightness int `json:"cutin_brightness"`
|
||||
CutinType int `json:"cutin_type"`
|
||||
EffectFlag bool `json:"effect_flag"`
|
||||
StringSize int `json:"string_size"`
|
||||
SeID int `json:"se_id"`
|
||||
Icon Icon `json:"icon"`
|
||||
BackgroundID int `json:"background_id"`
|
||||
RandomValue int `json:"random_value"`
|
||||
}
|
||||
|
||||
// TODO: 转移到 schema 下
|
||||
type TriggerLog struct {
|
||||
Position int `json:"position"`
|
||||
ActivationRate int `json:"activation_rate"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package itemapischema
|
||||
|
||||
type GeneralItemList struct {
|
||||
ItemID int `json:"item_id"`
|
||||
Amount int `json:"amount"`
|
||||
UseButtonFlag bool `json:"use_button_flag"`
|
||||
GeneralItemType int `json:"general_item_type"`
|
||||
}
|
||||
|
||||
type BuffItemList struct {
|
||||
ItemID int `json:"item_id"`
|
||||
Amount int `json:"amount"`
|
||||
BuffType int `json:"buff_type"`
|
||||
}
|
||||
|
||||
type ListData struct {
|
||||
GeneralItemList []GeneralItemList `json:"general_item_list"`
|
||||
BuffItemList []BuffItemList `json:"buff_item_list"`
|
||||
}
|
||||
|
||||
type ListResp struct {
|
||||
Result ListData `json:"result"`
|
||||
Status int `json:"status"`
|
||||
CommandNum bool `json:"commandNum"`
|
||||
TimeStamp int64 `json:"timeStamp"`
|
||||
}
|
||||
@@ -8,18 +8,18 @@ type LicenseInfo struct {
|
||||
}
|
||||
|
||||
type TopInfoData struct {
|
||||
FriendActionCnt int `json:"friend_action_cnt"`
|
||||
FriendGreetCnt int `json:"friend_greet_cnt"`
|
||||
FriendVarietyCnt int `json:"friend_variety_cnt"`
|
||||
FriendNewCnt int `json:"friend_new_cnt"`
|
||||
PresentCnt int `json:"present_cnt"`
|
||||
FriendActionCnt int64 `json:"friend_action_cnt"`
|
||||
FriendGreetCnt int64 `json:"friend_greet_cnt"`
|
||||
FriendVarietyCnt int64 `json:"friend_variety_cnt"`
|
||||
FriendNewCnt int64 `json:"friend_new_cnt"`
|
||||
PresentCnt int64 `json:"present_cnt"`
|
||||
SecretBoxBadgeFlag bool `json:"secret_box_badge_flag"`
|
||||
ServerDatetime string `json:"server_datetime"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
NoticeFriendDatetime string `json:"notice_friend_datetime"`
|
||||
NoticeMailDatetime string `json:"notice_mail_datetime"`
|
||||
FriendsApprovalWaitCnt int `json:"friends_approval_wait_cnt"`
|
||||
FriendsRequestCnt int `json:"friends_request_cnt"`
|
||||
FriendsApprovalWaitCnt int64 `json:"friends_approval_wait_cnt"`
|
||||
FriendsRequestCnt int64 `json:"friends_request_cnt"`
|
||||
IsTodayBirthday bool `json:"is_today_birthday"`
|
||||
LicenseInfo LicenseInfo `json:"license_info"`
|
||||
UsingBuffInfo []any `json:"using_buff_info"`
|
||||
|
||||
@@ -8,8 +8,8 @@ type CardRankingData struct {
|
||||
}
|
||||
|
||||
type CardRankingResp struct {
|
||||
Result any `json:"result"`
|
||||
Status int `json:"status"`
|
||||
CommandNum bool `json:"commandNum"`
|
||||
TimeStamp int64 `json:"timeStamp"`
|
||||
Result []CardRankingData `json:"result"`
|
||||
Status int `json:"status"`
|
||||
CommandNum bool `json:"commandNum"`
|
||||
TimeStamp int64 `json:"timeStamp"`
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ type UserInfo struct {
|
||||
UnitMax int `json:"unit_max"`
|
||||
EnergyMax int `json:"energy_max"`
|
||||
FriendMax int `json:"friend_max"`
|
||||
UnitCnt int `json:"unit_cnt"`
|
||||
UnitCnt int64 `json:"unit_cnt"`
|
||||
InviteCode string `json:"invite_code"`
|
||||
ElapsedTimeFromLogin string `json:"elapsed_time_from_login"`
|
||||
Introduction string `json:"introduction"`
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package stampapischema
|
||||
|
||||
type StampList struct {
|
||||
Position int `json:"position"`
|
||||
StampID int `json:"stamp_id"`
|
||||
}
|
||||
|
||||
type SettingList struct {
|
||||
StampSettingID int `json:"stamp_setting_id"`
|
||||
MainFlag int `json:"main_flag"`
|
||||
StampList []StampList `json:"stamp_list"`
|
||||
}
|
||||
|
||||
type StampSetting struct {
|
||||
StampType int `json:"stamp_type"`
|
||||
SettingList []SettingList `json:"setting_list"`
|
||||
}
|
||||
|
||||
type InfoData struct {
|
||||
OwningStampIds []int `json:"owning_stamp_ids"`
|
||||
StampSetting []StampSetting `json:"stamp_setting"`
|
||||
}
|
||||
|
||||
type InfoResp struct {
|
||||
Result InfoData `json:"result"`
|
||||
Status int `json:"status"`
|
||||
CommandNum bool `json:"commandNum"`
|
||||
TimeStamp int64 `json:"timeStamp"`
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package eventscenarioschema
|
||||
|
||||
type StartUpReq struct {
|
||||
Module string `json:"module"`
|
||||
EventScenarioID int `json:"event_scenario_id"`
|
||||
Action string `json:"action"`
|
||||
TimeStamp int `json:"timeStamp"`
|
||||
Mgd int `json:"mgd"`
|
||||
CommandNum string `json:"commandNum"`
|
||||
}
|
||||
|
||||
type EventScenarioList struct {
|
||||
EventID int `json:"event_id"`
|
||||
Progress int `json:"progress"`
|
||||
Status int `json:"status"`
|
||||
EventScenarioID int `json:"event_scenario_id"`
|
||||
}
|
||||
|
||||
type StartUpData struct {
|
||||
EventScenarioList EventScenarioList `json:"event_scenario_list"`
|
||||
ScenarioAdjustment int `json:"scenario_adjustment"`
|
||||
}
|
||||
|
||||
type StartUpResp struct {
|
||||
ResponseData StartUpData `json:"response_data"`
|
||||
ReleaseInfo []any `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
@@ -71,7 +71,7 @@ type FriendList struct {
|
||||
}
|
||||
|
||||
type ListData struct {
|
||||
ItemCount int `json:"item_count"`
|
||||
ItemCount int64 `json:"item_count"`
|
||||
FriendList []FriendList `json:"friend_list"`
|
||||
NewFriendList []any `json:"new_friend_list"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
|
||||
@@ -17,7 +17,7 @@ type SearchUserInfo struct {
|
||||
UnitMax int `json:"unit_max"`
|
||||
EnergyMax int `json:"energy_max"`
|
||||
FriendMax int `json:"friend_max"`
|
||||
UnitCnt int `json:"unit_cnt"`
|
||||
UnitCnt int64 `json:"unit_cnt"`
|
||||
ElapsedTimeFromLogin string `json:"elapsed_time_from_login"`
|
||||
Comment string `json:"comment"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package liverecordschema
|
||||
|
||||
type TotalStatus struct {
|
||||
Hp int `json:"hp"`
|
||||
Smile int `json:"smile"`
|
||||
Cute int `json:"cute"`
|
||||
Cool int `json:"cool"`
|
||||
}
|
||||
|
||||
type CenterBonus struct {
|
||||
Hp int `json:"hp"`
|
||||
Smile int `json:"smile"`
|
||||
Cute int `json:"cute"`
|
||||
Cool int `json:"cool"`
|
||||
}
|
||||
|
||||
type SiBonus struct {
|
||||
Hp int `json:"hp"`
|
||||
Smile int `json:"smile"`
|
||||
Cute int `json:"cute"`
|
||||
Cool int `json:"cool"`
|
||||
}
|
||||
|
||||
type AccessoryInfo struct {
|
||||
AccessoryOwningUserID int `json:"accessory_owning_user_id"`
|
||||
AccessoryID int `json:"accessory_id"`
|
||||
Exp int `json:"exp"`
|
||||
NextExp int `json:"next_exp"`
|
||||
Level int `json:"level"`
|
||||
MaxLevel int `json:"max_level"`
|
||||
RankUpCount int `json:"rank_up_count"`
|
||||
FavoriteFlag bool `json:"favorite_flag"`
|
||||
}
|
||||
|
||||
type UnitList struct {
|
||||
UnitID int `json:"unit_id"`
|
||||
Position int `json:"position"`
|
||||
Level int `json:"level"`
|
||||
LevelLimitID int `json:"level_limit_id"`
|
||||
DisplayRank int `json:"display_rank"`
|
||||
Love int `json:"love"`
|
||||
UnitSkillLevel int `json:"unit_skill_level"`
|
||||
IsRankMax bool `json:"is_rank_max"`
|
||||
IsLoveMax bool `json:"is_love_max"`
|
||||
IsLevelMax bool `json:"is_level_max"`
|
||||
IsSigned bool `json:"is_signed"`
|
||||
Rank int `json:"rank"`
|
||||
MaxHp int `json:"max_hp"`
|
||||
UnitRemovableSkillCapacity int `json:"unit_removable_skill_capacity"`
|
||||
RemovableSkillIds []int `json:"removable_skill_ids"`
|
||||
TotalStatus TotalStatus `json:"total_status"`
|
||||
SiBonus SiBonus `json:"si_bonus"`
|
||||
AccessoryInfo *AccessoryInfo `json:"accessory_info,omitempty"`
|
||||
}
|
||||
|
||||
type DeckInfo struct {
|
||||
LiveDifficultyID int `json:"live_difficulty_id"`
|
||||
TotalStatus TotalStatus `json:"total_status"`
|
||||
CenterBonus CenterBonus `json:"center_bonus"`
|
||||
SiBonus SiBonus `json:"si_bonus"`
|
||||
UnitList []UnitList `json:"unit_list"`
|
||||
}
|
||||
|
||||
type Icon struct {
|
||||
NormalID int `json:"normal_id"`
|
||||
JustID int `json:"just_id"`
|
||||
SlideID int `json:"slide_id"`
|
||||
}
|
||||
|
||||
type LiveSetting struct {
|
||||
NotesSpeed float64 `json:"notes_speed"`
|
||||
CutinBrightness int `json:"cutin_brightness"`
|
||||
CutinType int `json:"cutin_type"`
|
||||
EffectFlag bool `json:"effect_flag"`
|
||||
StringSize int `json:"string_size"`
|
||||
SeID int `json:"se_id"`
|
||||
Icon Icon `json:"icon"`
|
||||
BackgroundID int `json:"background_id"`
|
||||
RandomValue int `json:"random_value"`
|
||||
}
|
||||
|
||||
type TriggerLog struct {
|
||||
Position int `json:"position"`
|
||||
ActivationRate int `json:"activation_rate"`
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package noticeschema
|
||||
|
||||
type UserGreetingData struct {
|
||||
ItemCount int `json:"item_count"`
|
||||
ItemCount int64 `json:"item_count"`
|
||||
HasNext bool `json:"has_next"`
|
||||
NoticeList []UserGreetingNotice `json:"notice_list"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package session
|
||||
import (
|
||||
accessorymodel "honoka-chan/internal/model/accessory"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
liverecordschema "honoka-chan/internal/schema/liverecord"
|
||||
)
|
||||
|
||||
func (ss *Session) GetUserAccessoryWearByUnitOwningUserID(unitOwningUserID int) (bool, *usermodel.UserAccessoryWear) {
|
||||
@@ -29,7 +30,7 @@ func (ss *Session) GetAccessoryByAccessoryOwningUserID(accessoryOwningUserID int
|
||||
return has, &accessoryData
|
||||
}
|
||||
|
||||
func (ss *Session) GetUserAccessoryInfoByUnitOwningUserID(unitOwningUserID int) (bool, *usermodel.AccessoryInfo) {
|
||||
func (ss *Session) GetUserAccessoryInfoByUnitOwningUserID(unitOwningUserID int) (bool, *liverecordschema.AccessoryInfo) {
|
||||
has, wearData := ss.GetUserAccessoryWearByUnitOwningUserID(unitOwningUserID)
|
||||
if !has {
|
||||
return false, nil
|
||||
@@ -40,7 +41,7 @@ func (ss *Session) GetUserAccessoryInfoByUnitOwningUserID(unitOwningUserID int)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return has, &usermodel.AccessoryInfo{
|
||||
return has, &liverecordschema.AccessoryInfo{
|
||||
AccessoryOwningUserID: wearData.AccessoryOwningUserID,
|
||||
AccessoryID: accessoryData.AccessoryID,
|
||||
Exp: accessoryData.Exp,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"honoka-chan/internal/constant"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
liverecordschema "honoka-chan/internal/schema/liverecord"
|
||||
)
|
||||
|
||||
// Move from LevelDB to SQLite
|
||||
@@ -110,14 +111,14 @@ func (ss *Session) GetLiveInfo(LiveDifficultyID int) (bool, *liveschema.LiveInfo
|
||||
}
|
||||
}
|
||||
|
||||
func (ss *Session) GetDeckInfo(deckID int) (bool, *usermodel.DeckInfo) {
|
||||
func (ss *Session) GetDeckInfo(deckID int) (bool, *liverecordschema.DeckInfo) {
|
||||
// 卡片信息
|
||||
totalHp, totalSmile, totalCute, totalCool := 0, 0, 0, 0
|
||||
unitData := []usermodel.UnitList{}
|
||||
unitData := []liverecordschema.UnitList{}
|
||||
units := ss.GetUserDeckUnit(deckID)
|
||||
for _, u := range units {
|
||||
_, uData := ss.GetUnitInfo(u.UnitID)
|
||||
tempUnitData := usermodel.UnitList{
|
||||
tempUnitData := liverecordschema.UnitList{
|
||||
UnitID: u.UnitID,
|
||||
Position: u.Position,
|
||||
Level: u.Level,
|
||||
@@ -132,13 +133,13 @@ func (ss *Session) GetDeckInfo(deckID int) (bool, *usermodel.DeckInfo) {
|
||||
Rank: uData.Rank,
|
||||
MaxHp: uData.MaxHp,
|
||||
UnitRemovableSkillCapacity: uData.UnitRemovableSkillCapacity,
|
||||
TotalStatus: usermodel.TotalStatus{
|
||||
TotalStatus: liverecordschema.TotalStatus{
|
||||
Hp: uData.MaxHp,
|
||||
Smile: uData.Smile,
|
||||
Cute: uData.Cute,
|
||||
Cool: uData.Cool,
|
||||
},
|
||||
SiBonus: usermodel.SiBonus{
|
||||
SiBonus: liverecordschema.SiBonus{
|
||||
Hp: 0,
|
||||
Smile: 0,
|
||||
Cute: 0,
|
||||
@@ -165,20 +166,20 @@ func (ss *Session) GetDeckInfo(deckID int) (bool, *usermodel.DeckInfo) {
|
||||
unitData = append(unitData, tempUnitData)
|
||||
}
|
||||
|
||||
return true, &usermodel.DeckInfo{
|
||||
TotalStatus: usermodel.TotalStatus{
|
||||
return true, &liverecordschema.DeckInfo{
|
||||
TotalStatus: liverecordschema.TotalStatus{
|
||||
Hp: totalHp,
|
||||
Smile: totalSmile,
|
||||
Cute: totalCute,
|
||||
Cool: totalCool,
|
||||
},
|
||||
CenterBonus: usermodel.CenterBonus{ // TODO: 计算C位加成
|
||||
CenterBonus: liverecordschema.CenterBonus{ // TODO: 计算C位加成
|
||||
Hp: 0,
|
||||
Smile: 0,
|
||||
Cute: 0,
|
||||
Cool: 0,
|
||||
},
|
||||
SiBonus: usermodel.SiBonus{
|
||||
SiBonus: liverecordschema.SiBonus{
|
||||
Hp: 0,
|
||||
Smile: 0,
|
||||
Cute: 0,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/pkg/utils"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const serverDataPath = "assets/serverdata"
|
||||
|
||||
func LoadServerData[T any](fileName string) (T, error) {
|
||||
var data T
|
||||
filePath := filepath.Join(serverDataPath, fileName)
|
||||
err := json.Unmarshal([]byte(utils.ReadAllText(filePath)), &data)
|
||||
return data, err
|
||||
}
|
||||
Reference in New Issue
Block a user