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:
@@ -1,7 +1,7 @@
|
||||
package album
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/album"
|
||||
albumapischema "honoka-chan/internal/schema/api/album"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
func albumAll(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
albumLists := []album.UnitList{}
|
||||
albumLists := []albumapischema.UnitList{}
|
||||
var unitList []struct {
|
||||
UnitId int `xorm:"unit_id"`
|
||||
Rarity int `xorm:"rarity"`
|
||||
@@ -22,7 +22,7 @@ func albumAll(ctx *gin.Context) (res any, err error) {
|
||||
}
|
||||
|
||||
for _, unit := range unitList {
|
||||
albumList := album.UnitList{
|
||||
albumList := albumapischema.UnitList{
|
||||
RankMaxFlag: true,
|
||||
LoveMaxFlag: true,
|
||||
RankLevelMaxFlag: true,
|
||||
@@ -59,7 +59,7 @@ func albumAll(ctx *gin.Context) (res any, err error) {
|
||||
albumLists = append(albumLists, albumList)
|
||||
}
|
||||
|
||||
res = album.AllResp{
|
||||
res = albumapischema.AllResp{
|
||||
Result: albumLists,
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package award
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/award"
|
||||
awardapischema "honoka-chan/internal/schema/api/award"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -23,21 +23,21 @@ func awardInfo(ctx *gin.Context) (res any, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
awardsList := []award.Info{}
|
||||
awardsList := []awardapischema.Info{}
|
||||
for _, id := range awardList {
|
||||
isSet := false
|
||||
if id == awardID {
|
||||
isSet = true
|
||||
}
|
||||
awardsList = append(awardsList, award.Info{
|
||||
awardsList = append(awardsList, awardapischema.Info{
|
||||
AwardID: id,
|
||||
IsSet: isSet,
|
||||
InsertDate: time.Now().Format("2006-01-02 03:04:05"),
|
||||
InsertDate: "2023-03-20 03:58:55",
|
||||
})
|
||||
}
|
||||
|
||||
res = award.InfoResp{
|
||||
Result: award.InfoData{
|
||||
res = awardapischema.InfoResp{
|
||||
Result: awardapischema.InfoData{
|
||||
AwardInfo: awardsList,
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package background
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/background"
|
||||
backgroundapischema "honoka-chan/internal/schema/api/background"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -23,21 +23,21 @@ func backgroundInfo(ctx *gin.Context) (res any, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
backgroundsList := []background.Info{}
|
||||
backgroundsList := []backgroundapischema.Info{}
|
||||
for _, id := range backgroundList {
|
||||
isSet := false
|
||||
if id == backgroundID {
|
||||
isSet = true
|
||||
}
|
||||
backgroundsList = append(backgroundsList, background.Info{
|
||||
backgroundsList = append(backgroundsList, backgroundapischema.Info{
|
||||
BackgroundID: id,
|
||||
IsSet: isSet,
|
||||
InsertDate: time.Now().Format("2006-01-02 03:04:05"),
|
||||
InsertDate: "2023-03-20 03:58:55",
|
||||
})
|
||||
}
|
||||
|
||||
res = background.InfoResp{
|
||||
Result: background.InfoData{
|
||||
res = backgroundapischema.InfoResp{
|
||||
Result: backgroundapischema.InfoData{
|
||||
BackgroundInfo: backgroundsList,
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package banner
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/banner"
|
||||
bannerapischema "honoka-chan/internal/schema/api/banner"
|
||||
"time"
|
||||
)
|
||||
|
||||
func bannerList() (res any, err error) {
|
||||
res = banner.ListResp{
|
||||
Result: banner.ListData{
|
||||
res = bannerapischema.ListResp{
|
||||
Result: bannerapischema.ListData{
|
||||
TimeLimit: "2037-12-31 23:59:59",
|
||||
BannerList: []banner.BannerList{
|
||||
BannerList: []bannerapischema.BannerList{
|
||||
{
|
||||
BannerType: 1,
|
||||
TargetID: 1743,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package challenge
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/challenge"
|
||||
challengeapischema "honoka-chan/internal/schema/api/challenge"
|
||||
"time"
|
||||
)
|
||||
|
||||
func challengeInfo() (res any, err error) {
|
||||
res = challenge.InfoResp{
|
||||
res = challengeapischema.InfoResp{
|
||||
Result: []any{},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package costume
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/costume"
|
||||
costumeapischema "honoka-chan/internal/schema/api/costume"
|
||||
"time"
|
||||
)
|
||||
|
||||
func costumeList() (res any, err error) {
|
||||
res = costume.ListResp{
|
||||
Result: costume.ListData{
|
||||
CostumeList: []costume.CostumeList{},
|
||||
res = costumeapischema.ListResp{
|
||||
Result: costumeapischema.ListData{
|
||||
CostumeList: []costumeapischema.CostumeList{},
|
||||
},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -2,7 +2,7 @@ package eventscenario
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"honoka-chan/internal/schema/api/eventscenario"
|
||||
eventscenarioapischema "honoka-chan/internal/schema/api/eventscenario"
|
||||
"honoka-chan/internal/session"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -14,7 +14,7 @@ func eventScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var eventID []int
|
||||
eventsList := []eventscenario.EventScenarioList{}
|
||||
eventsList := []eventscenarioapischema.EventScenarioList{}
|
||||
err = ss.MainEng.Table("event_scenario_m").Cols("event_id").GroupBy("event_id").OrderBy("event_id DESC").Find(&eventID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -27,7 +27,7 @@ func eventScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
ChapterAsset string `xorm:"chapter_asset"`
|
||||
OpenDate string `xorm:"open_date"`
|
||||
}
|
||||
chapsList := []eventscenario.ChapterList{}
|
||||
chapsList := []eventscenarioapischema.ChapterList{}
|
||||
err = ss.MainEng.Table("event_scenario_m").Where("event_id = ?", id).Cols("event_scenario_id,chapter,chapter_asset,open_date").
|
||||
OrderBy("chapter DESC").Find(&eventRes)
|
||||
if ss.CheckErr(err) {
|
||||
@@ -35,7 +35,7 @@ func eventScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
}
|
||||
|
||||
for _, res := range eventRes {
|
||||
chapList := eventscenario.ChapterList{
|
||||
chapList := eventscenarioapischema.ChapterList{
|
||||
EventScenarioID: res.EventScenarioId,
|
||||
Chapter: res.Chapter,
|
||||
ChapterAsset: res.ChapterAsset,
|
||||
@@ -49,7 +49,7 @@ func eventScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
chapsList = append(chapsList, chapList)
|
||||
}
|
||||
|
||||
event := eventscenario.EventScenarioList{
|
||||
event := eventscenarioapischema.EventScenarioList{
|
||||
EventID: id,
|
||||
OpenDate: strings.ReplaceAll(eventRes[0].OpenDate, "/", "-"),
|
||||
ChapterList: chapsList,
|
||||
@@ -67,8 +67,8 @@ func eventScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
|
||||
eventsList = append(eventsList, event)
|
||||
}
|
||||
res = eventscenario.StatusResp{
|
||||
Result: eventscenario.StatusData{
|
||||
res = eventscenarioapischema.StatusResp{
|
||||
Result: eventscenarioapischema.StatusData{
|
||||
EventScenarioList: eventsList,
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exchange
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/exchange"
|
||||
exchangeapischema "honoka-chan/internal/schema/api/exchange"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -12,20 +12,20 @@ func owningPoint(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var exchangeID []int
|
||||
exPointsList := []exchange.ExchangePointList{}
|
||||
exPointsList := []exchangeapischema.ExchangePointList{}
|
||||
err = ss.MainEng.Table("exchange_point_m").Cols("exchange_point_id").OrderBy("exchange_point_id ASC").Find(&exchangeID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
for _, id := range exchangeID {
|
||||
exPointsList = append(exPointsList, exchange.ExchangePointList{
|
||||
exPointsList = append(exPointsList, exchangeapischema.ExchangePointList{
|
||||
Rarity: id,
|
||||
ExchangePoint: 9999,
|
||||
})
|
||||
}
|
||||
res = exchange.OwningPointResp{
|
||||
Result: exchange.OwningPointData{
|
||||
res = exchangeapischema.OwningPointResp{
|
||||
Result: exchangeapischema.OwningPointData{
|
||||
ExchangePointList: exPointsList,
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package live
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/live"
|
||||
liveapischema "honoka-chan/internal/schema/api/live"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -11,42 +11,32 @@ import (
|
||||
func liveSchedule(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var liveDifficultyID []int
|
||||
specialLives := []live.SpecialLiveStatusList{}
|
||||
err = ss.MainEng.Table("special_live_m").Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveDifficultyID)
|
||||
var liveID []int
|
||||
err = ss.MainEng.Table("special_live_m").
|
||||
Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
for _, id := range liveDifficultyID {
|
||||
specialLive := live.SpecialLiveStatusList{
|
||||
LiveDifficultyID: id,
|
||||
Status: 1,
|
||||
HiScore: 0,
|
||||
HiComboCount: 0,
|
||||
ClearCnt: 0,
|
||||
AchievedGoalIDList: []int{},
|
||||
}
|
||||
specialLives = append(specialLives, specialLive)
|
||||
}
|
||||
|
||||
livesList := []live.LiveList{}
|
||||
for _, v := range specialLives {
|
||||
livesList = append(livesList, live.LiveList{
|
||||
LiveDifficultyID: v.LiveDifficultyID,
|
||||
liveList := []liveapischema.LiveList{}
|
||||
for _, id := range liveID {
|
||||
liveList = append(liveList, liveapischema.LiveList{
|
||||
LiveDifficultyID: id,
|
||||
StartDate: "2023-01-01 00:00:00",
|
||||
EndDate: "2037-01-01 00:00:00",
|
||||
IsRandom: false,
|
||||
})
|
||||
}
|
||||
res = live.ScheduleResp{
|
||||
Result: live.ScheduleData{
|
||||
|
||||
res = liveapischema.ScheduleResp{
|
||||
Result: liveapischema.ScheduleData{
|
||||
EventList: []any{},
|
||||
LiveList: livesList,
|
||||
LiveList: liveList,
|
||||
LimitedBonusList: []any{},
|
||||
LimitedBonusCommonList: []live.LimitedBonusCommonList{}, // 特效道具
|
||||
RandomLiveList: []live.RandomLiveList{}, // 随机歌曲
|
||||
LimitedBonusCommonList: []liveapischema.LimitedBonusCommonList{},
|
||||
RandomLiveList: []liveapischema.RandomLiveList{},
|
||||
FreeLiveList: []any{},
|
||||
TrainingLiveList: []live.TrainingLiveList{}, // 挑战歌曲
|
||||
TrainingLiveList: []liveapischema.TrainingLiveList{},
|
||||
},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package live
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/live"
|
||||
liveapischema "honoka-chan/internal/schema/api/live"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -12,13 +12,13 @@ func liveStatus(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var liveDifficultyID []int
|
||||
normalLives := []live.NormalLiveStatusList{}
|
||||
normalLives := []liveapischema.NormalLiveStatusList{}
|
||||
err = ss.MainEng.Table("normal_live_m").Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveDifficultyID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
for _, id := range liveDifficultyID {
|
||||
normalLive := live.NormalLiveStatusList{
|
||||
normalLive := liveapischema.NormalLiveStatusList{
|
||||
LiveDifficultyID: id,
|
||||
Status: 1,
|
||||
HiScore: 0,
|
||||
@@ -29,13 +29,13 @@ func liveStatus(ctx *gin.Context) (res any, err error) {
|
||||
normalLives = append(normalLives, normalLive)
|
||||
}
|
||||
|
||||
specialLives := []live.SpecialLiveStatusList{}
|
||||
specialLives := []liveapischema.SpecialLiveStatusList{}
|
||||
err = ss.MainEng.Table("special_live_m").Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveDifficultyID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
for _, id := range liveDifficultyID {
|
||||
specialLive := live.SpecialLiveStatusList{
|
||||
specialLive := liveapischema.SpecialLiveStatusList{
|
||||
LiveDifficultyID: id,
|
||||
Status: 1,
|
||||
HiScore: 0,
|
||||
@@ -46,11 +46,11 @@ func liveStatus(ctx *gin.Context) (res any, err error) {
|
||||
specialLives = append(specialLives, specialLive)
|
||||
}
|
||||
|
||||
res = live.StatusResp{
|
||||
Result: live.StatusData{
|
||||
res = liveapischema.StatusResp{
|
||||
Result: liveapischema.StatusData{
|
||||
NormalLiveStatusList: normalLives,
|
||||
SpecialLiveStatusList: specialLives,
|
||||
TrainingLiveStatusList: []live.TrainingLiveStatusList{},
|
||||
TrainingLiveStatusList: []liveapischema.TrainingLiveStatusList{},
|
||||
MarathonLiveStatusList: []any{},
|
||||
FreeLiveStatusList: []any{},
|
||||
CanResumeLive: false,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package liveicon
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/liveicon"
|
||||
liveiconapischema "honoka-chan/internal/schema/api/liveicon"
|
||||
"time"
|
||||
)
|
||||
|
||||
func liveIconInfo() (res any, err error) {
|
||||
res = liveicon.InfoResp{
|
||||
Result: liveicon.InfoData{
|
||||
res = liveiconapischema.InfoResp{
|
||||
Result: liveiconapischema.InfoData{
|
||||
LiveNotesIconList: []int{1, 2, 3},
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package livese
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/livese"
|
||||
liveseapischema "honoka-chan/internal/schema/api/livese"
|
||||
"time"
|
||||
)
|
||||
|
||||
func LiveSeInfo() (res any, err error) {
|
||||
res = livese.InfoResp{
|
||||
Result: livese.InfoData{
|
||||
res = liveseapischema.InfoResp{
|
||||
Result: liveseapischema.InfoData{
|
||||
LiveSeList: []int{1, 2, 3},
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package login
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/login"
|
||||
loginapischema "honoka-chan/internal/schema/api/login"
|
||||
"time"
|
||||
)
|
||||
|
||||
func loginTopInfo() (res any, err error) {
|
||||
res = login.TopInfoResp{
|
||||
Result: login.TopInfoData{
|
||||
res = loginapischema.TopInfoResp{
|
||||
Result: loginapischema.TopInfoData{
|
||||
FriendActionCnt: 0,
|
||||
FriendGreetCnt: 0,
|
||||
FriendVarietyCnt: 0,
|
||||
@@ -21,7 +21,7 @@ func loginTopInfo() (res any, err error) {
|
||||
FriendsApprovalWaitCnt: 0,
|
||||
FriendsRequestCnt: 0,
|
||||
IsTodayBirthday: false,
|
||||
LicenseInfo: login.LicenseInfo{
|
||||
LicenseInfo: loginapischema.LicenseInfo{
|
||||
LicenseList: []any{},
|
||||
LicensedInfo: []any{},
|
||||
ExpiredInfo: []any{},
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package login
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/login"
|
||||
loginapischema "honoka-chan/internal/schema/api/login"
|
||||
"time"
|
||||
)
|
||||
|
||||
func loginTopInfoOnce() (res any, err error) {
|
||||
res = login.TopInfoOnceResp{
|
||||
Result: login.TopInfoOnceData{
|
||||
res = loginapischema.TopInfoOnceResp{
|
||||
Result: loginapischema.TopInfoOnceData{
|
||||
NewAchievementCnt: 0,
|
||||
UnaccomplishedAchievementCnt: 0,
|
||||
LiveDailyRewardExist: false,
|
||||
TrainingEnergy: 10,
|
||||
TrainingEnergyMax: 10,
|
||||
Notification: login.Notification{
|
||||
Notification: loginapischema.Notification{
|
||||
Push: false,
|
||||
Lp: false,
|
||||
UpdateInfo: false,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package marathon
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/marathon"
|
||||
marathonapischema "honoka-chan/internal/schema/api/marathon"
|
||||
"time"
|
||||
)
|
||||
|
||||
func marathonInfo() (res any, err error) {
|
||||
res = marathon.InfoResp{
|
||||
res = marathonapischema.InfoResp{
|
||||
Result: []any{},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package multiunit
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/multiunit"
|
||||
multiunitapischema "honoka-chan/internal/schema/api/multiunit"
|
||||
"honoka-chan/internal/session"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -13,7 +13,7 @@ func MultiUnitScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var statusID []int
|
||||
multiUnitsList := []multiunit.StatusList{}
|
||||
multiUnitsList := []multiunitapischema.StatusList{}
|
||||
err = ss.MainEng.Table("multi_unit_scenario_m").Cols("multi_unit_id").GroupBy("multi_unit_id").OrderBy("multi_unit_id ASC").Find(&statusID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -34,12 +34,12 @@ func MultiUnitScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
multiUnitsList = append(multiUnitsList, multiunit.StatusList{
|
||||
multiUnitsList = append(multiUnitsList, multiunitapischema.StatusList{
|
||||
MultiUnitID: id,
|
||||
Status: 2,
|
||||
MultiUnitScenarioBtnAsset: multiRes.MultiUnitScenarioBtnAsset,
|
||||
OpenDate: strings.ReplaceAll(multiRes.OpenDate, "/", "-"),
|
||||
ChapterList: []multiunit.ChapterList{
|
||||
ChapterList: []multiunitapischema.ChapterList{
|
||||
{
|
||||
MultiUnitScenarioID: multiRes.MultiUnitScenarioId,
|
||||
Chapter: multiRes.Chapter,
|
||||
@@ -48,8 +48,8 @@ func MultiUnitScenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
},
|
||||
})
|
||||
}
|
||||
res = multiunit.StatusResp{
|
||||
Result: multiunit.StatusData{
|
||||
res = multiunitapischema.StatusResp{
|
||||
Result: multiunitapischema.StatusData{
|
||||
MultiUnitScenarioStatusList: multiUnitsList,
|
||||
UnlockedMultiUnitScenarioIds: []any{},
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package museum
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/museum"
|
||||
museumapischema "honoka-chan/internal/schema/api/museum"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -31,10 +31,10 @@ func museumInfo(ctx *gin.Context) (res any, err error) {
|
||||
coolBuff += res.CoolBuff
|
||||
museumID = append(museumID, res.MuseumContentsId)
|
||||
}
|
||||
res = museum.InfoResp{
|
||||
Result: museum.InfoData{
|
||||
MuseumInfo: museum.Info{
|
||||
Parameter: museum.Parameter{
|
||||
res = museumapischema.InfoResp{
|
||||
Result: museumapischema.InfoData{
|
||||
MuseumInfo: museumapischema.Info{
|
||||
Parameter: museumapischema.Parameter{
|
||||
Smile: smileBuff,
|
||||
Pure: pureBuff,
|
||||
Cool: coolBuff,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package navigation
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/navigation"
|
||||
navigationapischema "honoka-chan/internal/schema/api/navigation"
|
||||
"time"
|
||||
)
|
||||
|
||||
func SpecialCutin() (res any, err error) {
|
||||
res = navigation.SpecialCutinResp{
|
||||
Result: navigation.SpecialCutinData{
|
||||
res = navigationapischema.SpecialCutinResp{
|
||||
Result: navigationapischema.SpecialCutinData{
|
||||
SpecialCutinList: []any{},
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package notice
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/notice"
|
||||
noticeapischema "honoka-chan/internal/schema/api/notice"
|
||||
"time"
|
||||
)
|
||||
|
||||
func noticeMarquee() (res any, err error) {
|
||||
res = notice.MarqueeResp{
|
||||
Result: notice.MarqueeData{
|
||||
res = noticeapischema.MarqueeResp{
|
||||
Result: noticeapischema.MarqueeData{
|
||||
ItemCount: 0,
|
||||
MarqueeList: []any{},
|
||||
},
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
package payment
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/payment"
|
||||
paymentapischema "honoka-chan/internal/schema/api/payment"
|
||||
"time"
|
||||
)
|
||||
|
||||
func productList() (res any, err error) {
|
||||
res = payment.ProductListResp{
|
||||
Result: payment.ProductListData{
|
||||
RestrictionInfo: payment.RestrictionInfo{
|
||||
res = paymentapischema.ProductListResp{
|
||||
Result: paymentapischema.ProductListData{
|
||||
RestrictionInfo: paymentapischema.RestrictionInfo{
|
||||
Restricted: false,
|
||||
},
|
||||
UnderAgeInfo: payment.UnderAgeInfo{
|
||||
UnderAgeInfo: paymentapischema.UnderAgeInfo{
|
||||
BirthSet: false,
|
||||
HasLimit: false,
|
||||
LimitAmount: nil,
|
||||
MonthUsed: 0,
|
||||
},
|
||||
SnsProductList: []payment.SnsProduct{},
|
||||
ProductList: []payment.Product{},
|
||||
SubscriptionList: []payment.Subscription{},
|
||||
SnsProductList: []paymentapischema.SnsProduct{},
|
||||
ProductList: []paymentapischema.Product{},
|
||||
SubscriptionList: []paymentapischema.Subscription{},
|
||||
ShowPointShop: false,
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -2,7 +2,7 @@ package profile
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/schema/api/profile"
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"time"
|
||||
)
|
||||
@@ -15,7 +15,7 @@ func cardRanking() (res any, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = profile.CardRankingResp{
|
||||
res = profileapischema.CardRankingResp{
|
||||
Result: result,
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package profile
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/schema/api/profile"
|
||||
unitmodel "honoka-chan/internal/model/unit"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -12,57 +13,25 @@ import (
|
||||
func profileInfo(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
pref := user.UserPref{}
|
||||
pref := usermodel.UserPref{}
|
||||
_, err = ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Get(&pref)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
commonUnit, err := ss.MainEng.Table("common_unit_m").Count()
|
||||
unitCount, err := ss.UserEng.Table(new(usermodel.UserUnitData)).
|
||||
Where("user_id = ?", ss.UserID).Count()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
userUnit, err := ss.UserEng.Table("user_unit").Where("user_id = ?", ss.UserID).Count()
|
||||
unitData := unitmodel.UnitDataMap{}
|
||||
_, err = ss.GetBasicUnitInfo().
|
||||
Where("a.unit_owning_user_id = ?", pref.UnitOwningUserID).Get(&unitData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
unitData := profile.UnitData{}
|
||||
exists, err := ss.MainEng.Table("common_unit_m").Where("unit_owning_user_id = ?", pref.UnitOwningUserID).Get(&unitData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
isCommon := true
|
||||
if !exists {
|
||||
_, err = ss.UserEng.Table("user_unit").
|
||||
Where("unit_owning_user_id = ? AND user_id = ?", pref.UnitOwningUserID, ss.UserID).Get(&unitData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
isCommon = false
|
||||
}
|
||||
|
||||
var attrId, maxHp, baseSmile, basePure, baseCool int
|
||||
var smileMax, pureMax, coolMax int
|
||||
if isCommon {
|
||||
// 公共卡片仅为100级属性
|
||||
_, err = ss.MainEng.Table("unit_m").Where("unit_id = ?", unitData.UnitID).
|
||||
Cols("attribute_id,hp_max,smile_max,pure_max,cool_max").Get(&attrId, &maxHp, &baseSmile, &basePure, &baseCool)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 偷懒起见不计算饰品、宝石、回忆画廊等属性加成
|
||||
smileMax = baseSmile
|
||||
pureMax = basePure
|
||||
coolMax = baseCool
|
||||
// } else {
|
||||
// // 用户卡片需要根据等级计算属性
|
||||
// // TODO
|
||||
}
|
||||
|
||||
var accessoryOwningId, accessoryId, exp int
|
||||
_, err = ss.UserEng.Table("user_accessory_wear").Where("unit_owning_user_id = ? AND user_id = ?", pref.UnitOwningUserID, ss.UserID).
|
||||
Cols("accessory_owning_user_id").Get(&accessoryOwningId)
|
||||
@@ -74,7 +43,7 @@ func profileInfo(ctx *gin.Context) (res any, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
accessoryInfo := profile.AccessoryInfo{
|
||||
accessoryInfo := profileapischema.AccessoryInfo{
|
||||
AccessoryOwningUserID: accessoryOwningId,
|
||||
AccessoryID: accessoryId,
|
||||
Exp: exp,
|
||||
@@ -92,9 +61,9 @@ func profileInfo(ctx *gin.Context) (res any, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = profile.InfoResp{
|
||||
Result: profile.InfoData{
|
||||
UserInfo: profile.UserInfo{
|
||||
res = profileapischema.InfoResp{
|
||||
Result: profileapischema.InfoData{
|
||||
UserInfo: profileapischema.UserInfo{
|
||||
UserID: pref.UserID,
|
||||
Name: pref.UserName,
|
||||
Level: pref.UserLevel,
|
||||
@@ -102,16 +71,17 @@ func profileInfo(ctx *gin.Context) (res any, err error) {
|
||||
UnitMax: 5000,
|
||||
EnergyMax: 417,
|
||||
FriendMax: 99,
|
||||
UnitCnt: int(commonUnit + userUnit),
|
||||
UnitCnt: int(unitCount),
|
||||
InviteCode: pref.InviteCode,
|
||||
ElapsedTimeFromLogin: "14\u5c0f\u65f6\u524d",
|
||||
Introduction: pref.UserDesc,
|
||||
},
|
||||
CenterUnitInfo: profile.CenterUnitInfo{
|
||||
// TODO: 区分队伍中心卡片和看板卡片
|
||||
CenterUnitInfo: profileapischema.CenterUnitInfo{
|
||||
UnitOwningUserID: unitData.UnitOwningUserID,
|
||||
UnitID: unitData.UnitID,
|
||||
Exp: unitData.Exp,
|
||||
NextExp: unitData.NextExp,
|
||||
NextExp: 0,
|
||||
Level: unitData.Level,
|
||||
LevelLimitID: unitData.LevelLimitID,
|
||||
MaxLevel: unitData.MaxLevel,
|
||||
@@ -125,10 +95,10 @@ func profileInfo(ctx *gin.Context) (res any, err error) {
|
||||
DisplayRank: unitData.DisplayRank,
|
||||
UnitSkillExp: unitData.UnitSkillExp,
|
||||
UnitRemovableSkillCapacity: unitData.UnitRemovableSkillCapacity,
|
||||
Attribute: attrId,
|
||||
Smile: baseSmile,
|
||||
Cute: basePure,
|
||||
Cool: baseCool,
|
||||
Attribute: unitData.Attribute,
|
||||
Smile: unitData.Smile,
|
||||
Cute: unitData.Cute,
|
||||
Cool: unitData.Cool,
|
||||
IsLoveMax: unitData.IsLoveMax,
|
||||
IsLevelMax: unitData.IsLevelMax,
|
||||
IsRankMax: unitData.IsRankMax,
|
||||
@@ -137,17 +107,17 @@ func profileInfo(ctx *gin.Context) (res any, err error) {
|
||||
SettingAwardID: pref.AwardID,
|
||||
RemovableSkillIds: removeSkillIds,
|
||||
AccessoryInfo: accessoryInfo,
|
||||
Costume: profile.Costume{},
|
||||
TotalSmile: smileMax,
|
||||
TotalCute: pureMax,
|
||||
TotalCool: coolMax,
|
||||
TotalHp: maxHp,
|
||||
Costume: profileapischema.Costume{},
|
||||
TotalSmile: unitData.Smile, // TODO: 加成计算
|
||||
TotalCute: unitData.Cute, // 同上
|
||||
TotalCool: unitData.Cool, // 同上
|
||||
TotalHp: unitData.MaxHp,
|
||||
},
|
||||
NaviUnitInfo: profile.NaviUnitInfo{
|
||||
NaviUnitInfo: profileapischema.NaviUnitInfo{
|
||||
UnitOwningUserID: unitData.UnitOwningUserID,
|
||||
UnitID: unitData.UnitID,
|
||||
Exp: unitData.Exp,
|
||||
NextExp: unitData.NextExp,
|
||||
NextExp: 0,
|
||||
Level: unitData.Level,
|
||||
MaxLevel: unitData.MaxLevel,
|
||||
LevelLimitID: unitData.LevelLimitID,
|
||||
@@ -168,10 +138,10 @@ func profileInfo(ctx *gin.Context) (res any, err error) {
|
||||
IsSkillLevelMax: unitData.IsSkillLevelMax,
|
||||
IsRemovableSkillCapacityMax: unitData.IsRemovableSkillCapacityMax,
|
||||
InsertDate: "2016-10-11 10:33:03",
|
||||
TotalSmile: smileMax,
|
||||
TotalCute: pureMax,
|
||||
TotalCool: coolMax,
|
||||
TotalHp: maxHp,
|
||||
TotalSmile: unitData.Smile, // TODO: 加成计算
|
||||
TotalCute: unitData.Cute, // 同上
|
||||
TotalCool: unitData.Cool, // 同上
|
||||
TotalHp: unitData.MaxHp,
|
||||
RemovableSkillIds: removeSkillIds,
|
||||
},
|
||||
IsAlliance: false,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package profile
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/profile"
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
"time"
|
||||
)
|
||||
|
||||
func liveCnt() (res any, err error) {
|
||||
res = profile.LiveCntResp{
|
||||
Result: []profile.LiveCntData{
|
||||
res = profileapischema.LiveCntResp{
|
||||
Result: []profileapischema.LiveCntData{
|
||||
{
|
||||
Difficulty: 1,
|
||||
ClearCnt: 315,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package scenario
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/scenario"
|
||||
scenarioapischema "honoka-chan/internal/schema/api/scenario"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -12,20 +12,20 @@ func scenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var scenarioID []int
|
||||
scenarioLists := []scenario.StatusList{}
|
||||
scenarioLists := []scenarioapischema.StatusList{}
|
||||
err = ss.MainEng.Table("scenario_m").Cols("scenario_id").OrderBy("scenario_id ASC").Find(&scenarioID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
for _, id := range scenarioID {
|
||||
scenarioLists = append(scenarioLists, scenario.StatusList{
|
||||
scenarioLists = append(scenarioLists, scenarioapischema.StatusList{
|
||||
ScenarioID: id,
|
||||
Status: 2,
|
||||
})
|
||||
}
|
||||
res = scenario.StatusResp{
|
||||
Result: scenario.StatusData{
|
||||
res = scenarioapischema.StatusResp{
|
||||
Result: scenarioapischema.StatusData{
|
||||
ScenarioStatusList: scenarioLists,
|
||||
},
|
||||
Status: 200,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package subscenario
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/subscenario"
|
||||
subscenarioapischema "honoka-chan/internal/schema/api/subscenario"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -12,20 +12,20 @@ func subscenarioStatus(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var subScenarioID []int
|
||||
subScenarioLists := []subscenario.StatusList{}
|
||||
subScenarioLists := []subscenarioapischema.StatusList{}
|
||||
err = ss.MainEng.Table("subscenario_m").Cols("subscenario_id").OrderBy("subscenario_id ASC").Find(&subScenarioID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
for _, id := range subScenarioID {
|
||||
subScenarioLists = append(subScenarioLists, subscenario.StatusList{
|
||||
subScenarioLists = append(subScenarioLists, subscenarioapischema.StatusList{
|
||||
SubscenarioID: id,
|
||||
Status: 2,
|
||||
})
|
||||
}
|
||||
res = subscenario.StatusResp{
|
||||
Result: subscenario.StatusData{
|
||||
res = subscenarioapischema.StatusResp{
|
||||
Result: subscenarioapischema.StatusData{
|
||||
SubscenarioStatusList: subScenarioLists,
|
||||
UnlockedSubscenarioIds: []any{},
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/unit"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
func unitAccessoryAll(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
accessoryList := []unit.AccessoryList{}
|
||||
accessoryList := []unitapischema.AccessoryList{}
|
||||
err = ss.MainEng.Table("common_accessory_m").Find(&accessoryList)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -23,13 +23,13 @@ func unitAccessoryAll(ctx *gin.Context) (res any, err error) {
|
||||
accessoryList[k].RankUpCount = 4
|
||||
accessoryList[k].FavoriteFlag = true
|
||||
}
|
||||
wearingInfo := []unit.WearingInfo{}
|
||||
wearingInfo := []unitapischema.WearingInfo{}
|
||||
err = ss.UserEng.Table("user_accessory_wear").Where("user_id = ?", ss.UserID).Find(&wearingInfo)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
res = unit.AccessoryAllResp{
|
||||
Result: unit.AccessoryAllData{
|
||||
res = unitapischema.AccessoryAllResp{
|
||||
Result: unitapischema.AccessoryAllData{
|
||||
AccessoryList: accessoryList,
|
||||
WearingInfo: wearingInfo,
|
||||
EspecialCreateFlag: false,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"time"
|
||||
)
|
||||
|
||||
func unitAccessoryMaterialAll() (res any, err error) {
|
||||
res = unitapischema.AccessoryMaterialAllResp{
|
||||
Result: unitapischema.AccessoryMaterialAllData{},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
return res, err
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
func unitAccessoryTab() (res any, err error) {
|
||||
data := honokautils.ReadAllText("assets/serverdata/accessoryTab.json")
|
||||
resp := unitapischema.AccessoryTabResp{}
|
||||
err = json.Unmarshal([]byte(data), &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.TimeStamp = time.Now().Unix()
|
||||
|
||||
return resp, err
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/unit"
|
||||
unitmodel "honoka-chan/internal/model/unit"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -11,23 +12,48 @@ import (
|
||||
func unitAll(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
unitsData := []unit.Active{}
|
||||
err = ss.MainEng.Table("common_unit_m").Find(&unitsData)
|
||||
unitMap := []unitmodel.UnitDataMap{}
|
||||
err = ss.GetBasicUnitInfo().
|
||||
Where("a.user_id = ?", ss.UserID).Find(&unitMap)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
userUnits := []unit.Active{}
|
||||
err = ss.UserEng.Table("user_unit").Where("user_id = ?", ss.UserID).Find(&userUnits)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
unitsData := []unitapischema.Active{}
|
||||
for _, u := range unitMap {
|
||||
unitsData = append(unitsData, unitapischema.Active{
|
||||
UnitOwningUserID: u.UnitOwningUserID,
|
||||
UserID: ss.UserID,
|
||||
UnitID: u.UnitID,
|
||||
Exp: u.Exp,
|
||||
NextExp: 0,
|
||||
Level: u.Level,
|
||||
MaxLevel: u.MaxLevel,
|
||||
LevelLimitID: u.LevelLimitID,
|
||||
Rank: u.Rank,
|
||||
MaxRank: u.MaxRank,
|
||||
Love: u.Love,
|
||||
MaxLove: u.MaxLove,
|
||||
UnitSkillExp: u.UnitSkillExp,
|
||||
UnitSkillLevel: u.UnitSkillLevel,
|
||||
MaxHp: u.MaxHp,
|
||||
UnitRemovableSkillCapacity: u.UnitRemovableSkillCapacity,
|
||||
FavoriteFlag: u.FavoriteFlag,
|
||||
DisplayRank: u.DisplayRank,
|
||||
IsRankMax: u.IsRankMax,
|
||||
IsLoveMax: u.IsLoveMax,
|
||||
IsLevelMax: u.IsLevelMax,
|
||||
IsSigned: u.IsSigned,
|
||||
IsSkillLevelMax: u.IsSkillLevelMax,
|
||||
IsRemovableSkillCapacityMax: u.IsRemovableSkillCapacityMax,
|
||||
InsertDate: "2023-03-20 03:58:55",
|
||||
})
|
||||
}
|
||||
unitsData = append(unitsData, userUnits...)
|
||||
|
||||
res = unit.AllResp{
|
||||
Result: unit.AllData{
|
||||
res = unitapischema.AllResp{
|
||||
Result: unitapischema.AllData{
|
||||
Active: unitsData,
|
||||
Waiting: []unit.Waiting{},
|
||||
Waiting: []unitapischema.Waiting{},
|
||||
},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/unit"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -11,23 +11,23 @@ import (
|
||||
func unitDeckInfo(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
userDeck := []unit.UserDeckData{}
|
||||
userDeck := []unitapischema.UserDeckData{}
|
||||
err = ss.UserEng.Table("user_deck").Where("user_id = ?", ss.UserID).Asc("deck_id").Find(&userDeck)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
unitDeckInfo := []unit.DeckInfoData{}
|
||||
unitDeckInfo := []unitapischema.DeckInfoData{}
|
||||
for _, deck := range userDeck {
|
||||
deckUnit := []unit.UnitDeckData{}
|
||||
deckUnit := []unitapischema.UnitDeckData{}
|
||||
err = ss.UserEng.Table("user_deck_unit").Where("user_deck_id = ?", deck.ID).Asc("position").Find(&deckUnit)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
oUID := []unit.UnitOwningUserIds{}
|
||||
oUID := []unitapischema.UnitOwningUserIds{}
|
||||
for _, u := range deckUnit {
|
||||
oUID = append(oUID, unit.UnitOwningUserIds{
|
||||
oUID = append(oUID, unitapischema.UnitOwningUserIds{
|
||||
Position: u.Position,
|
||||
UnitOwningUserID: u.UnitOwningUserID,
|
||||
})
|
||||
@@ -37,14 +37,14 @@ func unitDeckInfo(ctx *gin.Context) (res any, err error) {
|
||||
if deck.MainFlag == 1 {
|
||||
mainFlag = true
|
||||
}
|
||||
unitDeckInfo = append(unitDeckInfo, unit.DeckInfoData{
|
||||
unitDeckInfo = append(unitDeckInfo, unitapischema.DeckInfoData{
|
||||
UnitDeckID: deck.DeckID,
|
||||
MainFlag: mainFlag,
|
||||
DeckName: deck.DeckName,
|
||||
UnitOwningUserIds: oUID,
|
||||
})
|
||||
}
|
||||
res = unit.DeckInfoResp{
|
||||
res = unitapischema.DeckInfoResp{
|
||||
Result: unitDeckInfo,
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/unit"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
func unitRemovableSkillInfo(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var skillEquipCount []unit.SkillEquipCount
|
||||
var skillEquipCount []unitapischema.SkillEquipCount
|
||||
err = ss.UserEng.Table("user_unit_skill_equip").Where("user_id = ?", ss.UserID).Select("unit_removable_skill_id,COUNT(*) AS ct").
|
||||
GroupBy("unit_removable_skill_id").Find(&skillEquipCount)
|
||||
if ss.CheckErr(err) {
|
||||
@@ -24,12 +24,12 @@ func unitRemovableSkillInfo(ctx *gin.Context) (res any, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
owingInfo := []unit.OwningInfo{}
|
||||
owingInfo := []unitapischema.OwningInfo{}
|
||||
for _, id := range rmSkillIds {
|
||||
info := unit.OwningInfo{
|
||||
info := unitapischema.OwningInfo{
|
||||
UnitRemovableSkillID: id,
|
||||
TotalAmount: 9,
|
||||
EquippedAmount: 0,
|
||||
TotalAmount: 999,
|
||||
EquippedAmount: 0, // TODO: 计算实际数量
|
||||
InsertDate: "2023-01-01 12:00:00",
|
||||
}
|
||||
for _, sk := range skillEquipCount {
|
||||
@@ -49,21 +49,21 @@ func unitRemovableSkillInfo(ctx *gin.Context) (res any, err error) {
|
||||
|
||||
equipInfo := map[int]any{}
|
||||
for _, v := range unitOwningIds {
|
||||
detail := []unit.SkillEquipDetail{}
|
||||
detail := []unitapischema.SkillEquipDetail{}
|
||||
err = ss.UserEng.Table("user_unit_skill_equip").Where("user_id = ? AND unit_owning_user_id = ?", ss.UserID, v).
|
||||
Cols("unit_removable_skill_id").Find(&detail)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
equipInfo[v] = unit.SkillEquipList{
|
||||
equipInfo[v] = unitapischema.SkillEquipList{
|
||||
UnitOwningUserID: v,
|
||||
Detail: detail,
|
||||
}
|
||||
}
|
||||
|
||||
res = unit.RemovableSkillInfoResp{
|
||||
Result: unit.RemovableSkillInfoData{
|
||||
res = unitapischema.RemovableSkillInfoResp{
|
||||
Result: unitapischema.RemovableSkillInfoData{
|
||||
OwningInfo: owingInfo,
|
||||
EquipmentInfo: equipInfo,
|
||||
}, // 宝石
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/unit"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"time"
|
||||
)
|
||||
|
||||
func unitSupporterAll() (res any, err error) {
|
||||
res = unit.SupporterAllResp{
|
||||
Result: unit.SupporterAllData{
|
||||
UnitSupportList: []unit.SupporterList{},
|
||||
res = unitapischema.SupporterAllResp{
|
||||
Result: unitapischema.SupporterAllData{
|
||||
UnitSupportList: []unitapischema.SupporterList{},
|
||||
}, // 练习道具
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
@@ -10,6 +10,10 @@ func UnitApi(ctx *gin.Context, action string) (res any, err error) {
|
||||
switch action {
|
||||
case "accessoryAll":
|
||||
res, err = unitAccessoryAll(ctx)
|
||||
case "accessoryMaterialAll":
|
||||
res, err = unitAccessoryMaterialAll()
|
||||
case "accessoryTab":
|
||||
res, err = unitAccessoryTab()
|
||||
case "deckInfo":
|
||||
res, err = unitDeckInfo(ctx)
|
||||
case "removableSkillInfo":
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/user"
|
||||
userapischema "honoka-chan/internal/schema/api/user"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -17,9 +17,9 @@ func userGetNavi(ctx *gin.Context) (res any, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
res = user.GetNaviResp{
|
||||
Result: user.GetNaviData{
|
||||
User: user.User{
|
||||
res = userapischema.GetNaviResp{
|
||||
Result: userapischema.GetNaviData{
|
||||
User: userapischema.User{
|
||||
UserID: uID,
|
||||
UnitOwningUserID: oID,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
userapischema "honoka-chan/internal/schema/api/user"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
@@ -12,43 +12,14 @@ import (
|
||||
func userInfo(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
pref := user.UserPref{}
|
||||
pref := usermodel.UserPref{}
|
||||
_, err = ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Get(&pref)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = userapischema.InfoResp{
|
||||
Result: userapischema.UserInfo{
|
||||
UserID: ss.UserID,
|
||||
Name: pref.UserName,
|
||||
Level: pref.UserLevel,
|
||||
Exp: 1089696,
|
||||
PreviousExp: 0,
|
||||
NextExp: 1207185,
|
||||
GameCoin: 999999999,
|
||||
SnsCoin: 100000,
|
||||
FreeSnsCoin: 50000,
|
||||
PaidSnsCoin: 50000,
|
||||
SocialPoint: 1438395,
|
||||
UnitMax: 5000,
|
||||
WaitingUnitMax: 1000,
|
||||
EnergyMax: 417,
|
||||
EnergyFullTime: "2023-03-20 03:58:55",
|
||||
LicenseLiveEnergyRecoverlyTime: 60,
|
||||
EnergyFullNeedTime: 0,
|
||||
OverMaxEnergy: 417,
|
||||
TrainingEnergy: 100,
|
||||
TrainingEnergyMax: 100,
|
||||
FriendMax: 99,
|
||||
InviteCode: pref.InviteCode,
|
||||
InsertDate: "2015-08-10 18:58:30",
|
||||
UpdateDate: "2018-08-09 18:13:12",
|
||||
TutorialState: -1,
|
||||
DiamondCoin: 0,
|
||||
CrystalCoin: 0,
|
||||
LpRecoveryItem: []userapischema.LpRecoveryItem{},
|
||||
},
|
||||
Result: ss.GetUserInfo(),
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
|
||||
Reference in New Issue
Block a user