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:
@@ -14,6 +14,4 @@ LoveLive! 学园偶像祭 自用私服。
|
||||
- 虹原翼 (yazawa@niconi.co.ni) @ [LLSIF 查卡器
|
||||
](https://card.niconi.co.ni/) 的技术支持。
|
||||
- tungnotpunk @ LL Hax 在 iOS 客户端修改方面的支持。
|
||||
- reversing-sifas (https://github.com/Francesco149/reversing-sifas) 项目的灵感和技术细节。
|
||||
- LLAS WiKi (https://wiki.loveliv.es/) 提供的全量 AS Live Stage 信息。
|
||||
- 其他可能一时没想起来的大佬们和项目。
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
data.db
|
||||
load.db
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,185 @@
|
||||
{
|
||||
"result": {
|
||||
"tab_list": [
|
||||
{
|
||||
"tab_name": "μ’s",
|
||||
"asset_list": [
|
||||
{
|
||||
"unit_type_id": 1,
|
||||
"asset_path": "assets/image/accessory/list/list_1.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 2,
|
||||
"asset_path": "assets/image/accessory/list/list_2.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 3,
|
||||
"asset_path": "assets/image/accessory/list/list_3.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 4,
|
||||
"asset_path": "assets/image/accessory/list/list_4.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 5,
|
||||
"asset_path": "assets/image/accessory/list/list_5.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 6,
|
||||
"asset_path": "assets/image/accessory/list/list_6.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 7,
|
||||
"asset_path": "assets/image/accessory/list/list_7.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 8,
|
||||
"asset_path": "assets/image/accessory/list/list_8.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 9,
|
||||
"asset_path": "assets/image/accessory/list/list_9.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab_name": "Aqours",
|
||||
"asset_list": [
|
||||
{
|
||||
"unit_type_id": 101,
|
||||
"asset_path": "assets/image/accessory/list/list_10.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 102,
|
||||
"asset_path": "assets/image/accessory/list/list_11.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 103,
|
||||
"asset_path": "assets/image/accessory/list/list_12.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 104,
|
||||
"asset_path": "assets/image/accessory/list/list_13.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 105,
|
||||
"asset_path": "assets/image/accessory/list/list_14.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 106,
|
||||
"asset_path": "assets/image/accessory/list/list_15.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 107,
|
||||
"asset_path": "assets/image/accessory/list/list_16.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 108,
|
||||
"asset_path": "assets/image/accessory/list/list_17.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 109,
|
||||
"asset_path": "assets/image/accessory/list/list_18.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab_name": "虹咲",
|
||||
"asset_list": [
|
||||
{
|
||||
"unit_type_id": 201,
|
||||
"asset_path": "assets/image/accessory/list/list_24.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 202,
|
||||
"asset_path": "assets/image/accessory/list/list_25.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 203,
|
||||
"asset_path": "assets/image/accessory/list/list_26.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 204,
|
||||
"asset_path": "assets/image/accessory/list/list_27.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 205,
|
||||
"asset_path": "assets/image/accessory/list/list_28.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 206,
|
||||
"asset_path": "assets/image/accessory/list/list_29.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 207,
|
||||
"asset_path": "assets/image/accessory/list/list_30.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 208,
|
||||
"asset_path": "assets/image/accessory/list/list_31.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 209,
|
||||
"asset_path": "assets/image/accessory/list/list_32.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 212,
|
||||
"asset_path": "assets/image/accessory/list/list_33.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 213,
|
||||
"asset_path": "assets/image/accessory/list/list_34.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 214,
|
||||
"asset_path": "assets/image/accessory/list/list_35.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab_name": "Liella!",
|
||||
"asset_list": [
|
||||
{
|
||||
"unit_type_id": 301,
|
||||
"asset_path": "assets/image/accessory/list/list_19.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 302,
|
||||
"asset_path": "assets/image/accessory/list/list_20.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 303,
|
||||
"asset_path": "assets/image/accessory/list/list_21.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 304,
|
||||
"asset_path": "assets/image/accessory/list/list_22.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 305,
|
||||
"asset_path": "assets/image/accessory/list/list_23.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 306,
|
||||
"asset_path": "assets/image/accessory/list/list_36.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 307,
|
||||
"asset_path": "assets/image/accessory/list/list_37.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 308,
|
||||
"asset_path": "assets/image/accessory/list/list_38.png"
|
||||
},
|
||||
{
|
||||
"unit_type_id": 309,
|
||||
"asset_path": "assets/image/accessory/list/list_39.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"commandNum": false,
|
||||
"timeStamp": 1679237529
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
{
|
||||
"response_data": {
|
||||
"party_list": [
|
||||
{
|
||||
"user_info": {
|
||||
"user_id": 5762285,
|
||||
"name": "SDS Nico",
|
||||
"level": 21
|
||||
},
|
||||
"center_unit_info": {
|
||||
"unit_owning_user_id": 1000880096808,
|
||||
"unit_id": 4001,
|
||||
"exp": 79700,
|
||||
"next_exp": 0,
|
||||
"level": 100,
|
||||
"level_limit_id": 1,
|
||||
"max_level": 100,
|
||||
"rank": 2,
|
||||
"max_rank": 2,
|
||||
"love": 1000,
|
||||
"max_love": 1000,
|
||||
"unit_skill_level": 8,
|
||||
"max_hp": 4,
|
||||
"favorite_flag": false,
|
||||
"display_rank": 2,
|
||||
"unit_skill_exp": 29900,
|
||||
"unit_removable_skill_capacity": 8,
|
||||
"attribute": 2,
|
||||
"smile": 7210,
|
||||
"cute": 7870,
|
||||
"cool": 7430,
|
||||
"is_love_max": true,
|
||||
"is_level_max": true,
|
||||
"is_rank_max": true,
|
||||
"is_signed": true,
|
||||
"is_skill_level_max": true,
|
||||
"setting_award_id": 121,
|
||||
"removable_skill_ids": []
|
||||
},
|
||||
"setting_award_id": 121,
|
||||
"available_social_point": 10,
|
||||
"friend_status": 1
|
||||
},
|
||||
{
|
||||
"user_info": {
|
||||
"user_id": 5400659,
|
||||
"name": "\u9ed1\u6850-",
|
||||
"level": 37
|
||||
},
|
||||
"center_unit_info": {
|
||||
"unit_owning_user_id": 1001193273786,
|
||||
"unit_id": 13,
|
||||
"exp": 0,
|
||||
"next_exp": 6,
|
||||
"level": 1,
|
||||
"level_limit_id": 0,
|
||||
"max_level": 30,
|
||||
"rank": 1,
|
||||
"max_rank": 2,
|
||||
"love": 25,
|
||||
"max_love": 25,
|
||||
"unit_skill_level": 1,
|
||||
"max_hp": 2,
|
||||
"favorite_flag": false,
|
||||
"display_rank": 1,
|
||||
"unit_skill_exp": 0,
|
||||
"unit_removable_skill_capacity": 0,
|
||||
"attribute": 1,
|
||||
"smile": 1520,
|
||||
"cute": 550,
|
||||
"cool": 308,
|
||||
"is_love_max": false,
|
||||
"is_level_max": false,
|
||||
"is_rank_max": false,
|
||||
"is_signed": false,
|
||||
"is_skill_level_max": true,
|
||||
"setting_award_id": 17,
|
||||
"removable_skill_ids": []
|
||||
},
|
||||
"setting_award_id": 17,
|
||||
"available_social_point": 10,
|
||||
"friend_status": 1
|
||||
},
|
||||
{
|
||||
"user_info": {
|
||||
"user_id": 7663163,
|
||||
"name": "\u82b1\u82b1\u82b1\u6912",
|
||||
"level": 30
|
||||
},
|
||||
"center_unit_info": {
|
||||
"unit_owning_user_id": 1002061904425,
|
||||
"unit_id": 1131,
|
||||
"exp": 8400,
|
||||
"next_exp": 8659,
|
||||
"level": 18,
|
||||
"level_limit_id": 1,
|
||||
"max_level": 100,
|
||||
"rank": 2,
|
||||
"max_rank": 2,
|
||||
"love": 1000,
|
||||
"max_love": 1000,
|
||||
"unit_skill_level": 1,
|
||||
"max_hp": 5,
|
||||
"favorite_flag": true,
|
||||
"display_rank": 2,
|
||||
"unit_skill_exp": 0,
|
||||
"unit_removable_skill_capacity": 4,
|
||||
"attribute": 3,
|
||||
"smile": 3195,
|
||||
"cute": 2925,
|
||||
"cool": 4085,
|
||||
"is_love_max": true,
|
||||
"is_level_max": false,
|
||||
"is_rank_max": true,
|
||||
"is_signed": false,
|
||||
"is_skill_level_max": false,
|
||||
"setting_award_id": 17,
|
||||
"removable_skill_ids": []
|
||||
},
|
||||
"setting_award_id": 17,
|
||||
"available_social_point": 5,
|
||||
"friend_status": 0
|
||||
},
|
||||
{
|
||||
"user_info": {
|
||||
"user_id": 7663313,
|
||||
"name": "\u67f3\u4e95\u4e0e\u5b50",
|
||||
"level": 34
|
||||
},
|
||||
"center_unit_info": {
|
||||
"unit_owning_user_id": 1002062097329,
|
||||
"unit_id": 1372,
|
||||
"exp": 79700,
|
||||
"next_exp": 0,
|
||||
"level": 100,
|
||||
"level_limit_id": 1,
|
||||
"max_level": 100,
|
||||
"rank": 2,
|
||||
"max_rank": 2,
|
||||
"love": 1000,
|
||||
"max_love": 1000,
|
||||
"unit_skill_level": 1,
|
||||
"max_hp": 6,
|
||||
"favorite_flag": true,
|
||||
"display_rank": 2,
|
||||
"unit_skill_exp": 0,
|
||||
"unit_removable_skill_capacity": 4,
|
||||
"attribute": 1,
|
||||
"smile": 5370,
|
||||
"cute": 4080,
|
||||
"cool": 4500,
|
||||
"is_love_max": true,
|
||||
"is_level_max": true,
|
||||
"is_rank_max": true,
|
||||
"is_signed": false,
|
||||
"is_skill_level_max": false,
|
||||
"setting_award_id": 17,
|
||||
"removable_skill_ids": [
|
||||
3,
|
||||
2,
|
||||
1
|
||||
]
|
||||
},
|
||||
"setting_award_id": 17,
|
||||
"available_social_point": 5,
|
||||
"friend_status": 0
|
||||
},
|
||||
{
|
||||
"user_info": {
|
||||
"user_id": 7663527,
|
||||
"name": "\u6211\u63a8\u5c06\u519b",
|
||||
"level": 15
|
||||
},
|
||||
"center_unit_info": {
|
||||
"unit_owning_user_id": 1002062228744,
|
||||
"unit_id": 1912,
|
||||
"exp": 0,
|
||||
"next_exp": 201,
|
||||
"level": 1,
|
||||
"level_limit_id": 1,
|
||||
"max_level": 100,
|
||||
"rank": 2,
|
||||
"max_rank": 2,
|
||||
"love": 444,
|
||||
"max_love": 1000,
|
||||
"unit_skill_level": 1,
|
||||
"max_hp": 5,
|
||||
"favorite_flag": false,
|
||||
"display_rank": 2,
|
||||
"unit_skill_exp": 0,
|
||||
"unit_removable_skill_capacity": 4,
|
||||
"attribute": 1,
|
||||
"smile": 3870,
|
||||
"cute": 3090,
|
||||
"cool": 2470,
|
||||
"is_love_max": false,
|
||||
"is_level_max": false,
|
||||
"is_rank_max": true,
|
||||
"is_signed": false,
|
||||
"is_skill_level_max": false,
|
||||
"setting_award_id": 1,
|
||||
"removable_skill_ids": []
|
||||
},
|
||||
"setting_award_id": 1,
|
||||
"available_social_point": 5,
|
||||
"friend_status": 0
|
||||
}
|
||||
],
|
||||
"training_energy": 999,
|
||||
"training_energy_max": 999,
|
||||
"server_timestamp": 1679802984
|
||||
},
|
||||
"release_info": [],
|
||||
"status_code": 200
|
||||
}
|
||||
@@ -19,7 +19,7 @@ require (
|
||||
github.com/bytedance/sonic/loader v0.5.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.6 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
|
||||
github.com/goccy/go-yaml v1.19.2 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
@@ -55,7 +55,7 @@ require (
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.0
|
||||
github.com/syndtr/goleveldb v1.0.0 // indirect
|
||||
github.com/ugorji/go/codec v1.3.1 // indirect
|
||||
golang.org/x/crypto v0.47.0 // indirect
|
||||
golang.org/x/net v0.49.0 // indirect
|
||||
|
||||
@@ -16,8 +16,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
|
||||
github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gin-contrib/sessions v1.0.4 h1:ha6CNdpYiTOK/hTp05miJLbpTSNfOnFg5Jm2kbcqy8U=
|
||||
github.com/gin-contrib/sessions v1.0.4/go.mod h1:ccmkrb2z6iU2osiAHZG3x3J4suJK+OU27oqzlWOqQgs=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package constant
|
||||
|
||||
type LiveGoalType int
|
||||
|
||||
const (
|
||||
LiveGoalTypeScore LiveGoalType = iota + 1
|
||||
LiveGoalTypeCombo
|
||||
LiveGoalTypeClear
|
||||
)
|
||||
|
||||
type PreciseScoreUpdateType int
|
||||
|
||||
const (
|
||||
PreciseScoreUpdateTypePerfect PreciseScoreUpdateType = iota + 1
|
||||
PreciseScoreUpdateTypeScore
|
||||
PreciseScoreUpdateTypeAlways
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
package constant
|
||||
|
||||
type ErrorCode int
|
||||
|
||||
const (
|
||||
ErrorCodeLivePreciseListNotFound ErrorCode = 3421
|
||||
)
|
||||
@@ -3,7 +3,7 @@ package album
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/album"
|
||||
albumschema "honoka-chan/internal/schema/album"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -19,7 +19,7 @@ func seriesAll(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
albumSeriesAllRes := []album.SeriesAllData{}
|
||||
albumSeriesAllRes := []albumschema.SeriesAllData{}
|
||||
for _, id := range albumID {
|
||||
var unitList []struct {
|
||||
UnitId int `xorm:"unit_id"`
|
||||
@@ -30,9 +30,9 @@ func seriesAll(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
albumSeriesAll := []album.UnitList{}
|
||||
albumSeriesAll := []albumschema.UnitList{}
|
||||
for _, unit := range unitList {
|
||||
albumSeries := album.UnitList{
|
||||
albumSeries := albumschema.UnitList{
|
||||
UnitID: unit.UnitId,
|
||||
RankMaxFlag: true,
|
||||
LoveMaxFlag: true,
|
||||
@@ -72,13 +72,13 @@ func seriesAll(ctx *gin.Context) {
|
||||
albumSeriesAll = append(albumSeriesAll, albumSeries)
|
||||
}
|
||||
|
||||
albumSeriesAllRes = append(albumSeriesAllRes, album.SeriesAllData{
|
||||
albumSeriesAllRes = append(albumSeriesAllRes, albumschema.SeriesAllData{
|
||||
SeriesID: id,
|
||||
UnitList: albumSeriesAll,
|
||||
})
|
||||
}
|
||||
|
||||
ss.Respond(album.SeriesAllResp{
|
||||
ss.Respond(albumschema.SeriesAllResp{
|
||||
ResponseData: albumSeriesAllRes,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -3,7 +3,7 @@ package announce
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/announce"
|
||||
announceschema "honoka-chan/internal/schema/announce"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,8 +14,8 @@ func checkState(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(announce.CheckStateDataResp{
|
||||
ResponseData: announce.CheckStateData{
|
||||
ss.Respond(announceschema.CheckStateDataResp{
|
||||
ResponseData: announceschema.CheckStateData{
|
||||
HasUnreadAnnounce: false,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -2,9 +2,9 @@ package award
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/award"
|
||||
awardschema "honoka-chan/internal/schema/award"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -16,7 +16,7 @@ func set(ctx *gin.Context) {
|
||||
defer ss.Finalize()
|
||||
|
||||
reqData := gjson.Parse(ctx.MustGet("request_data").(string))
|
||||
pref := user.UserPref{
|
||||
pref := usermodel.UserPref{
|
||||
AwardID: int(reqData.Get("award_id").Int()),
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func set(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(award.SetResp{
|
||||
ss.Respond(awardschema.SetResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -2,9 +2,9 @@ package background
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/background"
|
||||
backgroundschema "honoka-chan/internal/schema/background"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -16,7 +16,7 @@ func set(ctx *gin.Context) {
|
||||
defer ss.Finalize()
|
||||
|
||||
reqData := gjson.Parse(ctx.MustGet("request_data").(string))
|
||||
pref := user.UserPref{
|
||||
pref := usermodel.UserPref{
|
||||
BackgroundID: int(reqData.Get("background_id").Int()),
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func set(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(background.SetResp{
|
||||
ss.Respond(backgroundschema.SetResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/download"
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -22,13 +22,13 @@ func additional(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
downloadReq := download.AdditionalReq{}
|
||||
downloadReq := downloadschema.AdditionalReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &downloadReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
pkgList := []download.AdditionalData{}
|
||||
pkgList := []downloadschema.AdditionalData{}
|
||||
pkgType, pkgId := downloadReq.PackageType, downloadReq.PackageID
|
||||
var pkgInfo []PkgInfo
|
||||
err = ss.MainEng.Table("download_m").Where("pkg_type = ? AND pkg_id = ? AND pkg_os = ?", pkgType, pkgId, downloadReq.TargetOs).
|
||||
@@ -39,14 +39,14 @@ func additional(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
for _, pkg := range pkgInfo {
|
||||
pkgList = append(pkgList, download.AdditionalData{
|
||||
pkgList = append(pkgList, downloadschema.AdditionalData{
|
||||
Size: pkg.Size,
|
||||
URL: fmt.Sprintf("%s/%s/archives/%d_%d_%d.zip",
|
||||
config.Conf.Settings.CdnServer, downloadReq.TargetOs, pkgType, pkg.Id, pkg.Order),
|
||||
})
|
||||
}
|
||||
|
||||
ss.Respond(download.AdditionalResp{
|
||||
ss.Respond(downloadschema.AdditionalResp{
|
||||
ResponseData: pkgList,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/download"
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -17,13 +17,13 @@ func batch(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
downloadReq := download.BatchReq{}
|
||||
downloadReq := downloadschema.BatchReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &downloadReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
pkgList := []download.BatchData{}
|
||||
pkgList := []downloadschema.BatchData{}
|
||||
if downloadReq.ClientVersion == config.PackageVersion {
|
||||
pkgType := downloadReq.PackageType
|
||||
var pkgInfo []PkgInfo
|
||||
@@ -35,7 +35,7 @@ func batch(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
for _, pkg := range pkgInfo {
|
||||
pkgList = append(pkgList, download.BatchData{
|
||||
pkgList = append(pkgList, downloadschema.BatchData{
|
||||
Size: pkg.Size,
|
||||
URL: fmt.Sprintf("%s/%s/archives/%d_%d_%d.zip",
|
||||
config.Conf.Settings.CdnServer, downloadReq.Os, pkgType, pkg.Id, pkg.Order),
|
||||
@@ -43,7 +43,7 @@ func batch(ctx *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ss.Respond(download.BatchResp{
|
||||
ss.Respond(downloadschema.BatchResp{
|
||||
ResponseData: pkgList,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -3,7 +3,7 @@ package download
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/download"
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -13,7 +13,7 @@ func event(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(download.EventResp{
|
||||
ss.Respond(downloadschema.EventResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/download"
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -18,13 +18,13 @@ func update(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
downloadReq := download.UpdateReq{}
|
||||
downloadReq := downloadschema.UpdateReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &downloadReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
pkgList := []download.UpdateData{}
|
||||
pkgList := []downloadschema.UpdateData{}
|
||||
if downloadReq.ExternalVersion != config.PackageVersion {
|
||||
pkgType := 99
|
||||
var pkgInfo []PkgInfo
|
||||
@@ -36,7 +36,7 @@ func update(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
for _, pkg := range pkgInfo {
|
||||
pkgList = append(pkgList, download.UpdateData{
|
||||
pkgList = append(pkgList, downloadschema.UpdateData{
|
||||
Size: pkg.Size,
|
||||
URL: fmt.Sprintf("%s/%s/archives/%d_%d_%d.zip",
|
||||
config.Conf.Settings.CdnServer, downloadReq.TargetOs, pkgType, pkg.Id, pkg.Order),
|
||||
@@ -60,7 +60,7 @@ func update(ctx *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ss.Respond(download.UpdateResp{
|
||||
ss.Respond(downloadschema.UpdateResp{
|
||||
ResponseData: pkgList,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/download"
|
||||
downloadschema "honoka-chan/internal/schema/download"
|
||||
"honoka-chan/internal/session"
|
||||
"strings"
|
||||
|
||||
@@ -17,7 +17,7 @@ func url(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
downloadReq := download.UrlReq{}
|
||||
downloadReq := downloadschema.UrlReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &downloadReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -34,8 +34,8 @@ func url(ctx *gin.Context) {
|
||||
cdnServer, downloadReq.Os, strings.ReplaceAll(v, "\\", "")))
|
||||
}
|
||||
|
||||
ss.Respond(download.UrlResp{
|
||||
ResponseData: download.UrlData{
|
||||
ss.Respond(downloadschema.UrlResp{
|
||||
ResponseData: downloadschema.UrlData{
|
||||
UrlList: urlList,
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
|
||||
@@ -3,7 +3,7 @@ package event
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/event"
|
||||
eventschema "honoka-chan/internal/schema/event"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,9 +14,9 @@ func list(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
targets := []event.TargetList{}
|
||||
targets := []eventschema.TargetList{}
|
||||
for i := range 6 {
|
||||
targets = append(targets, event.TargetList{
|
||||
targets = append(targets, eventschema.TargetList{
|
||||
Position: i + 1,
|
||||
IsDisplayable: false,
|
||||
})
|
||||
@@ -30,8 +30,8 @@ func list(ctx *gin.Context) {
|
||||
// StatusCode: 600,
|
||||
// })
|
||||
|
||||
ss.Respond(event.ListResp{
|
||||
ResponseData: event.ListData{
|
||||
ss.Respond(eventschema.ListResp{
|
||||
ResponseData: eventschema.ListData{
|
||||
TargetList: targets,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ package gdpr
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/gdpr"
|
||||
gdprschema "honoka-chan/internal/schema/gdpr"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,8 +14,8 @@ func get(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(gdpr.GetResp{
|
||||
ResponseData: gdpr.GetData{
|
||||
ss.Respond(gdprschema.GetResp{
|
||||
ResponseData: gdprschema.GetData{
|
||||
EnableGdpr: true,
|
||||
IsEea: false,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -2,7 +2,7 @@ package account
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,10 +12,10 @@ func active(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(ghome.ActiveResp{
|
||||
ss.Respond(ghomeschema.ActiveResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: ghome.ActiveData{
|
||||
Data: ghomeschema.ActiveData{
|
||||
Message: "ok",
|
||||
Result: 0,
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
"strings"
|
||||
|
||||
@@ -16,7 +16,7 @@ func initialize(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
initData := ghome.InitializeData{
|
||||
initData := ghomeschema.InitializeData{
|
||||
BrandLogo: "http://gskd.sdo.com/ghome/ztc/logo/og/logo_xhdpi.png",
|
||||
BrandName: "盛趣游戏",
|
||||
ForceShowAgreement: 1,
|
||||
@@ -38,7 +38,7 @@ func initialize(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(ghome.InitializeResp{
|
||||
ss.Respond(ghomeschema.InitializeResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: base64.StdEncoding.EncodeToString(encryptedData),
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/internal/model/user"
|
||||
unitmodel "honoka-chan/internal/model/unit"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/api/profile"
|
||||
"honoka-chan/internal/schema/api/unit"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"honoka-chan/pkg/utils"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -62,10 +62,10 @@ func login(ctx *gin.Context) {
|
||||
userID, _ = checkUserID(ss, int(loginTime))
|
||||
|
||||
pass = openssl.Md5ToString(password)
|
||||
autoKey = "AUTO" + strings.ToUpper(honokautils.RandomStr(32))
|
||||
autoKey = "AUTO" + strings.ToUpper(utils.RandomStr(32))
|
||||
ticket = fmt.Sprintf("9999999%d%d", userID, userID)
|
||||
|
||||
userData := user.Users{
|
||||
userData := usermodel.Users{
|
||||
Phone: phone,
|
||||
Password: pass,
|
||||
Autokey: autoKey,
|
||||
@@ -80,7 +80,7 @@ func login(ctx *gin.Context) {
|
||||
|
||||
// 方便起见初始化 userid 和 key 一样
|
||||
// 注意:user_key 表中的 key 是上文生成的用于登录的 userid,而 userid 则是用于 Authorize Token 生成用的
|
||||
userKey := user.UserKey{
|
||||
userKey := usermodel.UserKey{
|
||||
UserID: userID,
|
||||
Key: userID,
|
||||
}
|
||||
@@ -96,20 +96,59 @@ func login(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
if !exists {
|
||||
// 默认中心成员
|
||||
var unitOwningUserID int
|
||||
_, err = ss.MainEng.Table("common_unit_m").Cols("unit_owning_user_id").Where("unit_id = ?", 31).Get(&unitOwningUserID)
|
||||
// 生成用于卡片
|
||||
var unitData []unitmodel.CommonUnitData
|
||||
err = ss.UserEng.Table(new(unitmodel.CommonUnitData)).Find(&unitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
userPref := user.UserPref{
|
||||
checked := false
|
||||
for _, u := range unitData {
|
||||
userUnit := usermodel.UserUnitData{
|
||||
UnitID: u.UnitID,
|
||||
FavoriteFlag: false,
|
||||
DisplayRank: u.MaxRank,
|
||||
UserID: userID,
|
||||
InsertDate: time.Now().Unix(),
|
||||
UpdateDate: time.Now().Unix(),
|
||||
}
|
||||
|
||||
// 检查表里是否已经有数据
|
||||
if !checked {
|
||||
ct, err := ss.UserEng.Table(new(usermodel.UserUnitData)).Count()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
if ct == 0 {
|
||||
userUnit.UnitOwningUserID = 38383
|
||||
}
|
||||
|
||||
checked = true
|
||||
}
|
||||
|
||||
_, err = ss.UserEng.Table(new(usermodel.UserUnitData)).Insert(&userUnit)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 默认中心成员
|
||||
var unitOwningUserID int
|
||||
_, err = ss.UserEng.Table(new(usermodel.UserUnitData)).
|
||||
Cols("unit_owning_user_id").Where("unit_id = ?", 31).Get(&unitOwningUserID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
userPref := usermodel.UserPref{
|
||||
UserID: userID,
|
||||
AwardID: 1, // 音乃木坂学生
|
||||
BackgroundID: 1, // 初始背景
|
||||
UnitOwningUserID: unitOwningUserID,
|
||||
UserName: "音乃木坂学生",
|
||||
UserLevel: 1,
|
||||
UserLevel: 1028,
|
||||
UserDesc: "你好。",
|
||||
InviteCode: strconv.Itoa(userID),
|
||||
UpdateTime: time.Now().Unix(),
|
||||
@@ -128,7 +167,7 @@ func login(ctx *gin.Context) {
|
||||
|
||||
if !exists {
|
||||
// 默认队伍
|
||||
userDeck := unit.UserDeckData{
|
||||
userDeck := unitapischema.UserDeckData{
|
||||
DeckID: 1,
|
||||
MainFlag: 1,
|
||||
DeckName: "队伍A",
|
||||
@@ -139,44 +178,37 @@ func login(ctx *gin.Context) {
|
||||
userDeckID := userDeck.ID
|
||||
|
||||
// 默认卡组 - 仆光
|
||||
unitID := []int{}
|
||||
err = ss.MainEng.Table("unit_m").Cols("unit_id").Where("album_series_id = ?", 615).Find(&unitID)
|
||||
unitID := []int{3465, 3466, 3467, 3468, 3469, 3470, 3471, 3472, 3473}
|
||||
var unitData []unitmodel.UnitDataMap
|
||||
err = ss.GetBasicUnitInfo().In("a.unit_id", unitID).Find(&unitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
unitData := []profile.UnitData{}
|
||||
err = ss.MainEng.Table("common_unit_m").In("unit_id", unitID).Find(&unitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
position := 1
|
||||
for _, u := range unitData {
|
||||
unitDeckData := unit.UnitDeckData{
|
||||
for i, u := range unitData {
|
||||
unitDeckData := usermodel.UserDeckUnit{
|
||||
UserDeckID: userDeckID,
|
||||
UnitOwningUserID: u.UnitOwningUserID,
|
||||
UnitID: u.UnitID,
|
||||
Position: position,
|
||||
Level: 100,
|
||||
LevelLimitID: 1,
|
||||
DisplayRank: 2,
|
||||
Love: 1000,
|
||||
UnitSkillLevel: 8,
|
||||
IsRankMax: true,
|
||||
IsLoveMax: true,
|
||||
IsLevelMax: true,
|
||||
Position: i + 1,
|
||||
Level: u.Level,
|
||||
LevelLimitID: u.LevelLimitID,
|
||||
DisplayRank: u.DisplayRank,
|
||||
Love: u.MaxLove,
|
||||
UnitSkillLevel: u.UnitSkillLevel,
|
||||
IsRankMax: u.IsRankMax,
|
||||
IsLoveMax: u.IsLoveMax,
|
||||
IsLevelMax: u.IsLevelMax,
|
||||
IsSigned: u.IsSigned,
|
||||
BeforeLove: 1000,
|
||||
MaxLove: 1000,
|
||||
InsertData: time.Now().Unix(),
|
||||
BeforeLove: u.MaxLove,
|
||||
MaxLove: u.MaxLove,
|
||||
UserID: userID,
|
||||
InsertDate: time.Now().Unix(),
|
||||
}
|
||||
_, err = ss.UserEng.Table("user_deck_unit").Insert(&unitDeckData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
position++
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +225,7 @@ func login(ctx *gin.Context) {
|
||||
loginCode = 31
|
||||
loginMsg = "账号不存在或者密码有误!"
|
||||
} else {
|
||||
userData := user.Users{
|
||||
userData := usermodel.Users{
|
||||
Autokey: autoKey,
|
||||
Ticket: ticket,
|
||||
LastLoginTime: loginTime,
|
||||
|
||||
@@ -3,10 +3,12 @@ package account
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-think/openssl"
|
||||
@@ -36,27 +38,27 @@ func loginAuto(ctx *gin.Context) {
|
||||
params, _ := url.ParseQuery(queryStr)
|
||||
autoKey := params.Get("autokey")
|
||||
|
||||
var uid, ticket string
|
||||
_, err = ss.UserEng.Table("users").Cols("user_id,ticket").Where("autokey = ?", autoKey).Get(&uid, &ticket)
|
||||
var userData usermodel.Users
|
||||
exists, err := ss.UserEng.Table("users").Where("autokey = ?", autoKey).Get(&userData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
loginAutoData := ghome.LoginAutoData{}
|
||||
loginAutoData := ghomeschema.LoginAutoData{}
|
||||
loginAutoCode := 0
|
||||
loginAutoMsg := "ok"
|
||||
if uid != "" {
|
||||
loginAutoData = ghome.LoginAutoData{
|
||||
if exists {
|
||||
loginAutoData = ghomeschema.LoginAutoData{
|
||||
Result: loginAutoCode,
|
||||
Message: loginAutoMsg,
|
||||
Autokey: autoKey,
|
||||
UserId: uid,
|
||||
Ticket: ticket,
|
||||
UserId: strconv.Itoa(userData.UserID),
|
||||
Ticket: userData.Ticket,
|
||||
}
|
||||
} else {
|
||||
loginAutoCode = 31
|
||||
loginAutoMsg = "账号不存在或者登陆状态已过期!"
|
||||
loginAutoData = ghome.LoginAutoData{
|
||||
loginAutoData = ghomeschema.LoginAutoData{
|
||||
Result: loginAutoCode,
|
||||
Message: loginAutoMsg,
|
||||
}
|
||||
@@ -71,7 +73,7 @@ func loginAuto(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(ghome.LoginAutoResp{
|
||||
ss.Respond(ghomeschema.LoginAutoResp{
|
||||
Code: loginAutoCode,
|
||||
Msg: loginAutoMsg,
|
||||
Data: base64.StdEncoding.EncodeToString(encryptedData),
|
||||
|
||||
@@ -3,7 +3,7 @@ package account
|
||||
import (
|
||||
"encoding/base64"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -21,7 +21,7 @@ func reportRole(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(ghome.ReportRoleResp{
|
||||
ss.Respond(ghomeschema.ReportRoleResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: base64.StdEncoding.EncodeToString(encryptedToken),
|
||||
|
||||
@@ -3,7 +3,7 @@ package basic
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -20,7 +20,7 @@ func getCode(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(ghome.GetCodeResp{
|
||||
ss.Respond(ghomeschema.GetCodeResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: getCodeData,
|
||||
|
||||
@@ -2,7 +2,7 @@ package basic
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,12 +12,12 @@ func getProductList(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
getProductListData := ghome.GetProductListData{
|
||||
getProductListData := ghomeschema.GetProductListData{
|
||||
Message: []string{},
|
||||
Result: 0,
|
||||
}
|
||||
|
||||
ss.Respond(ghome.GetProductListResp{
|
||||
ss.Respond(ghomeschema.GetProductListResp{
|
||||
Code: 1,
|
||||
Msg: "ok",
|
||||
Data: getProductListData,
|
||||
|
||||
@@ -4,9 +4,8 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
"honoka-chan/pkg/db"
|
||||
"honoka-chan/pkg/encrypt"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"net/url"
|
||||
@@ -34,21 +33,16 @@ func handshake(ctx *gin.Context) {
|
||||
|
||||
params, _ := url.ParseQuery(string(decryptedData))
|
||||
|
||||
randKey := []byte(params.Get("randkey"))
|
||||
deviceID := ss.GetDeviceID()
|
||||
|
||||
err = db.Ldb.Set([]byte(deviceID), randKey)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
randKey := params.Get("randkey")
|
||||
ss.SetRandKey(randKey)
|
||||
|
||||
token := fmt.Sprintf(`{"message":"ok","result":0,"token":"%s"}`, strings.ToUpper(honokautils.RandomStr(33)))
|
||||
encryptedToken, err := openssl.Des3ECBEncrypt([]byte(token), randKey[0:24], openssl.PKCS7_PADDING)
|
||||
encryptedToken, err := openssl.Des3ECBEncrypt([]byte(token), []byte(randKey)[0:24], openssl.PKCS7_PADDING)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(ghome.HandshakeResp{
|
||||
ss.Respond(ghomeschema.HandshakeResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: base64.StdEncoding.EncodeToString(encryptedToken),
|
||||
|
||||
@@ -2,7 +2,7 @@ package basic
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,10 +12,10 @@ func loginArea(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(ghome.LoginAreaResp{
|
||||
ss.Respond(ghomeschema.LoginAreaResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: ghome.LoginAreaData{
|
||||
Data: ghomeschema.LoginAreaData{
|
||||
UserID: ctx.PostForm("userid"),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/pem"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
|
||||
@@ -18,7 +18,7 @@ func publicKey(ctx *gin.Context) {
|
||||
|
||||
publicKeyCode := 0
|
||||
publicKeyMsg := "ok"
|
||||
publicKeyData := ghome.PublicKeyData{
|
||||
publicKeyData := ghomeschema.PublicKeyData{
|
||||
Result: publicKeyCode,
|
||||
Message: publicKeyMsg,
|
||||
}
|
||||
@@ -33,7 +33,7 @@ func publicKey(ctx *gin.Context) {
|
||||
publicKeyData.Method = "rsa"
|
||||
}
|
||||
|
||||
ss.Respond(ghome.PublicKeyResp{
|
||||
ss.Respond(ghomeschema.PublicKeyResp{
|
||||
Code: publicKeyCode,
|
||||
Msg: publicKeyMsg,
|
||||
Data: publicKeyData,
|
||||
|
||||
@@ -2,7 +2,7 @@ package guest
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,10 +12,10 @@ func status(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(ghome.GuestStatusResp{
|
||||
ss.Respond(ghomeschema.GuestStatusResp{
|
||||
Code: 0,
|
||||
Msg: "ok",
|
||||
Data: ghome.GuestStatusData{
|
||||
Data: ghomeschema.GuestStatusData{
|
||||
Disablead: 1,
|
||||
Loginswitch: 1,
|
||||
Message: "ok",
|
||||
|
||||
@@ -2,7 +2,7 @@ package misc
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,11 +12,11 @@ func agreement(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(ghome.AgreementResp{
|
||||
ss.Respond(ghomeschema.AgreementResp{
|
||||
ReturnCode: 0,
|
||||
ErrorType: 0,
|
||||
ReturnMessage: "",
|
||||
Data: ghome.AgreementData{},
|
||||
Data: ghomeschema.AgreementData{},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package misc
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/ghome"
|
||||
ghomeschema "honoka-chan/internal/schema/ghome"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,10 +12,10 @@ func appReport(ctx *gin.Context) {
|
||||
ss := session.New(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(ghome.AppReportResp{
|
||||
ss.Respond(ghomeschema.AppReportResp{
|
||||
Code: 0,
|
||||
Msg: "",
|
||||
Data: ghome.AppReportData{
|
||||
Data: ghomeschema.AppReportData{
|
||||
NeedReport: 0,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@ package lbonus
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/lbonus"
|
||||
lbonusschema "honoka-chan/internal/schema/lbonus"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -35,7 +35,7 @@ func execute(ctx *gin.Context) {
|
||||
d2 := d1.AddDate(0, 1, -1)
|
||||
// fmt.Println(d2)
|
||||
|
||||
weeksList := []lbonus.Day{}
|
||||
weeksList := []lbonusschema.Day{}
|
||||
for c := d1; ; c = c.AddDate(0, 0, 1) {
|
||||
_, _, rd := c.Date()
|
||||
received := false
|
||||
@@ -43,14 +43,14 @@ func execute(ctx *gin.Context) {
|
||||
received = true
|
||||
}
|
||||
rw := weeks[c.Weekday().String()]
|
||||
weeksList = append(weeksList, lbonus.Day{
|
||||
weeksList = append(weeksList, lbonusschema.Day{
|
||||
Day: rd,
|
||||
DayOfTheWeek: rw,
|
||||
SpecialDay: false,
|
||||
SpecialImageAsset: "",
|
||||
Received: received,
|
||||
AdReceived: false,
|
||||
Item: lbonus.Item{
|
||||
Item: lbonusschema.Item{
|
||||
ItemID: 4,
|
||||
AddType: 3001,
|
||||
Amount: 1,
|
||||
@@ -72,18 +72,18 @@ func execute(ctx *gin.Context) {
|
||||
d2 = d1.AddDate(0, 1, -1)
|
||||
// fmt.Println(d2)
|
||||
|
||||
nextWeeksList := []lbonus.Day{}
|
||||
nextWeeksList := []lbonusschema.Day{}
|
||||
for c := d1; ; c = c.AddDate(0, 0, 1) {
|
||||
_, _, rd := c.Date()
|
||||
rw := weeks[c.Weekday().String()]
|
||||
nextWeeksList = append(nextWeeksList, lbonus.Day{
|
||||
nextWeeksList = append(nextWeeksList, lbonusschema.Day{
|
||||
Day: rd,
|
||||
DayOfTheWeek: rw,
|
||||
SpecialDay: false,
|
||||
SpecialImageAsset: "",
|
||||
Received: false,
|
||||
AdReceived: false,
|
||||
Item: lbonus.Item{
|
||||
Item: lbonusschema.Item{
|
||||
ItemID: 4,
|
||||
AddType: 3001,
|
||||
Amount: 1,
|
||||
@@ -94,26 +94,26 @@ func execute(ctx *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
resp := lbonus.ExecuteResp{
|
||||
ResponseData: lbonus.ExecuteData{
|
||||
resp := lbonusschema.ExecuteResp{
|
||||
ResponseData: lbonusschema.ExecuteData{
|
||||
Sheets: []any{},
|
||||
CalendarInfo: lbonus.CalendarInfo{
|
||||
CalendarInfo: lbonusschema.CalendarInfo{
|
||||
CurrentDate: time.Now().Format("2006-01-02 03:04:05"),
|
||||
CurrentMonth: lbonus.Month{
|
||||
CurrentMonth: lbonusschema.Month{
|
||||
Year: y,
|
||||
Month: int(cm),
|
||||
Days: weeksList,
|
||||
},
|
||||
NextMonth: lbonus.Month{
|
||||
NextMonth: lbonusschema.Month{
|
||||
Year: y,
|
||||
Month: int(m),
|
||||
Days: nextWeeksList,
|
||||
},
|
||||
},
|
||||
TotalLoginInfo: lbonus.TotalLoginInfo{
|
||||
TotalLoginInfo: lbonusschema.TotalLoginInfo{
|
||||
LoginCount: 2626,
|
||||
RemainingCount: 74,
|
||||
Reward: []lbonus.Reward{
|
||||
Reward: []lbonusschema.Reward{
|
||||
{
|
||||
ItemID: 5,
|
||||
AddType: 1000,
|
||||
@@ -122,8 +122,8 @@ func execute(ctx *gin.Context) {
|
||||
},
|
||||
},
|
||||
LicenseLbonusList: []any{},
|
||||
ClassSystem: lbonus.ClassSystem{
|
||||
RankInfo: lbonus.RankInfo{
|
||||
ClassSystem: lbonusschema.ClassSystem{
|
||||
RankInfo: lbonusschema.RankInfo{
|
||||
BeforeClassRankID: 10,
|
||||
AfterClassRankID: 10,
|
||||
RankUpDate: "2020-02-12 11:57:15",
|
||||
@@ -133,17 +133,17 @@ func execute(ctx *gin.Context) {
|
||||
IsVisible: true,
|
||||
},
|
||||
StartDashSheets: []any{},
|
||||
EffortPoint: []lbonus.EffortPoint{
|
||||
EffortPoint: []lbonusschema.EffortPoint{
|
||||
{
|
||||
LiveEffortPointBoxSpecID: 5,
|
||||
Capacity: 4000000,
|
||||
Before: 1400116,
|
||||
After: 1400116,
|
||||
Rewards: []lbonus.Rewards{},
|
||||
Rewards: []lbonusschema.Rewards{},
|
||||
},
|
||||
},
|
||||
LimitedEffortBox: []any{},
|
||||
MuseumInfo: lbonus.Museum{},
|
||||
MuseumInfo: lbonusschema.Museum{},
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
PresentCnt: 0,
|
||||
},
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package live
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func continuee(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(liveschema.ContinueResp{
|
||||
ResponseData: liveschema.ContinueData{
|
||||
BeforeSnsCoin: 100000,
|
||||
AfterSnsCoin: 100000,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("main.php", "POST", "/live/continue", middleware.Common, continuee)
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package live
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/live"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -11,9 +11,12 @@ import (
|
||||
|
||||
func gameOver(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
defer func() {
|
||||
ss.ClearLiveInProgress()
|
||||
ss.Finalize()
|
||||
}()
|
||||
|
||||
ss.Respond(live.GameOverResp{
|
||||
ss.Respond(liveschema.GameOverResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package live
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"honoka-chan/internal/middleware"
|
||||
unitmodel "honoka-chan/internal/model/unit"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -14,14 +17,81 @@ func partyList(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
data := honokautils.ReadAllText("assets/serverdata/partylist.json")
|
||||
var partyResp map[string]any
|
||||
err := json.Unmarshal([]byte(data), &partyResp)
|
||||
pref := usermodel.UserPref{}
|
||||
_, err := ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Get(&pref)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(partyResp)
|
||||
// TODO: 好友功能实装前先使用自己的卡组助战
|
||||
var unitList []usermodel.UserDeckUnit
|
||||
err = ss.UserEng.Table("user_deck_unit").Where("user_id = ? AND position = 5", ss.UserID).Find(&unitList)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
var partyList []liveschema.PartyList
|
||||
for _, u := range unitList {
|
||||
var unitInfo unitmodel.UnitDataMap
|
||||
has, err := ss.GetBasicUnitInfo().
|
||||
Where("unit_owning_user_id = ?", u.UnitOwningUserID).Get(&unitInfo)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
if !has {
|
||||
ss.Abort(errors.New("卡片不存在!"))
|
||||
return
|
||||
}
|
||||
|
||||
partyList = append(partyList, liveschema.PartyList{
|
||||
UserInfo: ss.GetUserInfo(),
|
||||
CenterUnitInfo: liveschema.CenterUnitInfo{
|
||||
UnitOwningUserID: u.UnitOwningUserID,
|
||||
UnitID: u.UnitID,
|
||||
Exp: unitInfo.Exp,
|
||||
NextExp: 0,
|
||||
Level: u.Level,
|
||||
LevelLimitID: u.LevelLimitID,
|
||||
MaxLevel: unitInfo.MaxLevel,
|
||||
Rank: unitInfo.Rank,
|
||||
MaxRank: unitInfo.MaxRank,
|
||||
Love: u.Love,
|
||||
MaxLove: u.MaxLove,
|
||||
UnitSkillLevel: u.UnitSkillLevel,
|
||||
MaxHp: unitInfo.MaxHp,
|
||||
FavoriteFlag: unitInfo.FavoriteFlag,
|
||||
DisplayRank: u.DisplayRank,
|
||||
UnitSkillExp: unitInfo.UnitSkillExp,
|
||||
UnitRemovableSkillCapacity: unitInfo.UnitRemovableSkillCapacity,
|
||||
Attribute: unitInfo.Attribute,
|
||||
Smile: unitInfo.Smile,
|
||||
Cute: unitInfo.Cute,
|
||||
Cool: unitInfo.Cool,
|
||||
IsLoveMax: u.IsLoveMax,
|
||||
IsLevelMax: u.IsLevelMax,
|
||||
IsRankMax: u.IsRankMax,
|
||||
IsSigned: u.IsSigned,
|
||||
IsSkillLevelMax: unitInfo.IsSkillLevelMax,
|
||||
SettingAwardID: pref.AwardID,
|
||||
RemovableSkillIds: []int{},
|
||||
},
|
||||
SettingAwardID: pref.AwardID,
|
||||
AvailableSocialPoint: 10,
|
||||
FriendStatus: 1,
|
||||
})
|
||||
}
|
||||
|
||||
ss.Respond(liveschema.PartyListResp{
|
||||
ResponseData: liveschema.PartyListData{
|
||||
PartyList: partyList,
|
||||
TrainingEnergy: 10,
|
||||
TrainingEnergyMax: 10,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
+131
-142
@@ -2,172 +2,143 @@ package live
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/internal/middleware"
|
||||
unitmodel "honoka-chan/internal/model/unit"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/live"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
"honoka-chan/internal/session"
|
||||
"honoka-chan/pkg/db"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
func play(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
playReq := live.PlayReq{}
|
||||
playReq := liveschema.PlayReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &playReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
// fmt.Println(ctx.MustGet("request_data").(string))
|
||||
|
||||
tDifficultyId := playReq.LiveDifficultyID
|
||||
difficultyId, err := strconv.Atoi(tDifficultyId)
|
||||
ss.RegisterLiveInProgress(playReq.UnitDeckID)
|
||||
|
||||
difficultyID, _ := strconv.Atoi(playReq.LiveDifficultyID)
|
||||
|
||||
// 歌曲类型: normal / special
|
||||
// sqlite3 不支持 FULL OUTER JOIN 所以这里使用 UNION ALL
|
||||
var liveSetting struct {
|
||||
NotesSettingAsset string `xorm:"notes_setting_asset"`
|
||||
ARankScore int `xorm:"a_rank_score"`
|
||||
BRankScore int `xorm:"b_rank_score"`
|
||||
CRankScore int `xorm:"c_rank_score"`
|
||||
SRankScore int `xorm:"s_rank_score"`
|
||||
AcFlag int `xorm:"ac_flag"`
|
||||
SwingFlag int `xorm:"swing_flag"`
|
||||
}
|
||||
sql := `
|
||||
SELECT notes_setting_asset,
|
||||
a_rank_score,
|
||||
b_rank_score,
|
||||
c_rank_score,
|
||||
s_rank_score,
|
||||
ac_flag,
|
||||
swing_flag
|
||||
FROM live_setting_m
|
||||
WHERE live_setting_id IN (
|
||||
SELECT live_setting_id
|
||||
FROM normal_live_m
|
||||
WHERE live_difficulty_id = ?
|
||||
UNION ALL
|
||||
SELECT live_setting_id
|
||||
FROM special_live_m
|
||||
WHERE live_difficulty_id = ?
|
||||
)
|
||||
`
|
||||
_, err = ss.MainEng.SQL(sql, difficultyID, difficultyID).Get(&liveSetting)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
deckId := playReq.UnitDeckID
|
||||
// fmt.Println("liveSetting", liveSetting)
|
||||
|
||||
// Save Deck Id for /live/reward
|
||||
key := "live_deck_" + strconv.Itoa(ss.UserID)
|
||||
err = db.Ldb.Set([]byte(key), []byte(strconv.Itoa(deckId)))
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// Song type: normal / special
|
||||
// sqlite3 doesn't support FULL OUTER JOIN so use UNION ALL here.
|
||||
sql := `SELECT notes_setting_asset,c_rank_score,b_rank_score,a_rank_score,s_rank_score,ac_flag,swing_flag FROM live_setting_m WHERE live_setting_id IN (SELECT live_setting_id FROM normal_live_m WHERE live_difficulty_id = ? UNION ALL SELECT live_setting_id FROM special_live_m WHERE live_difficulty_id = ?)`
|
||||
var notes_setting_asset string
|
||||
var c_rank_score, b_rank_score, a_rank_score, s_rank_score, ac_flag, swing_flag int
|
||||
err = ss.MainEng.DB().QueryRow(sql, difficultyId, difficultyId).Scan(¬es_setting_asset, &c_rank_score, &b_rank_score, &a_rank_score, &s_rank_score, &ac_flag, &swing_flag)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// fmt.Println(notes_setting_asset)
|
||||
// fmt.Println(c_rank_score, b_rank_score, a_rank_score, s_rank_score)
|
||||
|
||||
notes := []live.NotesList{}
|
||||
// fmt.Println("./assets/serverdata/beatmaps/" + notes_setting_asset)
|
||||
notes_list := honokautils.ReadAllText("./assets/serverdata/beatmaps/" + notes_setting_asset)
|
||||
notes := []liveschema.NotesList{}
|
||||
notes_list := honokautils.ReadAllText("./assets/serverdata/beatmaps/" + liveSetting.NotesSettingAsset)
|
||||
err = json.Unmarshal([]byte(notes_list), ¬es)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ranks := []live.RankInfo{}
|
||||
ranks = append(ranks, live.RankInfo{
|
||||
ranks := []liveschema.RankInfo{}
|
||||
ranks = append(ranks, liveschema.RankInfo{
|
||||
Rank: 5,
|
||||
RankMin: 0,
|
||||
RankMax: c_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMax: liveSetting.CRankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 4,
|
||||
RankMin: c_rank_score + 1,
|
||||
RankMax: b_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMin: liveSetting.CRankScore + 1,
|
||||
RankMax: liveSetting.BRankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 3,
|
||||
RankMin: b_rank_score + 1,
|
||||
RankMax: a_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMin: liveSetting.BRankScore + 1,
|
||||
RankMax: liveSetting.ARankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 2,
|
||||
RankMin: a_rank_score + 1,
|
||||
RankMax: s_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMin: liveSetting.ARankScore + 1,
|
||||
RankMax: liveSetting.SRankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 1,
|
||||
RankMin: s_rank_score + 1,
|
||||
RankMin: liveSetting.SRankScore + 1,
|
||||
RankMax: 0,
|
||||
})
|
||||
|
||||
// ss.UserEng.ShowSQL(true)
|
||||
// ss.MainEng.ShowSQL(true)
|
||||
owningIdList := []int{}
|
||||
err = ss.UserEng.Table("user_deck_unit").Join("LEFT", "user_deck", "user_deck_unit.user_deck_id = user_deck.id").
|
||||
Where("user_id = ? AND deck_id = ?", ss.UserID, deckId).Cols("unit_owning_user_id").
|
||||
OrderBy("user_deck_unit.position ASC").Find(&owningIdList)
|
||||
err = ss.UserEng.Table("user_deck_unit").
|
||||
Join("LEFT", "user_deck", "user_deck_unit.user_deck_id = user_deck.id").
|
||||
Where("user_deck.user_id = ? AND user_deck.deck_id = ?", ss.UserID, playReq.UnitDeckID).
|
||||
Cols("unit_owning_user_id").OrderBy("user_deck_unit.position ASC").Find(&owningIdList)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
unitList := []live.UnitList{}
|
||||
var totalSmile, totalPure, totalCool, maxLove float64
|
||||
unitList := []liveschema.UnitList{}
|
||||
var totalSmile, totalPure, totalCool float64
|
||||
var totalHp int
|
||||
for _, owningId := range owningIdList {
|
||||
var uId int
|
||||
exists, err := ss.MainEng.Table("common_unit_m").Where("unit_owning_user_id = ?", owningId).Cols("unit_id").Get(&uId)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
var maxHp, attrId, unitTypeId int
|
||||
// 卡片基础属性
|
||||
var baseSmile, basePure, baseCool, smileMax, pureMax, coolMax float64
|
||||
if exists {
|
||||
// 公共卡片仅为100级属性
|
||||
_, err = ss.MainEng.Table("unit_m").Where("unit_id = ?", uId).
|
||||
Join("LEFT", "unit_rarity_m", "unit_m.rarity = unit_rarity_m.rarity").
|
||||
Cols("attribute_id,hp_max,smile_max,pure_max,cool_max,after_love_max,unit_type_id").
|
||||
Get(&attrId, &maxHp, &baseSmile, &basePure, &baseCool, &maxLove, &unitTypeId)
|
||||
var unitData unitmodel.UnitDataMap
|
||||
_, err = ss.GetBasicUnitInfo().Where("unit_owning_user_id = ?", owningId).Get(&unitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// 用户卡片暂时固定为满级350级
|
||||
exists, err := ss.UserEng.Table("user_unit").Where("unit_owning_user_id = ?", owningId).Cols("unit_id").Get(&uId)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
if exists {
|
||||
// 卡片100级基础属性
|
||||
_, err = ss.MainEng.Table("unit_m").Where("unit_id = ?", uId).
|
||||
Join("LEFT", "unit_rarity_m", "unit_m.rarity = unit_rarity_m.rarity").
|
||||
Cols("attribute_id,hp_max,smile_max,pure_max,cool_max,after_love_max,unit_type_id").
|
||||
Get(&attrId, &maxHp, &baseSmile, &basePure, &baseCool, &maxLove, &unitTypeId)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// 增量属性
|
||||
var diffSmile, diffPure, diffCool float64
|
||||
_, err = ss.MainEng.Table("unit_level_limit_pattern_m").Where("unit_level_limit_id = 1 AND unit_level = 350").
|
||||
Cols("smile_diff,pure_diff,cool_diff").Get(&diffSmile, &diffPure, &diffCool)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// 更新卡片属性(注意这里是负数,要用减号)
|
||||
baseSmile -= diffSmile
|
||||
basePure -= diffPure
|
||||
baseCool -= diffCool
|
||||
} else {
|
||||
err = fmt.Errorf("no such unit owning id: %d", owningId)
|
||||
}
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
baseSmile = float64(unitData.Smile)
|
||||
basePure = float64(unitData.Cute)
|
||||
baseCool = float64(unitData.Cool)
|
||||
// fmt.Println("================================")
|
||||
// fmt.Println("基础属性:", baseSmile, basePure, baseCool)
|
||||
|
||||
// 饰品属性加成(满级)
|
||||
var accessoryOwningId int
|
||||
_, err = ss.UserEng.Table("user_accessory_wear").Where("unit_owning_user_id = ?", owningId).
|
||||
exists, err := ss.UserEng.Table("user_accessory_wear").
|
||||
Where("unit_owning_user_id = ?", owningId).
|
||||
Cols("accessory_owning_user_id").Get(&accessoryOwningId)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
if exists {
|
||||
var smileAccessory, pureAccessory, coolAccessory float64
|
||||
_, err = ss.MainEng.Table("common_accessory_m").Join("LEFT", "accessory_m", "common_accessory_m.accessory_id = accessory_m.accessory_id").
|
||||
_, err = ss.MainEng.Table("common_accessory_m").
|
||||
Join("LEFT", "accessory_m", "common_accessory_m.accessory_id = accessory_m.accessory_id").
|
||||
Where("accessory_owning_user_id = ?", accessoryOwningId).Cols("smile_max,pure_max,cool_max").
|
||||
Get(&smileAccessory, &pureAccessory, &coolAccessory)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
// fmt.Println("基础属性:", baseSmile, basePure, baseCool)
|
||||
|
||||
// 饰品属性加成(该加成会影响个宝等百分比宝石属性加成的计算,故先计算。)
|
||||
baseSmile += smileAccessory
|
||||
@@ -175,10 +146,13 @@ func play(ctx *gin.Context) {
|
||||
baseCool += coolAccessory
|
||||
// fmt.Println("饰品属性加成:", smileAccessory, pureAccessory, coolAccessory)
|
||||
// fmt.Println("饰品属性加成后的基础属性:", baseSmile, basePure, baseCool)
|
||||
}
|
||||
|
||||
// 回忆画廊属性加成(该加成会影响个宝等百分比宝石属性加成的计算,故先计算。)
|
||||
var smileBuff, pureBuff, coolBuff float64
|
||||
_, err = ss.MainEng.Table("museum_contents_m").Select("SUM(smile_buff),SUM(pure_buff),SUM(cool_buff)").Get(&smileBuff, &pureBuff, &coolBuff)
|
||||
_, err = ss.MainEng.Table("museum_contents_m").
|
||||
Select("SUM(smile_buff),SUM(pure_buff),SUM(cool_buff)").
|
||||
Get(&smileBuff, &pureBuff, &coolBuff)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
@@ -189,26 +163,25 @@ func play(ctx *gin.Context) {
|
||||
// fmt.Println("回忆画廊属性加成后的基础属性:", baseSmile, basePure, baseCool)
|
||||
|
||||
// 绊属性加成(该加成会影响个宝等百分比宝石属性加成的计算,故先计算。)
|
||||
switch attrId {
|
||||
switch unitData.Attribute {
|
||||
case 1:
|
||||
baseSmile += maxLove
|
||||
baseSmile += float64(unitData.MaxLove)
|
||||
case 2:
|
||||
basePure += maxLove
|
||||
basePure += float64(unitData.MaxLove)
|
||||
case 3:
|
||||
baseCool += maxLove
|
||||
baseCool += float64(unitData.MaxLove)
|
||||
}
|
||||
// fmt.Println("绊属性加成:", maxLove)
|
||||
// fmt.Println("绊属性加成:", unitData.MaxLove)
|
||||
// fmt.Println("绊属性加成后的基础属性:", baseSmile, basePure, baseCool)
|
||||
|
||||
// 宝石属性加成
|
||||
var kissSmile, kissPure, kissCool float64
|
||||
var skillSmile, skillPure, skillCool float64
|
||||
// var mainCenterSmile, mainCenterPure, mainCenterCool float64
|
||||
// var secCenterSmile, secCenterPure, secCenterCool float64
|
||||
|
||||
// 宝石加成(满级)
|
||||
removableSkillIds := []int{}
|
||||
err = ss.UserEng.Table("user_unit_skill_equip").Where("unit_owning_user_id = ? AND user_id = ?", owningId, ss.UserID).
|
||||
err = ss.UserEng.Table("user_unit_skill_equip").
|
||||
Where("unit_owning_user_id = ?", owningId).
|
||||
Cols("unit_removable_skill_id").Find(&removableSkillIds)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -218,7 +191,8 @@ func play(ctx *gin.Context) {
|
||||
// 判断宝石效果类型(效果范围、效果类型、效果值、是否固定数值)
|
||||
var effectRange, effectType, fixedValueFlag, refType int
|
||||
var effectValue float64
|
||||
_, err = ss.MainEng.Table("unit_removable_skill_m").Where("unit_removable_skill_id = ?", sk).
|
||||
_, err = ss.MainEng.Table("unit_removable_skill_m").
|
||||
Where("unit_removable_skill_id = ?", sk).
|
||||
Cols("effect_range,effect_type,effect_value,fixed_value_flag,target_reference_type").
|
||||
Get(&effectRange, &effectType, &effectValue, &fixedValueFlag, &refType)
|
||||
if ss.CheckErr(err) {
|
||||
@@ -276,7 +250,8 @@ func play(ctx *gin.Context) {
|
||||
|
||||
// 主唱技能加成
|
||||
var myCenterUnitId int
|
||||
_, err = ss.UserEng.Table("user_deck_unit").Join("LEFT", "user_deck", "user_deck_unit.user_deck_id = user_deck.id").
|
||||
_, err = ss.UserEng.Table("user_deck_unit").
|
||||
Join("LEFT", "user_deck", "user_deck_unit.user_deck_id = user_deck.id").
|
||||
Where("user_deck.deck_id = ? AND user_deck.user_id = ? AND user_deck_unit.position = 5", playReq.UnitDeckID, ss.UserID).
|
||||
Cols("user_deck_unit.unit_id").Get(&myCenterUnitId)
|
||||
if ss.CheckErr(err) {
|
||||
@@ -310,16 +285,18 @@ func play(ctx *gin.Context) {
|
||||
_, err = ss.MainEng.Table("unit_m").
|
||||
Join("LEFT", "unit_leader_skill_extra_m", "unit_m.default_leader_skill_id = unit_leader_skill_extra_m.unit_leader_skill_id").
|
||||
Where("unit_m.unit_id = ?", myCenterUnitId).
|
||||
Cols("unit_leader_skill_extra_m.effect_value,unit_leader_skill_extra_m.member_tag_id").Get(&mySubEffectValue, &myMemberTagId)
|
||||
Cols("unit_leader_skill_extra_m.effect_value,unit_leader_skill_extra_m.member_tag_id").
|
||||
Get(&mySubEffectValue, &myMemberTagId)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
exists, err = ss.MainEng.Table("unit_type_member_tag_m").
|
||||
Where("unit_type_id = ? AND member_tag_id = ?", unitTypeId, myMemberTagId).Exist()
|
||||
Where("unit_type_id = ? AND member_tag_id = ?", unitData.UnitTypeID, myMemberTagId).Exist()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
var mySubSmile, mySubPure, mySubCool float64
|
||||
if exists {
|
||||
switch myAttrId {
|
||||
@@ -335,24 +312,26 @@ func play(ctx *gin.Context) {
|
||||
|
||||
// 好友主唱技能加成
|
||||
// TODO 好友支援存入数据库
|
||||
var tomoUnitId int64
|
||||
partyList := gjson.Parse(honokautils.ReadAllText("assets/serverdata/partylist.json")).Get("response_data.party_list")
|
||||
partyList.ForEach(func(key, value gjson.Result) bool {
|
||||
if value.Get("user_info.user_id").Int() == playReq.PartyUserID {
|
||||
tomoUnitId = value.Get("center_unit_info.unit_id").Int()
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
// var tomoUnitId int64
|
||||
// partyList := gjson.Parse(honokautils.ReadAllText("assets/serverdata/partylist.json")).Get("response_data.party_list")
|
||||
// partyList.ForEach(func(key, value gjson.Result) bool {
|
||||
// if value.Get("user_info.user_id").Int() == playReq.PartyUserID {
|
||||
// tomoUnitId = value.Get("center_unit_info.unit_id").Int()
|
||||
// return false
|
||||
// }
|
||||
// return true
|
||||
// })
|
||||
// TODO: 好友功能实装前先使用自己的卡组助战
|
||||
tomoUnitId := myCenterUnitId
|
||||
// fmt.Println("好友UnitID:", tomoUnitId)
|
||||
|
||||
// 好友主唱技能加成:主C技能(这里不使用新C技能,即以某属性的百分比提升另一属性)
|
||||
var tomoAttrId int
|
||||
var tomoEffectValue float64
|
||||
_, err = ss.MainEng.Table("unit_m").
|
||||
Join("LEFT", "unit_leader_skill_m", "unit_m.default_leader_skill_id = unit_leader_skill_m.unit_leader_skill_id").
|
||||
Where("unit_m.unit_id = ?", tomoUnitId).
|
||||
Cols("unit_m.attribute_id,unit_leader_skill_m.effect_value").Get(&tomoAttrId, &tomoEffectValue)
|
||||
Cols("unit_leader_skill_m.effect_value").
|
||||
Get(&tomoEffectValue)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
@@ -373,13 +352,14 @@ func play(ctx *gin.Context) {
|
||||
_, err = ss.MainEng.Table("unit_m").
|
||||
Join("LEFT", "unit_leader_skill_extra_m", "unit_m.default_leader_skill_id = unit_leader_skill_extra_m.unit_leader_skill_id").
|
||||
Where("unit_m.unit_id = ?", tomoUnitId).
|
||||
Cols("unit_leader_skill_extra_m.effect_value,unit_leader_skill_extra_m.member_tag_id").Get(&tomoSubEffectValue, &tomoMemberTagId)
|
||||
Cols("unit_leader_skill_extra_m.effect_value,unit_leader_skill_extra_m.member_tag_id").
|
||||
Get(&tomoSubEffectValue, &tomoMemberTagId)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
exists, err = ss.MainEng.Table("unit_type_member_tag_m").
|
||||
Where("unit_type_id = ? AND member_tag_id = ?", unitTypeId, tomoMemberTagId).Exist()
|
||||
Where("unit_type_id = ? AND member_tag_id = ?", unitData.UnitTypeID, tomoMemberTagId).Exist()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
@@ -400,7 +380,16 @@ func play(ctx *gin.Context) {
|
||||
totalSmile += smileMax + myCenterSmile + mySubSmile + tomoCenterSmile + tomoSubSmile
|
||||
totalPure += pureMax + myCenterPure + mySubPure + tomoCenterPure + tomoSubPure
|
||||
totalCool += coolMax + myCenterCool + mySubCool + tomoCenterCool + tomoSubCool
|
||||
totalHp += maxHp
|
||||
totalHp += unitData.MaxHp
|
||||
// fmt.Println("smileMax, myCenterSmile, mySubSmile, tomoCenterSmile, tomoSubSmile, totalSmile",
|
||||
// smileMax, myCenterSmile, mySubSmile, tomoCenterSmile, tomoSubSmile,
|
||||
// smileMax+myCenterSmile+mySubSmile+tomoCenterSmile+tomoSubSmile)
|
||||
// fmt.Println("pureMax, myCenterPure, mySubPure, tomoCenterPure, tomoSubPure, totalPure",
|
||||
// pureMax, myCenterPure, mySubPure, tomoCenterPure, tomoSubPure,
|
||||
// pureMax+myCenterPure+mySubPure+tomoCenterPure+tomoSubPure)
|
||||
// fmt.Println("coolMax, myCenterCool, mySubCool, tomoCenterCool, tomoSubCool, totalPure",
|
||||
// coolMax, myCenterCool, mySubCool, tomoCenterCool, tomoSubCool,
|
||||
// coolMax+myCenterCool+mySubCool+tomoCenterCool+tomoSubCool)
|
||||
|
||||
// 单卡属性计算结果取上取整
|
||||
fixedSmileMax := int(smileMax)
|
||||
@@ -408,7 +397,7 @@ func play(ctx *gin.Context) {
|
||||
fixedCoolMax := int(coolMax)
|
||||
// fmt.Println("单卡属性:", fixedSmileMax, fixedPureMax, fixedCoolMax)
|
||||
|
||||
unitList = append(unitList, live.UnitList{
|
||||
unitList = append(unitList, liveschema.UnitList{
|
||||
Smile: fixedSmileMax,
|
||||
Cute: fixedPureMax,
|
||||
Cool: fixedCoolMax,
|
||||
@@ -421,17 +410,17 @@ func play(ctx *gin.Context) {
|
||||
fixedTotalCool := int(math.Ceil(totalCool))
|
||||
// fmt.Println("全卡组属性:", fixedTotalSmile, fixedTotalPure, fixedTotalCool)
|
||||
|
||||
lives := []live.PlayLiveList{}
|
||||
lives = append(lives, live.PlayLiveList{
|
||||
LiveInfo: live.LiveInfo{
|
||||
LiveDifficultyID: difficultyId,
|
||||
lives := []liveschema.PlayLiveList{}
|
||||
lives = append(lives, liveschema.PlayLiveList{
|
||||
LiveInfo: liveschema.LiveInfo{
|
||||
LiveDifficultyID: difficultyID,
|
||||
IsRandom: false,
|
||||
AcFlag: ac_flag,
|
||||
SwingFlag: swing_flag,
|
||||
AcFlag: liveSetting.AcFlag,
|
||||
SwingFlag: liveSetting.SwingFlag,
|
||||
NotesList: notes,
|
||||
},
|
||||
DeckInfo: live.DeckInfo{
|
||||
UnitDeckID: deckId,
|
||||
DeckInfo: liveschema.DeckInfo{
|
||||
UnitDeckID: playReq.UnitDeckID,
|
||||
TotalSmile: fixedTotalSmile,
|
||||
TotalCute: fixedTotalPure,
|
||||
TotalCool: fixedTotalCool,
|
||||
@@ -441,8 +430,8 @@ func play(ctx *gin.Context) {
|
||||
},
|
||||
})
|
||||
|
||||
playResp := live.PlayResp{
|
||||
ResponseData: live.PlayData{
|
||||
playResp := liveschema.PlayResp{
|
||||
ResponseData: liveschema.PlayData{
|
||||
RankInfo: ranks,
|
||||
EnergyFullTime: "2023-03-20 01:28:55",
|
||||
OverMaxEnergy: 0,
|
||||
|
||||
@@ -2,11 +2,13 @@ package live
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/constant"
|
||||
"honoka-chan/internal/middleware"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/live"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"honoka-chan/pkg/utils"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -17,81 +19,113 @@ func preciseScore(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
playScoreReq := live.PlayScoreReq{}
|
||||
playScoreReq := liveschema.PlayScoreReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &playScoreReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
// fmt.Println(ctx.MustGet("request_data").(string))
|
||||
|
||||
tDifficultyId := playScoreReq.LiveDifficultyID
|
||||
difficultyId, err := strconv.Atoi(tDifficultyId)
|
||||
difficultyID, _ := strconv.Atoi(playScoreReq.LiveDifficultyID)
|
||||
|
||||
// 歌曲类型: normal / special
|
||||
// sqlite3 不支持 FULL OUTER JOIN 所以这里使用 UNION ALL
|
||||
var liveSetting struct {
|
||||
NotesSettingAsset string `xorm:"notes_setting_asset"`
|
||||
ARankScore int `xorm:"a_rank_score"`
|
||||
BRankScore int `xorm:"b_rank_score"`
|
||||
CRankScore int `xorm:"c_rank_score"`
|
||||
SRankScore int `xorm:"s_rank_score"`
|
||||
AcFlag int `xorm:"ac_flag"`
|
||||
SwingFlag int `xorm:"swing_flag"`
|
||||
}
|
||||
sql := `
|
||||
SELECT notes_setting_asset,
|
||||
a_rank_score,
|
||||
b_rank_score,
|
||||
c_rank_score,
|
||||
s_rank_score,
|
||||
ac_flag,
|
||||
swing_flag
|
||||
FROM live_setting_m
|
||||
WHERE live_setting_id IN (
|
||||
SELECT live_setting_id
|
||||
FROM normal_live_m
|
||||
WHERE live_difficulty_id = ?
|
||||
UNION ALL
|
||||
SELECT live_setting_id
|
||||
FROM special_live_m
|
||||
WHERE live_difficulty_id = ?
|
||||
)
|
||||
`
|
||||
_, err = ss.MainEng.SQL(sql, difficultyID, difficultyID).Get(&liveSetting)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
// fmt.Println("liveSetting", liveSetting)
|
||||
|
||||
// Song type: normal / special
|
||||
// sqlite3 doesn't support FULL OUTER JOIN so use UNION ALL here.
|
||||
sql := `SELECT notes_setting_asset,c_rank_score,b_rank_score,a_rank_score,s_rank_score,ac_flag,swing_flag FROM live_setting_m WHERE live_setting_id IN (SELECT live_setting_id FROM normal_live_m WHERE live_difficulty_id = ? UNION ALL SELECT live_setting_id FROM special_live_m WHERE live_difficulty_id = ?)`
|
||||
var notes_setting_asset string
|
||||
var c_rank_score, b_rank_score, a_rank_score, s_rank_score, ac_flag, swing_flag int
|
||||
err = ss.MainEng.DB().QueryRow(sql, difficultyId, difficultyId).Scan(¬es_setting_asset, &c_rank_score, &b_rank_score, &a_rank_score, &s_rank_score, &ac_flag, &swing_flag)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// fmt.Println(notes_setting_asset)
|
||||
// fmt.Println(c_rank_score, b_rank_score, a_rank_score, s_rank_score)
|
||||
|
||||
notes := []live.NotesList{}
|
||||
// fmt.Println("./assets/serverdata/beatmaps/" + notes_setting_asset)
|
||||
notes_list := honokautils.ReadAllText("./assets/serverdata/beatmaps/" + notes_setting_asset)
|
||||
notes := []liveschema.NotesList{}
|
||||
notes_list := utils.ReadAllText("./assets/serverdata/beatmaps/" + liveSetting.NotesSettingAsset)
|
||||
err = json.Unmarshal([]byte(notes_list), ¬es)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ranks := []live.RankInfo{}
|
||||
ranks = append(ranks, live.RankInfo{
|
||||
ranks := []liveschema.RankInfo{}
|
||||
ranks = append(ranks, liveschema.RankInfo{
|
||||
Rank: 5,
|
||||
RankMin: 0,
|
||||
RankMax: c_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMax: liveSetting.CRankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 4,
|
||||
RankMin: c_rank_score + 1,
|
||||
RankMax: b_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMin: liveSetting.CRankScore + 1,
|
||||
RankMax: liveSetting.BRankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 3,
|
||||
RankMin: b_rank_score + 1,
|
||||
RankMax: a_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMin: liveSetting.BRankScore + 1,
|
||||
RankMax: liveSetting.ARankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 2,
|
||||
RankMin: a_rank_score + 1,
|
||||
RankMax: s_rank_score,
|
||||
}, live.RankInfo{
|
||||
RankMin: liveSetting.ARankScore + 1,
|
||||
RankMax: liveSetting.SRankScore,
|
||||
}, liveschema.RankInfo{
|
||||
Rank: 1,
|
||||
RankMin: s_rank_score + 1,
|
||||
RankMin: liveSetting.SRankScore + 1,
|
||||
RankMax: 0,
|
||||
})
|
||||
|
||||
playResp := live.PreciseScoreResp{
|
||||
ResponseData: live.PreciseScoreData{
|
||||
On: live.On{
|
||||
// 检查是否正在进行 Live
|
||||
progress, _ := ss.GetLiveInProgress()
|
||||
|
||||
// 检查是否有 Live 记录
|
||||
liveRecord := ss.GetUserLiveRecord(difficultyID)
|
||||
|
||||
var skillOn liveschema.Skill
|
||||
var skillOff liveschema.Skill
|
||||
var playResp liveschema.PreciseScoreResp
|
||||
|
||||
// 正在进行 Live
|
||||
if progress {
|
||||
// 返回默认
|
||||
playResp = liveschema.PreciseScoreResp{
|
||||
ResponseData: liveschema.PreciseScoreData{
|
||||
On: liveschema.Skill{
|
||||
HasRecord: false,
|
||||
LiveInfo: live.LiveInfo{
|
||||
LiveDifficultyID: difficultyId,
|
||||
LiveInfo: liveschema.LiveInfo{
|
||||
LiveDifficultyID: difficultyID,
|
||||
IsRandom: false,
|
||||
AcFlag: ac_flag,
|
||||
SwingFlag: swing_flag,
|
||||
AcFlag: liveSetting.AcFlag,
|
||||
SwingFlag: liveSetting.SwingFlag,
|
||||
NotesList: notes,
|
||||
},
|
||||
},
|
||||
Off: live.Off{
|
||||
Off: liveschema.Skill{
|
||||
HasRecord: false,
|
||||
LiveInfo: live.LiveInfo{
|
||||
LiveDifficultyID: difficultyId,
|
||||
LiveInfo: liveschema.LiveInfo{
|
||||
LiveDifficultyID: difficultyID,
|
||||
IsRandom: false,
|
||||
AcFlag: ac_flag,
|
||||
SwingFlag: swing_flag,
|
||||
AcFlag: liveSetting.AcFlag,
|
||||
SwingFlag: liveSetting.SwingFlag,
|
||||
NotesList: notes,
|
||||
},
|
||||
},
|
||||
@@ -102,6 +136,109 @@ func preciseScore(ctx *gin.Context) {
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
} else {
|
||||
// 如果有 Live 记录
|
||||
if len(liveRecord) > 0 {
|
||||
skillOn = liveschema.Skill{
|
||||
HasRecord: false,
|
||||
RandomSeed: nil,
|
||||
MaxCombo: nil,
|
||||
UpdateDate: nil,
|
||||
PreciseList: nil,
|
||||
DeckInfo: nil,
|
||||
TapAdjust: nil, // TODO: 不知道保存在哪里
|
||||
CanReplay: false, // TODO: 不知道保存在哪里
|
||||
}
|
||||
skillOff = skillOn
|
||||
|
||||
// 已完成的 Live 判断技能开关情况
|
||||
for _, record := range liveRecord {
|
||||
// LiveInfo
|
||||
var liveInfo liveschema.LiveInfo
|
||||
err = json.Unmarshal([]byte(record.LiveInfoJSON), &liveInfo)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
liveInfo.NotesList = notes
|
||||
|
||||
// PreciseList
|
||||
var preciseList []liveschema.PreciseList
|
||||
err = json.Unmarshal([]byte(record.PreciseListJSON), &preciseList)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// DeckInfo
|
||||
var deckInfo usermodel.DeckInfo
|
||||
err = json.Unmarshal([]byte(record.DeckInfoJSON), &deckInfo)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// LiveSetting
|
||||
var liveSetting liveschema.LiveSetting
|
||||
err = json.Unmarshal([]byte(record.LiveSettingJSON), &liveSetting)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// TriggerLog
|
||||
var triggerLog []liveschema.TriggerLog
|
||||
err = json.Unmarshal([]byte(record.TriggerLogJSON), &triggerLog)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
if record.IsSkillOn {
|
||||
// 技能开
|
||||
skillOn.HasRecord = true
|
||||
skillOn.LiveInfo = liveInfo
|
||||
skillOn.RandomSeed = time.Now().Unix() // TODO: 从 /live/play 的 Timestamp 字段获取
|
||||
skillOn.MaxCombo = record.MaxCombo
|
||||
skillOn.UpdateDate = record.UpdateDate
|
||||
skillOn.PreciseList = preciseList
|
||||
skillOn.DeckInfo = deckInfo
|
||||
skillOn.LiveSetting = liveSetting
|
||||
skillOn.TriggerLog = triggerLog
|
||||
skillOn.TapAdjust = record.TapAdjust
|
||||
skillOn.CanReplay = record.CanReplay
|
||||
} else {
|
||||
// 技能关
|
||||
skillOff.HasRecord = true
|
||||
skillOff.LiveInfo = liveInfo
|
||||
skillOff.RandomSeed = time.Now().Unix() // TODO: 从 /live/play 的 Timestamp 字段获取
|
||||
skillOff.MaxCombo = record.MaxCombo
|
||||
skillOff.UpdateDate = record.UpdateDate
|
||||
skillOff.PreciseList = preciseList
|
||||
skillOff.DeckInfo = deckInfo
|
||||
skillOff.LiveSetting = liveSetting
|
||||
skillOff.TriggerLog = triggerLog
|
||||
skillOff.TapAdjust = record.TapAdjust
|
||||
skillOff.CanReplay = record.CanReplay
|
||||
}
|
||||
}
|
||||
|
||||
playResp = liveschema.PreciseScoreResp{
|
||||
ResponseData: liveschema.PreciseScoreData{
|
||||
On: skillOn,
|
||||
Off: skillOff,
|
||||
RankInfo: ranks,
|
||||
CanActivateEffect: true,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
} else {
|
||||
playResp = liveschema.PreciseScoreResp{
|
||||
ResponseData: map[string]constant.ErrorCode{
|
||||
"error_code": constant.ErrorCodeLivePreciseListNotFound,
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 600,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ss.Respond(playResp)
|
||||
}
|
||||
|
||||
+79
-102
@@ -3,12 +3,11 @@ package live
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/live"
|
||||
liveschema "honoka-chan/internal/schema/live"
|
||||
"honoka-chan/internal/session"
|
||||
"honoka-chan/pkg/db"
|
||||
"strconv"
|
||||
"honoka-chan/pkg/utils"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -16,68 +15,64 @@ import (
|
||||
|
||||
func reward(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
defer func() {
|
||||
ss.ClearLiveInProgress()
|
||||
ss.Finalize()
|
||||
}()
|
||||
|
||||
playRewardReq := live.RewardReq{}
|
||||
playRewardReq := liveschema.RewardReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &playRewardReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
// fmt.Println(ctx.MustGet("request_data").(string))
|
||||
|
||||
difficultyId := playRewardReq.LiveDifficultyID
|
||||
difficultyID := playRewardReq.LiveDifficultyID
|
||||
_, liveInfo := ss.GetLiveInfo(difficultyID)
|
||||
_, progress := ss.GetLiveInProgress() // TODO: 添加返回指定状态码的方法
|
||||
_, deckInfo := ss.GetDeckInfo(progress.DeckID)
|
||||
deckInfo.LiveDifficultyID = difficultyID
|
||||
|
||||
// Song type: normal / special
|
||||
// sqlite3 doesn't support FULL OUTER JOIN so use UNION ALL here.
|
||||
sql := `SELECT c_rank_score,b_rank_score,a_rank_score,s_rank_score,c_rank_combo,b_rank_combo,a_rank_combo,s_rank_combo,ac_flag,swing_flag FROM live_setting_m WHERE live_setting_id IN (SELECT live_setting_id FROM normal_live_m WHERE live_difficulty_id = ? UNION ALL SELECT live_setting_id FROM special_live_m WHERE live_difficulty_id = ?)`
|
||||
var c_rank_score, b_rank_score, a_rank_score, s_rank_score, c_rank_combo, b_rank_combo, a_rank_combo, s_rank_combo, ac_flag, swing_flag int
|
||||
err = ss.MainEng.DB().QueryRow(sql, difficultyId, difficultyId).Scan(&c_rank_score, &b_rank_score, &a_rank_score, &s_rank_score, &c_rank_combo, &b_rank_combo, &a_rank_combo, &s_rank_combo, &ac_flag, &swing_flag)
|
||||
unitsList := []liveschema.PlayRewardUnitList{}
|
||||
err = ss.UserEng.Table("user_deck_unit").
|
||||
Join("LEFT", "user_deck", "user_deck_unit.user_deck_id = user_deck.id").
|
||||
Where("user_deck.user_id = ? AND user_deck.deck_id = ?", ss.UserID, progress.DeckID).
|
||||
Find(&unitsList)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
key := "live_deck_" + strconv.Itoa(ss.UserID)
|
||||
deckId, err := db.Ldb.Get([]byte(key))
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
unitsList := []live.PlayRewardUnitList{}
|
||||
err = ss.UserEng.Table("user_deck_unit").Join("LEFT", "user_deck", "user_deck_unit.user_deck_id = user_deck.id").
|
||||
Where("user_id = ? AND deck_id = ?", ss.UserID, string(deckId)).Find(&unitsList)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
pref := user.UserPref{}
|
||||
pref := usermodel.UserPref{}
|
||||
_, err = ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Get(&pref)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
totalScore := playRewardReq.ScoreSmile + playRewardReq.ScoreCool + playRewardReq.ScoreCute
|
||||
playResp := live.RewardResp{
|
||||
ResponseData: live.RewardData{
|
||||
LiveInfo: []live.RewardLiveInfo{
|
||||
playResp := liveschema.RewardResp{
|
||||
ResponseData: liveschema.RewardData{
|
||||
LiveInfo: []liveschema.RewardLiveInfo{
|
||||
{
|
||||
LiveDifficultyID: difficultyId,
|
||||
LiveDifficultyID: difficultyID,
|
||||
IsRandom: false,
|
||||
AcFlag: ac_flag,
|
||||
SwingFlag: swing_flag,
|
||||
AcFlag: liveInfo.AcFlag,
|
||||
SwingFlag: liveInfo.SwingFlag,
|
||||
},
|
||||
},
|
||||
TotalLove: 0,
|
||||
IsHighScore: true,
|
||||
HiScore: totalScore,
|
||||
BaseRewardInfo: live.BaseRewardInfo{
|
||||
BaseRewardInfo: liveschema.BaseRewardInfo{
|
||||
PlayerExp: 0,
|
||||
PlayerExpUnitMax: live.PlayerExpUnitMax{
|
||||
PlayerExpUnitMax: liveschema.PlayerExpUnitMax{
|
||||
Before: 0,
|
||||
After: 0,
|
||||
},
|
||||
PlayerExpFriendMax: live.PlayerExpFriendMax{
|
||||
PlayerExpFriendMax: liveschema.PlayerExpFriendMax{
|
||||
Before: 99,
|
||||
After: 99,
|
||||
},
|
||||
PlayerExpLpMax: live.PlayerExpLpMax{
|
||||
PlayerExpLpMax: liveschema.PlayerExpLpMax{
|
||||
Before: 417,
|
||||
After: 417,
|
||||
},
|
||||
@@ -85,72 +80,26 @@ func reward(ctx *gin.Context) {
|
||||
GameCoinRewardBoxFlag: false,
|
||||
SocialPoint: 0,
|
||||
},
|
||||
RewardUnitList: live.RewardUnitList{
|
||||
LiveClear: []live.LiveClear{},
|
||||
LiveRank: []live.LiveRank{},
|
||||
RewardUnitList: liveschema.RewardUnitList{
|
||||
LiveClear: []liveschema.LiveClear{},
|
||||
LiveRank: []liveschema.LiveRank{},
|
||||
LiveCombo: []any{},
|
||||
},
|
||||
UnlockedSubscenarioIds: []any{},
|
||||
UnlockedMultiUnitScenarioIds: []any{},
|
||||
EffortPoint: []live.EffortPoint{},
|
||||
EffortPoint: []liveschema.EffortPoint{},
|
||||
IsEffortPointVisible: false,
|
||||
LimitedEffortBox: []any{},
|
||||
UnitList: unitsList,
|
||||
BeforeUserInfo: live.BeforeUserInfo{
|
||||
Level: pref.UserLevel,
|
||||
Exp: 1089696,
|
||||
PreviousExp: 0,
|
||||
NextExp: 1207185,
|
||||
GameCoin: 999999999,
|
||||
SnsCoin: 10000,
|
||||
FreeSnsCoin: 50000,
|
||||
PaidSnsCoin: 50000,
|
||||
SocialPoint: 1438165,
|
||||
UnitMax: 5000,
|
||||
WaitingUnitMax: 1000,
|
||||
CurrentEnergy: 417,
|
||||
EnergyMax: 417,
|
||||
TrainingEnergy: 9,
|
||||
TrainingEnergyMax: 10,
|
||||
EnergyFullTime: "2023-03-20 01:28:55",
|
||||
LicenseLiveEnergyRecoverlyTime: 60,
|
||||
FriendMax: 99,
|
||||
TutorialState: -1,
|
||||
OverMaxEnergy: 417,
|
||||
UnlockRandomLiveMuse: 1,
|
||||
UnlockRandomLiveAqours: 1,
|
||||
},
|
||||
AfterUserInfo: live.AfterUserInfo{
|
||||
Level: pref.UserLevel,
|
||||
Exp: 1089696,
|
||||
PreviousExp: 0,
|
||||
NextExp: 1207185,
|
||||
GameCoin: 999999999,
|
||||
SnsCoin: 100000,
|
||||
FreeSnsCoin: 50000,
|
||||
PaidSnsCoin: 50000,
|
||||
SocialPoint: 1438375,
|
||||
UnitMax: 5000,
|
||||
WaitingUnitMax: 1000,
|
||||
CurrentEnergy: 417,
|
||||
EnergyMax: 417,
|
||||
TrainingEnergy: 9,
|
||||
TrainingEnergyMax: 10,
|
||||
EnergyFullTime: "2023-03-20 01:28:55",
|
||||
LicenseLiveEnergyRecoverlyTime: 60,
|
||||
FriendMax: 99,
|
||||
TutorialState: -1,
|
||||
OverMaxEnergy: 417,
|
||||
UnlockRandomLiveMuse: 1,
|
||||
UnlockRandomLiveAqours: 1,
|
||||
},
|
||||
NextLevelInfo: []live.NextLevelInfo{
|
||||
BeforeUserInfo: ss.GetUserInfo(),
|
||||
AfterUserInfo: ss.GetUserInfo(),
|
||||
NextLevelInfo: []liveschema.NextLevelInfo{
|
||||
{
|
||||
Level: pref.UserLevel,
|
||||
FromExp: 1089696,
|
||||
},
|
||||
},
|
||||
GoalAccompInfo: live.GoalAccompInfo{
|
||||
GoalAccompInfo: liveschema.GoalAccompInfo{
|
||||
AchievedIds: []any{},
|
||||
Rewards: []any{},
|
||||
},
|
||||
@@ -159,8 +108,8 @@ func reward(ctx *gin.Context) {
|
||||
DailyRewardInfo: []any{},
|
||||
CanSendFriendRequest: false,
|
||||
UsingBuffInfo: []any{},
|
||||
ClassSystem: live.ClassSystem{
|
||||
RankInfo: live.RewardRankInfo{
|
||||
ClassSystem: liveschema.ClassSystem{
|
||||
RankInfo: liveschema.RewardRankInfo{
|
||||
BeforeClassRankID: 10,
|
||||
AfterClassRankID: 10,
|
||||
RankUpDate: "2020-02-12 11:57:15",
|
||||
@@ -169,11 +118,11 @@ func reward(ctx *gin.Context) {
|
||||
IsOpened: true,
|
||||
IsVisible: true,
|
||||
},
|
||||
AccomplishedAchievementList: []live.AccomplishedAchievementList{},
|
||||
AccomplishedAchievementList: []liveschema.AccomplishedAchievementList{},
|
||||
UnaccomplishedAchievementCnt: 0,
|
||||
AddedAchievementList: []any{},
|
||||
MuseumInfo: live.Museum{},
|
||||
UnitSupportList: []live.RewardUnitSupportList{},
|
||||
MuseumInfo: liveschema.Museum{},
|
||||
UnitSupportList: []liveschema.RewardUnitSupportList{},
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
PresentCnt: 0,
|
||||
},
|
||||
@@ -181,30 +130,58 @@ func reward(ctx *gin.Context) {
|
||||
StatusCode: 200,
|
||||
}
|
||||
|
||||
if playRewardReq.MaxCombo > s_rank_combo {
|
||||
if playRewardReq.MaxCombo > liveInfo.SRankCombo {
|
||||
playResp.ResponseData.ComboRank = 1
|
||||
} else if playRewardReq.MaxCombo > a_rank_combo {
|
||||
} else if playRewardReq.MaxCombo > liveInfo.ARankCombo {
|
||||
playResp.ResponseData.ComboRank = 2
|
||||
} else if playRewardReq.MaxCombo > b_rank_combo {
|
||||
} else if playRewardReq.MaxCombo > liveInfo.BRankCombo {
|
||||
playResp.ResponseData.ComboRank = 3
|
||||
} else if playRewardReq.MaxCombo > c_rank_combo {
|
||||
} else if playRewardReq.MaxCombo > liveInfo.CRankCombo {
|
||||
playResp.ResponseData.ComboRank = 4
|
||||
} else {
|
||||
playResp.ResponseData.ComboRank = 5
|
||||
}
|
||||
|
||||
if totalScore > s_rank_score {
|
||||
if totalScore > liveInfo.SRankScore {
|
||||
playResp.ResponseData.Rank = 1
|
||||
} else if totalScore > a_rank_score {
|
||||
} else if totalScore > liveInfo.ARankScore {
|
||||
playResp.ResponseData.Rank = 2
|
||||
} else if totalScore > b_rank_score {
|
||||
} else if totalScore > liveInfo.BRankScore {
|
||||
playResp.ResponseData.Rank = 3
|
||||
} else if totalScore > c_rank_score {
|
||||
} else if totalScore > liveInfo.CRankScore {
|
||||
playResp.ResponseData.Rank = 4
|
||||
} else {
|
||||
playResp.ResponseData.Rank = 5
|
||||
}
|
||||
|
||||
// 判断歌曲记录是否需要保存或者更新
|
||||
liveSetting := playRewardReq.PreciseScoreLog.LiveSetting
|
||||
liveSetting.BackgroundID = ss.UserPref.BackgroundID
|
||||
if playRewardReq.PreciseScoreLog.IsLogOn && liveSetting.PreciseScoreAutoUpdateFlag {
|
||||
newLiveRecord := usermodel.UserLiveRecord{
|
||||
LiveDifficultyID: difficultyID,
|
||||
DeckID: progress.DeckID,
|
||||
TotalScore: totalScore,
|
||||
PerfectCnt: playRewardReq.PerfectCnt,
|
||||
GreatCnt: playRewardReq.GreatCnt,
|
||||
GoodCnt: playRewardReq.GoodCnt,
|
||||
BadCnt: playRewardReq.BadCnt,
|
||||
MissCnt: playRewardReq.MissCnt,
|
||||
MaxCombo: playRewardReq.MaxCombo,
|
||||
IsSkillOn: playRewardReq.PreciseScoreLog.IsSkillOn,
|
||||
LiveInfoJSON: utils.ToJSON(liveInfo),
|
||||
PreciseListJSON: utils.ToJSON(playRewardReq.PreciseScoreLog.PreciseList),
|
||||
DeckInfoJSON: utils.ToJSON(deckInfo),
|
||||
TapAdjust: playRewardReq.PreciseScoreLog.TapAdjust,
|
||||
LiveSettingJSON: utils.ToJSON(liveSetting),
|
||||
CanReplay: true,
|
||||
TriggerLogJSON: utils.ToJSON(playRewardReq.PreciseScoreLog.TriggerLog),
|
||||
UserID: ss.UserID,
|
||||
UpdateDate: time.Now().Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
ss.UpdateUserLiveRecord(&newLiveRecord, liveSetting.PreciseScoreUpdateType)
|
||||
}
|
||||
|
||||
ss.Respond(playResp)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@ package login
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
loginmodel "honoka-chan/internal/model/login"
|
||||
"honoka-chan/internal/router"
|
||||
loginschema "honoka-chan/internal/schema/login"
|
||||
"honoka-chan/internal/session"
|
||||
"honoka-chan/pkg/db"
|
||||
"honoka-chan/pkg/encrypt"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/tidwall/gjson"
|
||||
@@ -38,18 +38,12 @@ func authKey(ctx *gin.Context) {
|
||||
serverToken := base64.StdEncoding.EncodeToString([]byte(honokautils.RandomStr(32)))
|
||||
authorizeToken := base64.StdEncoding.EncodeToString([]byte(honokautils.RandomStr(32)))
|
||||
|
||||
authJson, err := json.Marshal(map[string]any{
|
||||
"client_token": clientToken,
|
||||
"server_token": serverToken,
|
||||
ss.SetAuthKey(&loginmodel.AuthKey{
|
||||
AuthorizeToken: authorizeToken,
|
||||
ClientToken: clientToken,
|
||||
ServerToken: serverToken,
|
||||
InsertDate: time.Now().Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
err = db.Ldb.Set([]byte(authorizeToken), authJson)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(loginschema.AuthKeyResp{
|
||||
ResponseData: loginschema.AuthKeyData{
|
||||
|
||||
@@ -7,10 +7,8 @@ import (
|
||||
"honoka-chan/internal/router"
|
||||
loginschema "honoka-chan/internal/schema/login"
|
||||
"honoka-chan/internal/session"
|
||||
"honoka-chan/pkg/db"
|
||||
"honoka-chan/pkg/encrypt"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -21,16 +19,17 @@ func login(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
authData, err := db.Ldb.Get([]byte(ctx.MustGet("token").(string)))
|
||||
if ss.CheckErr(err) {
|
||||
has, authKeyData := ss.GetAuthKey(ctx.MustGet("token").(string))
|
||||
if !has {
|
||||
ss.Abort(errors.New("invalid token"))
|
||||
return
|
||||
}
|
||||
|
||||
clientToken, err := base64.StdEncoding.DecodeString(gjson.Get(string(authData), "client_token").String())
|
||||
clientToken, err := base64.StdEncoding.DecodeString(authKeyData.ClientToken)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
serverToken, err := base64.StdEncoding.DecodeString(gjson.Get(string(authData), "server_token").String())
|
||||
serverToken, err := base64.StdEncoding.DecodeString(authKeyData.ServerToken)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
@@ -55,7 +54,7 @@ func login(ctx *gin.Context) {
|
||||
|
||||
authorizeToken := base64.StdEncoding.EncodeToString([]byte(honokautils.RandomStr(32)))
|
||||
|
||||
var userID int // 需要更新为字符串
|
||||
var userID int
|
||||
exists, err := ss.UserEng.Table("user_key").Where("key = ?", string(loginKey)).Cols("user_id").Get(&userID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -66,11 +65,6 @@ func login(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = db.Ldb.Set([]byte(strconv.Itoa(userID)), []byte(authorizeToken))
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(loginschema.LoginResp{
|
||||
ResponseData: loginschema.LoginData{
|
||||
AuthorizeToken: authorizeToken,
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/multiunit"
|
||||
multiunitschema "honoka-chan/internal/schema/multiunit"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -15,14 +15,14 @@ func scenarioStartup(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
startReq := multiunit.ScenarioStartUpReq{}
|
||||
startReq := multiunitschema.ScenarioStartUpReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &startReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(multiunit.ScenarioStartUpResp{
|
||||
ResponseData: multiunit.ScenarioStartUpData{
|
||||
ss.Respond(multiunitschema.ScenarioStartUpResp{
|
||||
ResponseData: multiunitschema.ScenarioStartUpData{
|
||||
MultiUnitScenarioID: startReq.MultiUnitScenarioID,
|
||||
ScenarioAdjustment: 50,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -3,7 +3,7 @@ package museum
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/museum"
|
||||
museumschema "honoka-chan/internal/schema/museum"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -33,10 +33,10 @@ func info(ctx *gin.Context) {
|
||||
coolBuff += content.CoolBuff
|
||||
contentsList = append(contentsList, content.MuseumContentsId)
|
||||
}
|
||||
museumResp := museum.InfoResp{
|
||||
ResponseData: museum.InfoData{
|
||||
MuseumInfo: museum.Museum{
|
||||
Parameter: museum.Parameter{
|
||||
museumResp := museumschema.InfoResp{
|
||||
ResponseData: museumschema.InfoData{
|
||||
MuseumInfo: museumschema.Museum{
|
||||
Parameter: museumschema.Parameter{
|
||||
Smile: smileBuff,
|
||||
Pure: pureBuff,
|
||||
Cool: coolBuff,
|
||||
|
||||
@@ -3,7 +3,7 @@ package notice
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/notice"
|
||||
noticeschema "honoka-chan/internal/schema/notice"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,8 +14,8 @@ func friendGreeting(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(notice.FriendGreetingResp{
|
||||
ResponseData: notice.FriendGreetingData{
|
||||
ss.Respond(noticeschema.FriendGreetingResp{
|
||||
ResponseData: noticeschema.FriendGreetingData{
|
||||
NextId: 0,
|
||||
NoticeList: []any{},
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -3,7 +3,7 @@ package notice
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/notice"
|
||||
noticeschema "honoka-chan/internal/schema/notice"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,8 +14,8 @@ func friendVariety(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(notice.FriendVarietyResp{
|
||||
ResponseData: notice.FriendVarietyData{
|
||||
ss.Respond(noticeschema.FriendVarietyResp{
|
||||
ResponseData: noticeschema.FriendVarietyData{
|
||||
ItemCount: 1,
|
||||
NoticeList: []any{},
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -3,7 +3,7 @@ package notice
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/notice"
|
||||
noticeschema "honoka-chan/internal/schema/notice"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,8 +14,8 @@ func userGreetingHistory(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(notice.UserGreetingResp{
|
||||
ResponseData: notice.UserGreetingData{
|
||||
ss.Respond(noticeschema.UserGreetingResp{
|
||||
ResponseData: noticeschema.UserGreetingData{
|
||||
ItemCount: 0,
|
||||
HasNext: false,
|
||||
NoticeList: []any{},
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
paymentapischema "honoka-chan/internal/schema/api/payment"
|
||||
"honoka-chan/internal/schema/payment"
|
||||
paymentschema "honoka-chan/internal/schema/payment"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -15,8 +15,8 @@ func productList(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
prodResp := payment.ProductListResp{
|
||||
ResponseData: payment.ProductListData{
|
||||
prodResp := paymentschema.ProductListResp{
|
||||
ResponseData: paymentschema.ProductListData{
|
||||
RestrictionInfo: paymentapischema.RestrictionInfo{
|
||||
Restricted: false,
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ package personalnotice
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/personalnotice"
|
||||
personalnoticeschema "honoka-chan/internal/schema/personalnotice"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,8 +14,8 @@ func get(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
noticeResp := personalnotice.GetResp{
|
||||
ResponseData: personalnotice.GetData{
|
||||
noticeResp := personalnoticeschema.GetResp{
|
||||
ResponseData: personalnoticeschema.GetData{
|
||||
HasNotice: false,
|
||||
NoticeID: 0,
|
||||
Type: 0,
|
||||
|
||||
@@ -2,9 +2,9 @@ package profile
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/profile"
|
||||
profileschema "honoka-chan/internal/schema/profile"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -16,7 +16,7 @@ func register(ctx *gin.Context) {
|
||||
defer ss.Finalize()
|
||||
|
||||
req := gjson.Parse(ctx.PostForm("request_data"))
|
||||
pref := user.UserPref{
|
||||
pref := usermodel.UserPref{
|
||||
UserDesc: req.Get("introduction").String(),
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func register(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(profile.RegisterResp{
|
||||
ss.Respond(profileschema.RegisterResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/scenario"
|
||||
scenarioschema "honoka-chan/internal/schema/scenario"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -15,14 +15,14 @@ func startup(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
startReq := scenario.StartUpReq{}
|
||||
startReq := scenarioschema.StartUpReq{}
|
||||
err := json.Unmarshal([]byte(ctx.PostForm("request_data")), &startReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(scenario.StartUpResp{
|
||||
ResponseData: scenario.StartUpData{
|
||||
ss.Respond(scenarioschema.StartUpResp{
|
||||
ResponseData: scenarioschema.StartUpData{
|
||||
ScenarioID: startReq.ScenarioID,
|
||||
ScenarioAdjustment: 50,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/subscenario"
|
||||
subscenarioschema "honoka-chan/internal/schema/subscenario"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -15,14 +15,14 @@ func startup(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
startReq := subscenario.StartUpReq{}
|
||||
startReq := subscenarioschema.StartUpReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &startReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(subscenario.StartUpResp{
|
||||
ResponseData: subscenario.StartUpData{
|
||||
ss.Respond(subscenarioschema.StartUpResp{
|
||||
ResponseData: subscenarioschema.StartUpData{
|
||||
SubscenarioID: startReq.SubscenarioID,
|
||||
ScenarioAdjustment: 50,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
|
||||
@@ -3,7 +3,7 @@ package tos
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/tos"
|
||||
tosschema "honoka-chan/internal/schema/tos"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -14,8 +14,8 @@ func check(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(tos.CheckResp{
|
||||
ResponseData: tos.CheckData{
|
||||
ss.Respond(tosschema.CheckResp{
|
||||
ResponseData: tosschema.CheckData{
|
||||
TosID: 1,
|
||||
TosType: 1,
|
||||
IsAgreed: true,
|
||||
|
||||
@@ -2,12 +2,12 @@ package unit
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"honoka-chan/internal/middleware"
|
||||
unitmodel "honoka-chan/internal/model/unit"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/schema/unit"
|
||||
unitschema "honoka-chan/internal/schema/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -18,7 +18,7 @@ func deck(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
deckReq := unit.DeckReq{}
|
||||
deckReq := unitschema.DeckReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &deckReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -63,53 +63,34 @@ func deck(ctx *gin.Context) {
|
||||
// 队伍成员信息
|
||||
for _, u := range deck.UnitDeckDetail {
|
||||
// 成员信息
|
||||
newUnitData := profileapischema.UnitData{}
|
||||
exists, err := ss.UserEng.Table("user_unit").Where("unit_owning_user_id = ?", u.UnitOwningUserID).Exist()
|
||||
unitData := unitmodel.UnitDataMap{}
|
||||
_, err = ss.GetBasicUnitInfo().
|
||||
Where("a.unit_owning_user_id = ?", u.UnitOwningUserID).Get(&unitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
if exists {
|
||||
// fmt.Println("新成员为用户增加成员")
|
||||
_, err = ss.UserEng.Table("user_unit").Where("unit_owning_user_id = ?", u.UnitOwningUserID).Get(&newUnitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
exists, err := ss.MainEng.Table("common_unit_m").Where("unit_owning_user_id = ?", u.UnitOwningUserID).Exist()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
if exists {
|
||||
// fmt.Println("新成员为公共成员")
|
||||
_, err = ss.MainEng.Table("common_unit_m").Where("unit_owning_user_id = ?", u.UnitOwningUserID).Get(&newUnitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// fmt.Println("新成员不存在")
|
||||
err = errors.New("新成员不存在")
|
||||
}
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// fmt.Println("新的成员信息:", newUnitData)
|
||||
// fmt.Println("新的成员信息:", unitData)
|
||||
|
||||
// 插入新成员信息
|
||||
newUnitDeckData := unitapischema.UnitDeckData{}
|
||||
b, err := json.Marshal(newUnitData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
newUnitDeckData := usermodel.UserDeckUnit{
|
||||
UserDeckID: userDeckId,
|
||||
UnitOwningUserID: unitData.UnitOwningUserID,
|
||||
UnitID: unitData.UnitID,
|
||||
Position: u.Position,
|
||||
Level: unitData.Level,
|
||||
LevelLimitID: unitData.LevelLimitID,
|
||||
DisplayRank: unitData.DisplayRank,
|
||||
Love: unitData.Love,
|
||||
UnitSkillLevel: unitData.UnitSkillLevel,
|
||||
IsRankMax: unitData.IsRankMax,
|
||||
IsLoveMax: unitData.IsLoveMax,
|
||||
IsLevelMax: unitData.IsLevelMax,
|
||||
IsSigned: unitData.IsSigned,
|
||||
BeforeLove: unitData.MaxLove,
|
||||
MaxLove: unitData.MaxLove,
|
||||
UserID: ss.UserID,
|
||||
InsertDate: time.Now().Unix(),
|
||||
}
|
||||
err = json.Unmarshal(b, &newUnitDeckData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
newUnitDeckData.BeforeLove = newUnitDeckData.MaxLove
|
||||
newUnitDeckData.Position = u.Position
|
||||
newUnitDeckData.UserDeckID = userDeckId
|
||||
newUnitDeckData.InsertData = time.Now().Unix()
|
||||
|
||||
_, err = ss.UserEng.Table("user_deck_unit").Insert(&newUnitDeckData)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -117,7 +98,7 @@ func deck(ctx *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ss.Respond(unit.DeckResp{
|
||||
ss.Respond(unitschema.DeckResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
unitapischema "honoka-chan/internal/schema/api/unit"
|
||||
"honoka-chan/internal/schema/unit"
|
||||
unitschema "honoka-chan/internal/schema/unit"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -15,7 +15,7 @@ func deckName(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
deckReq := unit.DeckNameReq{}
|
||||
deckReq := unitschema.DeckNameReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &deckReq)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -37,7 +37,7 @@ func deckName(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(unit.DeckResp{
|
||||
ss.Respond(unitschema.DeckResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/unit"
|
||||
unitschema "honoka-chan/internal/schema/unit"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -13,7 +15,22 @@ func favorite(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(unit.FavoriteResp{
|
||||
var req unitschema.FavoriteReq
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &req)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
data := usermodel.UserUnitData{
|
||||
FavoriteFlag: req.FavoriteFlag != 0,
|
||||
}
|
||||
_, err = ss.UserEng.Table(new(usermodel.UserUnitData)).
|
||||
ID(req.UnitOwningUserID).Cols("favorite_flag").Update(&data)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(unitschema.FavoriteResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type SetResp struct {
|
||||
ResponseData []any `json:"response_data"`
|
||||
ReleaseInfo []any `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
func favoriteAccessory(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
fmt.Println(ctx.MustGet("request_data").(string))
|
||||
|
||||
ss.Respond(SetResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("main.php", "POST", "/unit/favoriteAccessory", middleware.Common, favoriteAccessory)
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/unit"
|
||||
unitschema "honoka-chan/internal/schema/unit"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -14,7 +14,7 @@ func removableSkillEquipment(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
req := unit.RemovableSkillEquipmentReq{}
|
||||
req := unitschema.RemovableSkillEquipmentReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &req)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -34,7 +34,7 @@ func removableSkillEquipment(ctx *gin.Context) {
|
||||
// 佩戴宝石
|
||||
for _, v := range req.Equip {
|
||||
// fmt.Println("Equip:", v.UnitOwningUserID, v.UnitRemovableSkillID)
|
||||
data := unit.RemovableSkillEquipmentData{
|
||||
data := unitschema.RemovableSkillEquipmentData{
|
||||
UnitRemovableSkillId: v.UnitRemovableSkillID,
|
||||
UnitOwningUserID: v.UnitOwningUserID,
|
||||
UserID: ss.UserID,
|
||||
@@ -45,7 +45,7 @@ func removableSkillEquipment(ctx *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ss.Respond(unit.RemovableSkillEquipmentResp{
|
||||
ss.Respond(unitschema.RemovableSkillEquipmentResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
unitschema "honoka-chan/internal/schema/unit"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func sale(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
req := unitschema.SaleReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &req)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
totalCoin := 0
|
||||
saleDetail := []unitschema.Detail{}
|
||||
for _, id := range req.UnitOwningUserID {
|
||||
salePrice := 1 // TODO: 从 unit_level_up_pattern_m 表获取实际价格
|
||||
totalCoin += salePrice
|
||||
|
||||
_, unitData := ss.GetUserUnitInfo(id)
|
||||
|
||||
saleDetail = append(saleDetail, unitschema.Detail{
|
||||
UnitOwningUserID: id,
|
||||
UnitID: unitData.UnitID,
|
||||
IsSigned: unitData.IsSigned,
|
||||
Price: salePrice,
|
||||
})
|
||||
|
||||
// 卸载宝石
|
||||
_, err = ss.UserEng.Table(new(usermodel.UserUnitSkillEquip)).
|
||||
Where("unit_owning_user_id = ?", id).Delete()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// 卸载饰品
|
||||
_, err = ss.UserEng.Table(new(usermodel.UserAccessoryWear)).
|
||||
Where("unit_owning_user_id = ?", id).Delete()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
// 移除卡片
|
||||
_, err = ss.UserEng.Table(new(usermodel.UserUnitData)).
|
||||
Where("unit_owning_user_id = ?", id).Delete()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
skillList := []int{}
|
||||
err = ss.MainEng.Table("unit_removable_skill_m").
|
||||
Where("skill_type = 1").Cols("unit_removable_skill_id").Find(&skillList)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
owningData := []unitschema.OwningInfo{}
|
||||
for _, sk := range skillList {
|
||||
owningData = append(owningData, unitschema.OwningInfo{
|
||||
UnitRemovableSkillID: sk,
|
||||
TotalAmount: 999,
|
||||
EquippedAmount: 0, // TODO: 计算实际数量
|
||||
InsertDate: "2023-01-01 12:00:00",
|
||||
})
|
||||
}
|
||||
|
||||
ss.Respond(unitschema.SaleResp{
|
||||
ResponseData: unitschema.SaleData{
|
||||
Total: totalCoin,
|
||||
Detail: saleDetail,
|
||||
BeforeUserInfo: ss.GetUserInfo(),
|
||||
AfterUserInfo: ss.GetUserInfo(),
|
||||
RewardBoxFlag: false,
|
||||
GetExchangePointList: []any{},
|
||||
UnitRemovableSkill: unitschema.UnitRemovableSkill{
|
||||
OwningInfo: owningData,
|
||||
},
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("main.php", "POST", "/unit/sale", middleware.Common, sale)
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/unit"
|
||||
unitschema "honoka-chan/internal/schema/unit"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -13,7 +15,22 @@ func setDisplayRank(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(unit.SetDisplayRankResp{
|
||||
var req unitschema.SetDisplayRankReq
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &req)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
data := usermodel.UserUnitData{
|
||||
DisplayRank: req.DisplayRank,
|
||||
}
|
||||
_, err = ss.UserEng.Table(new(usermodel.UserUnitData)).
|
||||
ID(req.UnitOwningUserID).Cols("display_rank").Update(&data)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(unitschema.SetDisplayRankResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/unit"
|
||||
unitschema "honoka-chan/internal/schema/unit"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -14,7 +14,7 @@ func wearAccessory(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
req := unit.WearAccessoryReq{}
|
||||
req := unitschema.WearAccessoryReq{}
|
||||
err := json.Unmarshal([]byte(ctx.MustGet("request_data").(string)), &req)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -34,7 +34,7 @@ func wearAccessory(ctx *gin.Context) {
|
||||
// 佩戴饰品
|
||||
for _, v := range req.Wear {
|
||||
// fmt.Println("Wear:", v.AccessoryOwningUserID, v.UnitOwningUserID)
|
||||
data := unit.WearAccessoryData{
|
||||
data := unitschema.WearAccessoryData{
|
||||
AccessoryOwningUserID: v.AccessoryOwningUserID,
|
||||
UnitOwningUserID: v.UnitOwningUserID,
|
||||
UserID: ss.UserID,
|
||||
@@ -45,7 +45,7 @@ func wearAccessory(ctx *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ss.Respond(unit.WearAccessoryResp{
|
||||
ss.Respond(unitschema.WearAccessoryResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -2,7 +2,7 @@ package user
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
userschema "honoka-chan/internal/schema/user"
|
||||
"honoka-chan/internal/session"
|
||||
@@ -23,7 +23,7 @@ func changeName(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
pref := user.UserPref{
|
||||
pref := usermodel.UserPref{
|
||||
UserName: req.Get("name").String(),
|
||||
}
|
||||
_, err = ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Update(&pref)
|
||||
|
||||
@@ -2,7 +2,7 @@ package user
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
userschema "honoka-chan/internal/schema/user"
|
||||
"honoka-chan/internal/session"
|
||||
@@ -16,7 +16,7 @@ func changeNavi(ctx *gin.Context) {
|
||||
defer ss.Finalize()
|
||||
|
||||
req := gjson.Parse(ctx.MustGet("request_data").(string))
|
||||
pref := user.UserPref{
|
||||
pref := usermodel.UserPref{
|
||||
UnitOwningUserID: int(req.Get("unit_owning_user_id").Int()),
|
||||
}
|
||||
_, err := ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Update(&pref)
|
||||
|
||||
@@ -3,7 +3,7 @@ package user
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
"honoka-chan/internal/schema/user"
|
||||
userschema "honoka-chan/internal/schema/user"
|
||||
"honoka-chan/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -13,7 +13,7 @@ func setNotificationToken(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
ss.Respond(user.SetNotificationTokenResp{
|
||||
ss.Respond(userschema.SetNotificationTokenResp{
|
||||
ResponseData: []any{},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
|
||||
@@ -2,9 +2,8 @@ package user
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/model/user"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/router"
|
||||
userapischema "honoka-chan/internal/schema/api/user"
|
||||
userschema "honoka-chan/internal/schema/user"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
@@ -16,7 +15,7 @@ func userInfo(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
|
||||
pref := user.UserPref{}
|
||||
pref := usermodel.UserPref{}
|
||||
_, err := ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Get(&pref)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
@@ -24,36 +23,7 @@ func userInfo(ctx *gin.Context) {
|
||||
|
||||
userResp := userschema.UserInfoResp{
|
||||
ResponseData: userschema.UserInfoData{
|
||||
User: userapischema.UserInfo{
|
||||
UserID: ss.UserID,
|
||||
Name: pref.UserName,
|
||||
Level: pref.UserLevel,
|
||||
Exp: 1089696,
|
||||
PreviousExp: 0,
|
||||
NextExp: 1207185,
|
||||
GameCoin: 112124104,
|
||||
SnsCoin: 100000,
|
||||
FreeSnsCoin: 50000,
|
||||
PaidSnsCoin: 50000,
|
||||
SocialPoint: 999999999,
|
||||
UnitMax: 5000,
|
||||
WaitingUnitMax: 1000,
|
||||
EnergyMax: 417,
|
||||
EnergyFullTime: "2023-03-20 03:58:55",
|
||||
LicenseLiveEnergyRecoverlyTime: 60,
|
||||
EnergyFullNeedTime: 0,
|
||||
OverMaxEnergy: 0,
|
||||
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{},
|
||||
},
|
||||
User: ss.GetUserInfo(),
|
||||
Birth: userschema.Birth{
|
||||
BirthMonth: 10,
|
||||
BirthDay: 18,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user