diff --git a/assets/as/fetchTrainingTree.json b/assets/as/fetchTrainingTree.json new file mode 100644 index 0000000..35012ba --- /dev/null +++ b/assets/as/fetchTrainingTree.json @@ -0,0 +1,356 @@ +{ + "user_card_training_tree_cell_list": [ + { + "cell_id": 0, + "activated_at": 1671437782 + }, + { + "cell_id": 1, + "activated_at": 1671437782 + }, + { + "cell_id": 2, + "activated_at": 1671437782 + }, + { + "cell_id": 3, + "activated_at": 1671437782 + }, + { + "cell_id": 4, + "activated_at": 1671437782 + }, + { + "cell_id": 5, + "activated_at": 1671437782 + }, + { + "cell_id": 6, + "activated_at": 1671437782 + }, + { + "cell_id": 7, + "activated_at": 1671437782 + }, + { + "cell_id": 8, + "activated_at": 1671437782 + }, + { + "cell_id": 9, + "activated_at": 1671437782 + }, + { + "cell_id": 10, + "activated_at": 1671437782 + }, + { + "cell_id": 11, + "activated_at": 1671437782 + }, + { + "cell_id": 12, + "activated_at": 1671437782 + }, + { + "cell_id": 13, + "activated_at": 1671437782 + }, + { + "cell_id": 14, + "activated_at": 1671437782 + }, + { + "cell_id": 15, + "activated_at": 1671437782 + }, + { + "cell_id": 16, + "activated_at": 1671437782 + }, + { + "cell_id": 17, + "activated_at": 1671437782 + }, + { + "cell_id": 18, + "activated_at": 1671437782 + }, + { + "cell_id": 19, + "activated_at": 1671438125 + }, + { + "cell_id": 20, + "activated_at": 1671438125 + }, + { + "cell_id": 21, + "activated_at": 1671438125 + }, + { + "cell_id": 22, + "activated_at": 1671438125 + }, + { + "cell_id": 23, + "activated_at": 1671438125 + }, + { + "cell_id": 24, + "activated_at": 1671438125 + }, + { + "cell_id": 25, + "activated_at": 1671438125 + }, + { + "cell_id": 26, + "activated_at": 1671438125 + }, + { + "cell_id": 27, + "activated_at": 1671438125 + }, + { + "cell_id": 28, + "activated_at": 1671965468 + }, + { + "cell_id": 29, + "activated_at": 1671965468 + }, + { + "cell_id": 30, + "activated_at": 1671965468 + }, + { + "cell_id": 31, + "activated_at": 1671965468 + }, + { + "cell_id": 32, + "activated_at": 1671965468 + }, + { + "cell_id": 33, + "activated_at": 1671965468 + }, + { + "cell_id": 34, + "activated_at": 1671437833 + }, + { + "cell_id": 35, + "activated_at": 1671437833 + }, + { + "cell_id": 36, + "activated_at": 1671437833 + }, + { + "cell_id": 37, + "activated_at": 1671437833 + }, + { + "cell_id": 38, + "activated_at": 1671437833 + }, + { + "cell_id": 39, + "activated_at": 1671437838 + }, + { + "cell_id": 40, + "activated_at": 1671437838 + }, + { + "cell_id": 41, + "activated_at": 1671437838 + }, + { + "cell_id": 42, + "activated_at": 1671437838 + }, + { + "cell_id": 43, + "activated_at": 1671437827 + }, + { + "cell_id": 44, + "activated_at": 1671437827 + }, + { + "cell_id": 45, + "activated_at": 1671437827 + }, + { + "cell_id": 46, + "activated_at": 1671437827 + }, + { + "cell_id": 47, + "activated_at": 1671437822 + }, + { + "cell_id": 48, + "activated_at": 1671437822 + }, + { + "cell_id": 49, + "activated_at": 1671437822 + }, + { + "cell_id": 50, + "activated_at": 1671437886 + }, + { + "cell_id": 51, + "activated_at": 1671437810 + }, + { + "cell_id": 52, + "activated_at": 1671437810 + }, + { + "cell_id": 53, + "activated_at": 1671437810 + }, + { + "cell_id": 54, + "activated_at": 1671437810 + }, + { + "cell_id": 55, + "activated_at": 1671437810 + }, + { + "cell_id": 56, + "activated_at": 1671437815 + }, + { + "cell_id": 57, + "activated_at": 1671437815 + }, + { + "cell_id": 58, + "activated_at": 1671437815 + }, + { + "cell_id": 59, + "activated_at": 1671437815 + }, + { + "cell_id": 60, + "activated_at": 1671437782 + }, + { + "cell_id": 61, + "activated_at": 1671437805 + }, + { + "cell_id": 62, + "activated_at": 1671438125 + }, + { + "cell_id": 63, + "activated_at": 1671438125 + }, + { + "cell_id": 64, + "activated_at": 1671438125 + }, + { + "cell_id": 65, + "activated_at": 1671438125 + }, + { + "cell_id": 66, + "activated_at": 1671438125 + }, + { + "cell_id": 67, + "activated_at": 1671438125 + }, + { + "cell_id": 68, + "activated_at": 1671438125 + }, + { + "cell_id": 69, + "activated_at": 1671438125 + }, + { + "cell_id": 70, + "activated_at": 1671438125 + }, + { + "cell_id": 71, + "activated_at": 1671438125 + }, + { + "cell_id": 72, + "activated_at": 1671438125 + }, + { + "cell_id": 73, + "activated_at": 1671438125 + }, + { + "cell_id": 74, + "activated_at": 1671438125 + }, + { + "cell_id": 75, + "activated_at": 1671438125 + }, + { + "cell_id": 76, + "activated_at": 1671965468 + }, + { + "cell_id": 77, + "activated_at": 1671965468 + }, + { + "cell_id": 78, + "activated_at": 1671965468 + }, + { + "cell_id": 79, + "activated_at": 1671965468 + }, + { + "cell_id": 80, + "activated_at": 1671965468 + }, + { + "cell_id": 81, + "activated_at": 1671965468 + }, + { + "cell_id": 82, + "activated_at": 1671965468 + }, + { + "cell_id": 83, + "activated_at": 1671965468 + }, + { + "cell_id": 84, + "activated_at": 1671965468 + }, + { + "cell_id": 85, + "activated_at": 1671965468 + }, + { + "cell_id": 86, + "activated_at": 1671965468 + }, + { + "cell_id": 87, + "activated_at": 1671965468 + } + ] +} \ No newline at end of file diff --git a/assets/as/updateUserLiveDifficultyNewFlag.json b/assets/as/updateUserLiveDifficultyNewFlag.json index 4a78021..eb5842f 100644 --- a/assets/as/updateUserLiveDifficultyNewFlag.json +++ b/assets/as/updateUserLiveDifficultyNewFlag.json @@ -66,229 +66,7 @@ "user_lesson_deck_by_id": [], "user_live_mv_deck_by_id": [], "user_live_mv_deck_custom_by_id": [], - "user_live_difficulty_by_difficulty_id": [ - 12087201, - { - "live_difficulty_id": 12087201, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 12037501, - { - "live_difficulty_id": 12037501, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 22087201, - { - "live_difficulty_id": 22087201, - "max_score": 6362469, - "max_combo": 116, - "play_count": 1, - "clear_count": 1, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": 1, - "cleared_difficulty_achievement_2": 2, - "cleared_difficulty_achievement_3": 3, - "enable_autoplay": true, - "is_autoplay": true, - "is_new": false - }, - 12060101, - { - "live_difficulty_id": 12060101, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 12087301, - { - "live_difficulty_id": 12087301, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 22087301, - { - "live_difficulty_id": 22087301, - "max_score": 9076238, - "max_combo": 167, - "play_count": 1, - "clear_count": 1, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": 1, - "cleared_difficulty_achievement_2": 2, - "cleared_difficulty_achievement_3": 3, - "enable_autoplay": true, - "is_autoplay": true, - "is_new": false - }, - 12060201, - { - "live_difficulty_id": 12060201, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 12087101, - { - "live_difficulty_id": 12087101, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 12060301, - { - "live_difficulty_id": 12060301, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 12074101, - { - "live_difficulty_id": 12074101, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 12074201, - { - "live_difficulty_id": 12074201, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 12074301, - { - "live_difficulty_id": 12074301, - "max_score": 0, - "max_combo": 0, - "play_count": 0, - "clear_count": 0, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": null, - "cleared_difficulty_achievement_2": null, - "cleared_difficulty_achievement_3": null, - "enable_autoplay": false, - "is_autoplay": false, - "is_new": false - }, - 22087101, - { - "live_difficulty_id": 22087101, - "max_score": 4699439, - "max_combo": 79, - "play_count": 1, - "clear_count": 1, - "cancel_count": 0, - "not_cleared_count": 0, - "is_full_combo": false, - "cleared_difficulty_achievement_1": 1, - "cleared_difficulty_achievement_2": 2, - "cleared_difficulty_achievement_3": 3, - "enable_autoplay": true, - "is_autoplay": true, - "is_new": false - } - ], + "user_live_difficulty_by_difficulty_id": [], "user_story_main_by_story_main_id": [], "user_story_main_selected_by_story_main_cell_id": [], "user_voice_by_voice_id": [], diff --git a/assets/as/userStatus.json b/assets/as/userStatus.json new file mode 100644 index 0000000..dbb8f76 --- /dev/null +++ b/assets/as/userStatus.json @@ -0,0 +1,58 @@ +{ + "name": { + "dot_under_text": "梦路2号机@果果厨" + }, + "nickname": { + "dot_under_text": "梦路" + }, + "last_login_at": 1686137330, + "rank": 122, + "exp": 416854, + "message": { + "dot_under_text": "B站主播:梦路_YumeMichi" + }, + "recommend_card_master_id": 200013001, + "max_friend_num": 0, + "live_point_full_at": 1686107403, + "live_point_broken": 173, + "live_point_subscription_recovery_daily_count": 1, + "live_point_subscription_recovery_daily_reset_at": 1656259200, + "activity_point_count": 0, + "activity_point_reset_at": 1684123200, + "activity_point_payment_recovery_daily_count": 10, + "activity_point_payment_recovery_daily_reset_at": 1683734400, + "game_money": 115779989, + "card_exp": 32464467, + "free_sns_coin": 3900, + "apple_sns_coin": 0, + "google_sns_coin": 0, + "cash": 0, + "subscription_coin": 30, + "birth_date": null, + "birth_month": 10, + "birth_day": 18, + "latest_live_deck_id": 1, + "main_lesson_deck_id": 1, + "favorite_member_id": 1, + "last_live_difficulty_id": 10025301, + "lp_magnification": 1, + "emblem_id": 10400253, + "device_token": "", + "tutorial_phase": 99, + "tutorial_end_at": 1622217482, + "login_days": 451, + "navi_tap_count": 1, + "navi_tap_recover_at": 1685030400, + "is_auto_mode": false, + "max_score_live_difficulty_master_id": 12037401, + "live_max_score": 40553270, + "max_combo_live_difficulty_master_id": 12037401, + "live_max_combo": 301, + "lesson_resume_status": 1, + "accessory_box_additional": 90, + "terms_of_use_version": 0, + "bootstrap_sifid_check_at": 1683178908, + "gdpr_version": 0, + "member_guild_member_master_id": 1, + "member_guild_last_updated_at": 1659485328 +} \ No newline at end of file diff --git a/assets/main.db b/assets/main.db index d48d9a6..71d1b2e 100644 Binary files a/assets/main.db and b/assets/main.db differ diff --git a/go.mod b/go.mod index 56e1f2a..ca545d4 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,8 @@ require ( github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/pretty v1.2.1 // indirect + github.com/tidwall/sjson v1.2.5 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/mod v0.8.0 // indirect diff --git a/go.sum b/go.sum index 1c3f801..0cfd346 100644 --- a/go.sum +++ b/go.sum @@ -390,12 +390,17 @@ github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gt github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= diff --git a/handler/allstars.go b/handler/allstars.go new file mode 100644 index 0000000..dcc4f3f --- /dev/null +++ b/handler/allstars.go @@ -0,0 +1,1047 @@ +package handler + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "honoka-chan/config" + "honoka-chan/database" + "honoka-chan/encrypt" + "honoka-chan/model" + "honoka-chan/utils" + "net/http" + "strconv" + "strings" + "time" + + "github.com/gin-gonic/gin" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +func AsLogin(ctx *gin.Context) { + reqBody := ctx.GetString("reqBody") + + var mask string + req := gjson.Parse(reqBody) + req.ForEach(func(key, value gjson.Result) bool { + if value.Get("mask").String() != "" { + mask = value.Get("mask").String() + return false + } + return true + }) + // fmt.Println("Request data:", req.String()) + // fmt.Println("Mask:", mask) + + mask64, err := base64.StdEncoding.DecodeString(mask) + if err != nil { + panic(err) + } + randomBytes := encrypt.RSA_DecryptOAEP(mask64, "privatekey.pem") + // fmt.Println("Random Bytes:", randomBytes) + + newKey := utils.SliceXor(randomBytes, []byte(sessionKey)) + newKey64 := base64.StdEncoding.EncodeToString(newKey) + + loginBody := utils.ReadAllText("assets/as/login.json") + loginBody, _ = sjson.Set(loginBody, "session_key", newKey64) + loginBody, _ = sjson.Set(loginBody, "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), loginBody, config.StartUpKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchBootstrap(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/fetchBootstrap.json"), + "user_model_diff.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchBillingHistory(ctx *gin.Context) { + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchBillingHistory.json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchNotice(ctx *gin.Context) { + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchNotice.json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsGetPackUrl(ctx *gin.Context) { + reqBody := ctx.GetString("reqBody") + + var req []model.AsReq + err := json.Unmarshal([]byte(reqBody), &req) + if err != nil { + panic(err) + } + // fmt.Println(req) + + packBody, ok := req[0].(map[string]interface{}) + if !ok { + panic("Assertion failed!") + } + // fmt.Println(packBody) + + packNames, ok := packBody["pack_names"].([]interface{}) + if !ok { + panic("Assertion failed!") + } + + // 生成更新包 map + var packageList []string + var urlList []string + + err = json.Unmarshal([]byte(utils.ReadAllText("assets/as/packages.json")), &packageList) + if err != nil { + panic(err) + } + + err = json.Unmarshal([]byte(utils.ReadAllText("assets/as/urls.json")), &urlList) + if err != nil { + panic(err) + } + + if len(packageList) != len(urlList) { + fmt.Println("File size not match!") + return + } + + packageUrls := map[string]string{} + for k, p := range packageList { + packageUrls[p] = urlList[k] + } + + // Response + var respUrls []string + for _, pack := range packNames { + packName, ok := pack.(string) + if !ok { + panic("Assertion failed!") + } + // fmt.Println(packageUrls[packName]) + respUrls = append(respUrls, packageUrls[packName]) + } + + urlResp := model.PackUrlRespBody{ + UrlList: respUrls, + } + + var resp []model.AsResp + resp = append(resp, time.Now().UnixMilli()) // 时间戳 + resp = append(resp, config.MasterVersion) // 版本号 + resp = append(resp, 0) // 固定值 + resp = append(resp, urlResp) // 数据体 + + mm, err := json.Marshal(resp) + if err != nil { + panic(err) + } + // fmt.Println(string(mm)) + + signBody := mm[1 : len(mm)-1] + // fmt.Println(string(signBody)) + + ep := strings.ReplaceAll(ctx.Request.URL.String(), "/ep3071", "") + // fmt.Println(ep) + + sign := encrypt.HMAC_SHA1_Encrypt([]byte(ep+" "+string(signBody)), []byte(sessionKey)) + + resp = append(resp, sign) + mm, err = json.Marshal(resp) + if err != nil { + panic(err) + } + // fmt.Println(string(mm)) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, string(mm)) +} + +func AsUpdateCardNewFlag(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/updateCardNewFlag.json"), + "user_model_diff.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsGetClearedPlatformAchievement(ctx *gin.Context) { + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/getClearedPlatformAchievement.json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchLiveMusicSelect(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/fetchLiveMusicSelect.json"), + "user_model_diff.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsLiveMvStart(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/liveMvStart.json"), + "user_model_diff.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsLiveMvSaveDeck(ctx *gin.Context) { + reqBody := ctx.GetString("reqBody") + + var req []model.AsReq + err := json.Unmarshal([]byte(reqBody), &req) + if err != nil { + panic(err) + } + + body, ok := req[0].(map[string]interface{}) + if !ok { + panic("Assertion failed!") + } + + reqB, err := json.Marshal(body) + if err != nil { + panic(err) + } + // fmt.Println(string(reqB)) + + saveReq := model.LiveSaveDeckReq{} + err = json.Unmarshal(reqB, &saveReq) + if err != nil { + panic(err) + } + // fmt.Println(saveReq) + + userLiveMvDeckInfo := model.UserLiveMvDeckInfo{ + LiveMasterID: saveReq.LiveMasterID, + } + + memberIds := map[int]int{} + for k, v := range saveReq.MemberMasterIDByPos { + if k%2 == 0 { + memberId := saveReq.MemberMasterIDByPos[k+1] + memberIds[v] = memberId + + switch v { + case 1: + userLiveMvDeckInfo.MemberMasterID1 = memberId + case 2: + userLiveMvDeckInfo.MemberMasterID2 = memberId + case 3: + userLiveMvDeckInfo.MemberMasterID3 = memberId + case 4: + userLiveMvDeckInfo.MemberMasterID4 = memberId + case 5: + userLiveMvDeckInfo.MemberMasterID5 = memberId + case 6: + userLiveMvDeckInfo.MemberMasterID6 = memberId + case 7: + userLiveMvDeckInfo.MemberMasterID7 = memberId + case 8: + userLiveMvDeckInfo.MemberMasterID8 = memberId + case 9: + userLiveMvDeckInfo.MemberMasterID9 = memberId + case 10: + userLiveMvDeckInfo.MemberMasterID10 = memberId + case 11: + userLiveMvDeckInfo.MemberMasterID11 = memberId + case 12: + userLiveMvDeckInfo.MemberMasterID12 = memberId + } + } + } + // fmt.Println(memberIds) + + suitIds := map[int]int{} + for k, v := range saveReq.SuitMasterIDByPos { + if k%2 == 0 { + suitId := saveReq.SuitMasterIDByPos[k+1] + suitIds[v] = suitId + + switch v { + case 1: + userLiveMvDeckInfo.SuitMasterID1 = suitId + case 2: + userLiveMvDeckInfo.SuitMasterID2 = suitId + case 3: + userLiveMvDeckInfo.SuitMasterID3 = suitId + case 4: + userLiveMvDeckInfo.SuitMasterID4 = suitId + case 5: + userLiveMvDeckInfo.SuitMasterID5 = suitId + case 6: + userLiveMvDeckInfo.SuitMasterID6 = suitId + case 7: + userLiveMvDeckInfo.SuitMasterID7 = suitId + case 8: + userLiveMvDeckInfo.SuitMasterID8 = suitId + case 9: + userLiveMvDeckInfo.SuitMasterID9 = suitId + case 10: + userLiveMvDeckInfo.SuitMasterID10 = suitId + case 11: + userLiveMvDeckInfo.SuitMasterID11 = suitId + case 12: + userLiveMvDeckInfo.SuitMasterID12 = suitId + } + } + } + // fmt.Println(suitIds) + + var userLiveMvDeckCustomByID []model.UserLiveMvDeckCustomByID + userLiveMvDeckCustomByID = append(userLiveMvDeckCustomByID, saveReq.LiveMasterID) + userLiveMvDeckCustomByID = append(userLiveMvDeckCustomByID, userLiveMvDeckInfo) + // fmt.Println(userLiveMvDeckCustomByID) + + viewStatusIds := map[int]int{} + for k, v := range saveReq.ViewStatusByPos { + if k%2 == 0 { + viewStatusId := saveReq.ViewStatusByPos[k+1] + viewStatusIds[v] = viewStatusId + } + } + // fmt.Println(viewStatusIds) + + var userMemberByMemberID []model.UserMemberByMemberID + for k, v := range memberIds { + userMemberByMemberID = append(userMemberByMemberID, v) + userMemberByMemberID = append(userMemberByMemberID, model.UserMemberInfo{ + MemberMasterID: v, + CustomBackgroundMasterID: 103506600, + SuitMasterID: suitIds[k], + LovePoint: 0, + LovePointLimit: 999999, + LoveLevel: 1, + ViewStatus: viewStatusIds[k], + IsNew: true, + }) + } + // fmt.Println(userMemberByMemberID) + + saveResp := model.LiveSaveDeckResp{ + UserModel: model.UserModel{ + UserStatus: CommonUserStatus(), + UserMemberByMemberID: userMemberByMemberID, + UserCardByCardID: []interface{}{}, + UserSuitBySuitID: []interface{}{}, + UserLiveDeckByID: []interface{}{}, + UserLivePartyByID: []interface{}{}, + UserLessonDeckByID: []interface{}{}, + UserLiveMvDeckByID: []interface{}{}, + UserLiveMvDeckCustomByID: userLiveMvDeckCustomByID, + UserLiveDifficultyByDifficultyID: []interface{}{}, + UserStoryMainByStoryMainID: []interface{}{}, + UserStoryMainSelectedByStoryMainCellID: []interface{}{}, + UserVoiceByVoiceID: []interface{}{}, + UserEmblemByEmblemID: []interface{}{}, + UserGachaTicketByTicketID: []interface{}{}, + UserGachaPointByPointID: []interface{}{}, + UserLessonEnhancingItemByItemID: []interface{}{}, + UserTrainingMaterialByItemID: []interface{}{}, + UserGradeUpItemByItemID: []interface{}{}, + UserCustomBackgroundByID: []interface{}{}, + UserStorySideByID: []interface{}{}, + UserStoryMemberByID: []interface{}{}, + UserCommunicationMemberDetailBadgeByID: []interface{}{}, + UserStoryEventHistoryByID: []interface{}{}, + UserRecoveryLpByID: []interface{}{}, + UserRecoveryApByID: []interface{}{}, + UserMissionByMissionID: []interface{}{}, + UserDailyMissionByMissionID: []interface{}{}, + UserWeeklyMissionByMissionID: []interface{}{}, + UserInfoTriggerBasicByTriggerID: []interface{}{}, + UserInfoTriggerCardGradeUpByTriggerID: []interface{}{}, + UserInfoTriggerMemberGuildSupportItemExpiredByTriggerID: []interface{}{}, + UserInfoTriggerMemberLoveLevelUpByTriggerID: []interface{}{}, + UserAccessoryByUserAccessoryID: []interface{}{}, + UserAccessoryLevelUpItemByID: []interface{}{}, + UserAccessoryRarityUpItemByID: []interface{}{}, + UserUnlockScenesByEnum: []interface{}{}, + UserSceneTipsByEnum: []interface{}{}, + UserRuleDescriptionByID: []interface{}{}, + UserExchangeEventPointByID: []interface{}{}, + UserSchoolIdolFestivalIDRewardMissionByID: []interface{}{}, + UserGpsPresentReceivedByID: []interface{}{}, + UserEventMarathonByEventMasterID: []interface{}{}, + UserEventMiningByEventMasterID: []interface{}{}, + UserEventCoopByEventMasterID: []interface{}{}, + UserLiveSkipTicketByID: []interface{}{}, + UserStoryEventUnlockItemByID: []interface{}{}, + UserEventMarathonBoosterByID: []interface{}{}, + UserReferenceBookByID: []interface{}{}, + UserReviewRequestProcessFlowByID: []interface{}{}, + UserRankExpByID: []interface{}{}, + UserShareByID: []interface{}{}, + UserTowerByTowerID: []interface{}{}, + UserRecoveryTowerCardUsedCountItemByRecoveryTowerCardUsedCountItemMasterID: []interface{}{}, + UserStoryLinkageByID: []interface{}{}, + UserSubscriptionStatusByID: []interface{}{}, + UserStoryMainPartDigestMovieByID: []interface{}{}, + UserMemberGuildByID: []interface{}{}, + UserMemberGuildSupportItemByID: []interface{}{}, + UserDailyTheaterByDailyTheaterID: []interface{}{}, + UserPlayListByID: []interface{}{}, + }, + } + respB, err := json.Marshal(saveResp) + if err != nil { + panic(err) + } + // fmt.Println(string(b)) + + resp := SignResp(ctx.GetString("ep"), string(respB), sessionKey) + // fmt.Println(resp) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchCommunicationMemberDetail(ctx *gin.Context) { + reqBody := ctx.GetString("reqBody") + var memberId int64 + gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { + if value.Get("member_id").String() != "" { + memberId = value.Get("member_id").Int() + return false + } + return true + }) + + signBody := utils.ReadAllText("assets/as/fetchCommunicationMemberDetail.json") + signBody, _ = sjson.Set(signBody, "member_love_panels.0.member_id", memberId) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsTapLovePoint(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/tapLovePoint.json"), + "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsUpdateUserCommunicationMemberDetailBadge(ctx *gin.Context) { + reqBody := ctx.GetString("reqBody") + var memberMasterId int64 + gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { + if value.Get("member_master_id").String() != "" { + memberMasterId = value.Get("member_master_id").Int() + return false + } + return true + }) + + userDetail := []interface{}{} + userDetail = append(userDetail, memberMasterId) + userDetail = append(userDetail, model.UserCommunicationMemberDetailBadgeByID{ + MemberMasterID: int(memberMasterId), + }) + + signBody := utils.ReadAllText("assets/as/updateUserCommunicationMemberDetailBadge.json") + signBody, _ = sjson.Set(signBody, "user_model.user_status", GetUserStatus()) + signBody, _ = sjson.Set(signBody, "user_model.user_communication_member_detail_badge_by_id", userDetail) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsUpdateUserLiveDifficultyNewFlag(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/updateUserLiveDifficultyNewFlag.json"), + "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFinishUserStorySide(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/finishUserStorySide.json"), + "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFinishUserStoryMember(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/finishUserStoryMember.json"), + "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsSetTheme(ctx *gin.Context) { + reqBody := ctx.GetString("reqBody") + var memberMasterId, suitMasterId, backgroundMasterId int64 + gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { + if value.Get("member_master_id").String() != "" { + memberMasterId = value.Get("member_master_id").Int() + suitMasterId = value.Get("suit_master_id").Int() + backgroundMasterId = value.Get("custom_background_master_id").Int() + return false + } + return true + }) + + userMemberRes := []model.SetThemeRes{} + userMemberRes = append(userMemberRes, memberMasterId) + userMemberRes = append(userMemberRes, model.UserMemberInfo{ + MemberMasterID: int(memberMasterId), + CustomBackgroundMasterID: int(backgroundMasterId), + SuitMasterID: int(suitMasterId), + LovePoint: 10271130, + LovePointLimit: 10271130, + LoveLevel: 450, + ViewStatus: 1, + IsNew: false, + }) + + userSuitRes := []model.SetThemeRes{} + userSuitRes = append(userSuitRes, suitMasterId) + userSuitRes = append(userSuitRes, model.AsSuitInfo{ + SuitMasterID: int(suitMasterId), + IsNew: false, + }) + + signBody := utils.ReadAllText("assets/as/setTheme.json") + signBody, _ = sjson.Set(signBody, "user_model.user_status", GetUserStatus()) + signBody, _ = sjson.Set(signBody, "user_model.user_member_by_member_id", userMemberRes) + signBody, _ = sjson.Set(signBody, "user_model.user_suit_by_suit_id", userSuitRes) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchProfile(ctx *gin.Context) { + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchProfile.json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchEmblem(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/fetchEmblem.json"), + "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsActivateEmblem(ctx *gin.Context) { + reqBody := ctx.GetString("reqBody") + var emblemId int64 + gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { + if value.Get("emblem_master_id").String() != "" { + emblemId = value.Get("emblem_master_id").Int() + return false + } + return true + }) + + signBody := utils.ReadAllText("assets/as/activateEmblem.json") + signBody, _ = sjson.Set(signBody, "user_model.user_status", GetUserStatus()) + signBody, _ = sjson.Set(signBody, "user_model.user_status", GetUserStatus()) + signBody, _ = sjson.Set(signBody, "user_model.user_status.emblem_id", emblemId) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsSaveUserNaviVoice(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/saveUserNaviVoice.json"), + "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsSaveDeckAll(ctx *gin.Context) { + reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] + // fmt.Println(reqBody.String()) + + req := model.AsSaveDeckReq{} + decoder := json.NewDecoder(strings.NewReader(reqBody.String())) + decoder.UseNumber() + err := decoder.Decode(&req) + CheckErr(err) + // fmt.Println("Raw:", req.SquadDict) + + if req.CardWithSuit[1] == 0 { + req.CardWithSuit[1] = req.CardWithSuit[0] + } + if req.CardWithSuit[3] == 0 { + req.CardWithSuit[3] = req.CardWithSuit[2] + } + if req.CardWithSuit[5] == 0 { + req.CardWithSuit[5] = req.CardWithSuit[4] + } + if req.CardWithSuit[7] == 0 { + req.CardWithSuit[7] = req.CardWithSuit[6] + } + if req.CardWithSuit[9] == 0 { + req.CardWithSuit[9] = req.CardWithSuit[8] + } + if req.CardWithSuit[11] == 0 { + req.CardWithSuit[11] = req.CardWithSuit[10] + } + if req.CardWithSuit[13] == 0 { + req.CardWithSuit[13] = req.CardWithSuit[12] + } + if req.CardWithSuit[15] == 0 { + req.CardWithSuit[15] = req.CardWithSuit[14] + } + if req.CardWithSuit[17] == 0 { + req.CardWithSuit[17] = req.CardWithSuit[16] + } + + deckInfo := model.AsDeckInfo{ + UserLiveDeckID: req.DeckID, + Name: model.AsDeckName{ + DotUnderText: "队伍名称变了?", + }, + CardMasterID1: req.CardWithSuit[0], + CardMasterID2: req.CardWithSuit[2], + CardMasterID3: req.CardWithSuit[4], + CardMasterID4: req.CardWithSuit[6], + CardMasterID5: req.CardWithSuit[8], + CardMasterID6: req.CardWithSuit[10], + CardMasterID7: req.CardWithSuit[12], + CardMasterID8: req.CardWithSuit[14], + CardMasterID9: req.CardWithSuit[16], + SuitMasterID1: req.CardWithSuit[1], + SuitMasterID2: req.CardWithSuit[3], + SuitMasterID3: req.CardWithSuit[5], + SuitMasterID4: req.CardWithSuit[7], + SuitMasterID5: req.CardWithSuit[9], + SuitMasterID6: req.CardWithSuit[11], + SuitMasterID7: req.CardWithSuit[13], + SuitMasterID8: req.CardWithSuit[15], + SuitMasterID9: req.CardWithSuit[17], + } + // fmt.Println(deckInfo) + + deckInfoRes := []model.AsResp{} + deckInfoRes = append(deckInfoRes, req.DeckID) + deckInfoRes = append(deckInfoRes, deckInfo) + + partyInfoRes := []model.AsResp{} + for k, v := range req.SquadDict { + if k%2 == 0 { + partyId, err := v.(json.Number).Int64() + CheckErr(err) + // fmt.Println("Party ID:", partyId) + + rDictInfo, err := json.Marshal(req.SquadDict[k+1]) + CheckErr(err) + + dictInfo := model.AsDeckSquadDict{} + if err = json.Unmarshal(rDictInfo, &dictInfo); err != nil { + panic(err) + } + // fmt.Println("Party Info:", dictInfo) + + roleIds := []int{} + err = MainEng.Table("m_card"). + Where("id IN (?,?,?)", dictInfo.CardMasterIds[0], dictInfo.CardMasterIds[1], dictInfo.CardMasterIds[2]). + Cols("role").Find(&roleIds) + CheckErr(err) + // fmt.Println("roleIds:", roleIds) + + var partyIcon int + var partyName string + // 脑残逻辑部分 + exists, err := MainEng.Table("m_live_party_name"). + Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[0], roleIds[1], roleIds[2]). + Cols("name,live_party_icon").Get(&partyName, &partyIcon) + CheckErr(err) + if !exists { + exists, err = MainEng.Table("m_live_party_name"). + Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[0], roleIds[2], roleIds[1]). + Cols("name,live_party_icon").Get(&partyName, &partyIcon) + CheckErr(err) + if !exists { + exists, err = MainEng.Table("m_live_party_name"). + Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[1], roleIds[0], roleIds[2]). + Cols("name,live_party_icon").Get(&partyName, &partyIcon) + CheckErr(err) + if !exists { + exists, err = MainEng.Table("m_live_party_name"). + Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[1], roleIds[2], roleIds[0]). + Cols("name,live_party_icon").Get(&partyName, &partyIcon) + CheckErr(err) + if !exists { + exists, err = MainEng.Table("m_live_party_name"). + Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[2], roleIds[0], roleIds[1]). + Cols("name,live_party_icon").Get(&partyName, &partyIcon) + CheckErr(err) + if !exists { + exists, err = MainEng.Table("m_live_party_name"). + Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[2], roleIds[1], roleIds[0]). + Cols("name,live_party_icon").Get(&partyName, &partyIcon) + CheckErr(err) + if !exists { + panic("Fuck you!") + } + } + } + } + } + } + + var realPartyName string + _, err = MainEng.Table("m_dictionary").Where("id = ?", strings.ReplaceAll(partyName, "k.", "")).Cols("message").Get(&realPartyName) + CheckErr(err) + + partyInfo := model.AsPartyInfo{ + PartyID: int(partyId), + UserLiveDeckID: req.DeckID, + Name: model.AsPartyName{ + DotUnderText: realPartyName, + }, + IconMasterID: partyIcon, + CardMasterID1: dictInfo.CardMasterIds[0], + CardMasterID2: dictInfo.CardMasterIds[1], + CardMasterID3: dictInfo.CardMasterIds[2], + UserAccessoryID1: dictInfo.UserAccessoryIds[0], + UserAccessoryID2: dictInfo.UserAccessoryIds[1], + UserAccessoryID3: dictInfo.UserAccessoryIds[2], + } + // fmt.Println(partyInfo) + + partyInfoRes = append(partyInfoRes, partyId) + partyInfoRes = append(partyInfoRes, partyInfo) + } + } + + respBody := utils.ReadAllText("assets/as/saveDeckAll.json") + respBody, _ = sjson.Set(respBody, "user_model.user_status", GetUserStatus()) + respBody, _ = sjson.Set(respBody, "user_model.user_live_deck_by_id", deckInfoRes) + respBody, _ = sjson.Set(respBody, "user_model.user_live_party_by_id", partyInfoRes) + resp := SignResp(ctx.GetString("ep"), respBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchLivePartners(ctx *gin.Context) { + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchLivePartners.json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchLiveDeckSelect(ctx *gin.Context) { + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchLiveDeckSelect.json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsLiveStart(ctx *gin.Context) { + reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] + // fmt.Println(reqBody.String()) + + liveStartReq := model.AsLiveStartReq{} + if err := json.Unmarshal([]byte(reqBody.String()), &liveStartReq); err != nil { + panic(err) + } + // fmt.Println(liveStartReq) + + var cardInfo string + partnerResp := gjson.Parse(utils.ReadAllText("assets/as/fetchLivePartners.json")).Get("partner_select_state.live_partners") + partnerResp.ForEach(func(k, v gjson.Result) bool { + userId := v.Get("user_id").Int() + if userId == int64(liveStartReq.PartnerUserID) { + v.Get("card_by_category").ForEach(func(kk, vv gjson.Result) bool { + if vv.IsObject() { + cardId := vv.Get("card_master_id").Int() + if cardId == int64(liveStartReq.PartnerCardMasterID) { + cardInfo = vv.String() + // fmt.Println(cardInfo) + return false + } + } + return true + }) + return false + } + return true + }) + + // 保存请求包因为 /live/finish 接口的响应包里有部分字段不在该接口的请求包里 + liveId := time.Now().UnixNano() + liveIdStr := strconv.Itoa(int(liveId)) + err := database.LevelDb.Put([]byte("live_"+liveIdStr), []byte(reqBody.String())) + CheckErr(err) + + liveDifficultyId := strconv.Itoa(liveStartReq.LiveDifficultyID) + liveNotes := utils.ReadAllText("assets/as/notes/" + liveDifficultyId + ".json") + if liveNotes == "" { + panic("歌曲情报信息不存在!") + } + + var liveNotesRes map[string]interface{} + if err = json.Unmarshal([]byte(liveNotes), &liveNotesRes); err != nil { + panic(err) + } + + var partnerInfo map[string]interface{} + if err = json.Unmarshal([]byte(cardInfo), &partnerInfo); err != nil { + panic(err) + } + + liveStartResp := utils.ReadAllText("assets/as/liveStart.json") + liveStartResp, _ = sjson.Set(liveStartResp, "live.live_id", liveId) + liveStartResp, _ = sjson.Set(liveStartResp, "live.deck_id", liveStartReq.DeckID) + liveStartResp, _ = sjson.Set(liveStartResp, "live.live_stage", liveNotesRes) + liveStartResp, _ = sjson.Set(liveStartResp, "live.live_partner_card", partnerInfo) + liveStartResp, _ = sjson.Set(liveStartResp, "user_model_diff.user_status", GetUserStatus()) + liveStartResp, _ = sjson.Set(liveStartResp, "user_model_diff.user_status.latest_live_deck_id", liveStartReq.DeckID) + liveStartResp, _ = sjson.Set(liveStartResp, "user_model_diff.user_status.last_live_difficulty_id", liveStartReq.LiveDifficultyID) + resp := SignResp(ctx.GetString("ep"), liveStartResp, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsLiveFinish(ctx *gin.Context) { + reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] + // fmt.Println(reqBody.String()) + + var cardMasterId, maxVolt, skillCount, appealCount int64 + liveFinishReq := gjson.Parse(reqBody.String()) + liveFinishReq.Get("live_score.card_stat_dict").ForEach(func(key, value gjson.Result) bool { + if value.IsObject() { + volt := value.Get("got_voltage").Int() + if volt > maxVolt { + maxVolt = volt + + cardMasterId = value.Get("card_master_id").Int() + skillCount = value.Get("skill_triggered_count").Int() + appealCount = value.Get("appeal_count").Int() + } + } + return true + }) + + mvpInfo := model.AsMvpInfo{ + CardMasterID: cardMasterId, + GetVoltage: maxVolt, + SkillTriggeredCount: skillCount, + AppealCount: appealCount, + } + + liveId := liveFinishReq.Get("live_id").String() + res, err := database.LevelDb.Get([]byte("live_" + liveId)) + CheckErr(err) + + liveStartReq := model.AsLiveStartReq{} + if err := json.Unmarshal(res, &liveStartReq); err != nil { + panic(err) + } + // fmt.Println("liveStartReq:", liveStartReq) + + partnerInfo := model.AsLivePartnerInfo{ + LastPlayedAt: time.Now().Unix(), + RecommendCardMasterID: liveStartReq.PartnerCardMasterID, + RecommendCardLevel: 1, + IsRecommendCardImageAwaken: true, + IsRecommendCardAllTrainingActivated: true, + IsNew: false, + FriendApprovedAt: nil, + RequestStatus: 3, + IsRequestPending: false, + } + partnerResp := gjson.Parse(utils.ReadAllText("assets/as/fetchLivePartners.json")).Get("partner_select_state.live_partners") + partnerResp.ForEach(func(k, v gjson.Result) bool { + userId := v.Get("user_id").Int() + if userId == int64(liveStartReq.PartnerUserID) { + partnerInfo.UserID = int(userId) + partnerInfo.Name.DotUnderText = v.Get("name.dot_under_text").String() + partnerInfo.Rank = int(v.Get("rank").Int()) + partnerInfo.EmblemID = int(v.Get("emblem_id").Int()) + partnerInfo.IntroductionMessage.DotUnderText = v.Get("introduction_message.dot_under_text").String() + } + return true + }) + + liveResult := model.AsLiveResultAchievementStatus{ + ClearCount: 1, + GotVoltage: liveFinishReq.Get("live_score.current_score").Int(), + RemainingStamina: liveFinishReq.Get("live_score.remaining_stamina").Int(), + } + + liveFinishResp := utils.ReadAllText("assets/as/liveFinish.json") + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.live_difficulty_master_id", liveStartReq.LiveDifficultyID) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.live_deck_id", liveStartReq.DeckID) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.mvp", mvpInfo) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.partner", partnerInfo) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.live_result_achievement_status", liveResult) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.voltage", liveFinishReq.Get("live_score.current_score").Int()) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.last_best_voltage", liveFinishReq.Get("live_score.current_score").Int()) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.before_user_exp", GetUserStatus()["exp"].(float64)) + liveFinishResp, _ = sjson.Set(liveFinishResp, "live_result.gain_user_exp", 0) + liveFinishResp, _ = sjson.Set(liveFinishResp, "user_model_diff.user_status", GetUserStatus()) + liveFinishResp, _ = sjson.Set(liveFinishResp, "user_model_diff.user_status.latest_live_deck_id", liveStartReq.DeckID) + liveFinishResp, _ = sjson.Set(liveFinishResp, "user_model_diff.user_status.last_live_difficulty_id", liveStartReq.LiveDifficultyID) + resp := SignResp(ctx.GetString("ep"), liveFinishResp, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsGetOtherUserCard(ctx *gin.Context) { + reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] + // fmt.Println(reqBody.String()) + + userCardReq := model.AsUserCardReq{} + if err := json.Unmarshal([]byte(reqBody.String()), &userCardReq); err != nil { + panic(err) + } + // fmt.Println(liveStartReq) + + var cardInfo string + partnerResp := gjson.Parse(utils.ReadAllText("assets/as/fetchLivePartners.json")).Get("partner_select_state.live_partners") + partnerResp.ForEach(func(k, v gjson.Result) bool { + userId := v.Get("user_id").Int() + if userId == userCardReq.UserID { + v.Get("card_by_category").ForEach(func(kk, vv gjson.Result) bool { + if vv.IsObject() { + cardId := vv.Get("card_master_id").Int() + if cardId == userCardReq.CardMasterID { + cardInfo = vv.String() + // fmt.Println(cardInfo) + return false + } + } + return true + }) + return false + } + return true + }) + + var userCardInfo map[string]interface{} + if err := json.Unmarshal([]byte(cardInfo), &userCardInfo); err != nil { + panic(err) + } + + userCardResp := utils.ReadAllText("assets/as/getOtherUserCard.json") + userCardResp, _ = sjson.Set(userCardResp, "other_user_card", userCardInfo) + resp := SignResp(ctx.GetString("ep"), userCardResp, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchNoticeDetail(ctx *gin.Context) { + reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] + // fmt.Println(reqBody.String()) + + noticeId := reqBody.Get("notice_id").String() + + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/notices/"+noticeId+".json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsChangeIsAwakeningImage(ctx *gin.Context) { + reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] + // fmt.Println(reqBody.String()) + + req := model.AsCardAwakeningReq{} + if err := json.Unmarshal([]byte(reqBody.String()), &req); err != nil { + panic(err) + } + + cardInfo := model.AsCardInfo{} + gjson.Parse(utils.ReadAllText("assets/as/login.json")).Get("user_model.user_card_by_card_id"). + ForEach(func(key, value gjson.Result) bool { + if value.IsObject() { + if err := json.Unmarshal([]byte(value.String()), &cardInfo); err != nil { + panic(err) + } + + if cardInfo.CardMasterID == req.CardMasterID { + cardInfo.IsAwakeningImage = req.IsAwakeningImage + + return false + } + } + return true + }) + + userCardInfo := []interface{}{} + userCardInfo = append(userCardInfo, cardInfo.CardMasterID) + userCardInfo = append(userCardInfo, cardInfo) + + cardResp := utils.ReadAllText("assets/as/changeIsAwakeningImage.json") + cardResp, _ = sjson.Set(cardResp, "user_model_diff.user_status", GetUserStatus()) + cardResp, _ = sjson.Set(cardResp, "user_model_diff.user_card_by_card_id", userCardInfo) + resp := SignResp(ctx.GetString("ep"), cardResp, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFinishStory(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/finishStory.json"), + "user_model.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFinishStoryMain(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/finishUserStoryMain.json"), + "user_model_diff.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFinishStoryLinkage(ctx *gin.Context) { + signBody, _ := sjson.Set(utils.ReadAllText("assets/as/finishStoryLinkage.json"), + "user_model_diff.user_status", GetUserStatus()) + resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} + +func AsFetchTrainingTree(ctx *gin.Context) { + resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchTrainingTree.json"), sessionKey) + + ctx.Header("Content-Type", "application/json") + ctx.String(http.StatusOK, resp) +} diff --git a/handler/global.go b/handler/global.go index 51e8f84..a711c92 100644 --- a/handler/global.go +++ b/handler/global.go @@ -1,7 +1,13 @@ package handler import ( + "encoding/json" + "fmt" "honoka-chan/config" + "honoka-chan/encrypt" + "honoka-chan/model" + "honoka-chan/utils" + "time" "xorm.io/xorm" ) @@ -11,6 +17,9 @@ var ( ErrorMsg = `{"code":20001,"message":""}` MainEng *xorm.Engine UserEng *xorm.Engine + + // LLAS + sessionKey = "12345678123456781234567812345678" ) func init() { @@ -34,3 +43,81 @@ func IsSigned(unitId int) bool { return exists } + +func SignResp(ep, body, key string) (resp string) { + signBody := fmt.Sprintf("%d,\"%s\",0,%s", time.Now().UnixMilli(), config.MasterVersion, body) + sign := encrypt.HMAC_SHA1_Encrypt([]byte(ep+" "+signBody), []byte(key)) + // fmt.Println(sign) + + resp = fmt.Sprintf("[%s,\"%s\"]", signBody, sign) + return +} + +func GetUserStatus() map[string]interface{} { + var r map[string]interface{} + if err := json.Unmarshal([]byte(utils.ReadAllText("assets/as/userStatus.json")), &r); err != nil { + panic(err) + } + return r +} + +func CommonUserStatus() model.AsUserStatus { + return model.AsUserStatus{ + Name: model.Name{ + DotUnderText: "梦路2号机@果果厨", + }, + Nickname: model.Nickname{ + DotUnderText: "梦路", + }, + LastLoginAt: time.Now().Unix(), + Rank: 122, + Exp: 416263, + Message: model.Message{ + DotUnderText: "B站主播:梦路_YumeMichi", + }, + RecommendCardMasterID: 200013001, + MaxFriendNum: 0, + LivePointFullAt: 1684158189, + LivePointBroken: 150, + LivePointSubscriptionRecoveryDailyCount: 1, + LivePointSubscriptionRecoveryDailyResetAt: 1656259200, + ActivityPointCount: 0, + ActivityPointResetAt: 1684123200, + ActivityPointPaymentRecoveryDailyCount: 10, + ActivityPointPaymentRecoveryDailyResetAt: 1683734400, + GameMoney: 115665089, + CardExp: 32316167, + FreeSnsCoin: 280, + AppleSnsCoin: 0, + GoogleSnsCoin: 0, + Cash: 0, + SubscriptionCoin: 30, + BirthDate: nil, + BirthMonth: 10, + BirthDay: 18, + LatestLiveDeckID: 1, + MainLessonDeckID: 1, + FavoriteMemberID: 1, + LastLiveDifficultyID: 12092302, + LpMagnification: 1, + EmblemID: 13100608, + DeviceToken: "", + TutorialPhase: 99, + TutorialEndAt: 1622217482, + LoginDays: 446, + NaviTapCount: 2, + NaviTapRecoverAt: 1684771200, + IsAutoMode: false, + MaxScoreLiveDifficultyMasterID: 12037401, + LiveMaxScore: 40553270, + MaxComboLiveDifficultyMasterID: 12037401, + LiveMaxCombo: 301, + LessonResumeStatus: 1, + AccessoryBoxAdditional: 90, + TermsOfUseVersion: 0, + BootstrapSifidCheckAt: 1683178908, + GdprVersion: 0, + MemberGuildMemberMasterID: 1, + MemberGuildLastUpdatedAt: 1659485328, + } +} diff --git a/model/allstars.go b/model/allstars.go new file mode 100644 index 0000000..674c3f3 --- /dev/null +++ b/model/allstars.go @@ -0,0 +1,544 @@ +package model + +// AsLoginRes ... +type AsLoginRes struct { + SessionKey string `json:"session_key"` + UserModel UserModel `json:"user_model"` + IsPlatformServiceLinked bool `json:"is_platform_service_linked"` + LastTimestamp int64 `json:"last_timestamp"` + Cautions []interface{} `json:"cautions"` + ShowHomeCaution bool `json:"show_home_caution"` + LiveResume interface{} `json:"live_resume"` + FromEea bool `json:"from_eea"` + GdprConsentedInfo GdprConsentedInfo `json:"gdpr_consented_info"` + UserID int `json:"user_id"` + IsUnderAge int `json:"is_under_age"` + AreaID int `json:"area_id"` + AuthCount int `json:"auth_count"` + MemberLovePanels []MemberLovePanels `json:"member_love_panels"` + CheckMaintenance bool `json:"check_maintenance"` + ReproInfo ReproInfo `json:"repro_info"` +} + +// UserModel ... +type UserModel struct { + UserStatus AsUserStatus `json:"user_status"` + UserMemberByMemberID interface{} `json:"user_member_by_member_id"` + UserCardByCardID []interface{} `json:"user_card_by_card_id"` + UserSuitBySuitID []interface{} `json:"user_suit_by_suit_id"` + UserLiveDeckByID []interface{} `json:"user_live_deck_by_id"` + UserLivePartyByID []interface{} `json:"user_live_party_by_id"` + UserLessonDeckByID []interface{} `json:"user_lesson_deck_by_id"` + UserLiveMvDeckByID []interface{} `json:"user_live_mv_deck_by_id"` + UserLiveMvDeckCustomByID interface{} `json:"user_live_mv_deck_custom_by_id"` + UserLiveDifficultyByDifficultyID []interface{} `json:"user_live_difficulty_by_difficulty_id"` + UserStoryMainByStoryMainID []interface{} `json:"user_story_main_by_story_main_id"` + UserStoryMainSelectedByStoryMainCellID []interface{} `json:"user_story_main_selected_by_story_main_cell_id"` + UserVoiceByVoiceID []interface{} `json:"user_voice_by_voice_id"` + UserEmblemByEmblemID []interface{} `json:"user_emblem_by_emblem_id"` + UserGachaTicketByTicketID []interface{} `json:"user_gacha_ticket_by_ticket_id"` + UserGachaPointByPointID []interface{} `json:"user_gacha_point_by_point_id"` + UserLessonEnhancingItemByItemID []interface{} `json:"user_lesson_enhancing_item_by_item_id"` + UserTrainingMaterialByItemID []interface{} `json:"user_training_material_by_item_id"` + UserGradeUpItemByItemID []interface{} `json:"user_grade_up_item_by_item_id"` + UserCustomBackgroundByID []interface{} `json:"user_custom_background_by_id"` + UserStorySideByID []interface{} `json:"user_story_side_by_id"` + UserStoryMemberByID []interface{} `json:"user_story_member_by_id"` + UserCommunicationMemberDetailBadgeByID []interface{} `json:"user_communication_member_detail_badge_by_id"` + UserStoryEventHistoryByID []interface{} `json:"user_story_event_history_by_id"` + UserRecoveryLpByID []interface{} `json:"user_recovery_lp_by_id"` + UserRecoveryApByID []interface{} `json:"user_recovery_ap_by_id"` + UserMissionByMissionID []interface{} `json:"user_mission_by_mission_id"` + UserDailyMissionByMissionID []interface{} `json:"user_daily_mission_by_mission_id"` + UserWeeklyMissionByMissionID []interface{} `json:"user_weekly_mission_by_mission_id"` + UserInfoTriggerBasicByTriggerID []interface{} `json:"user_info_trigger_basic_by_trigger_id"` + UserInfoTriggerCardGradeUpByTriggerID []interface{} `json:"user_info_trigger_card_grade_up_by_trigger_id"` + UserInfoTriggerMemberGuildSupportItemExpiredByTriggerID []interface{} `json:"user_info_trigger_member_guild_support_item_expired_by_trigger_id"` + UserInfoTriggerMemberLoveLevelUpByTriggerID []interface{} `json:"user_info_trigger_member_love_level_up_by_trigger_id"` + UserAccessoryByUserAccessoryID []interface{} `json:"user_accessory_by_user_accessory_id"` + UserAccessoryLevelUpItemByID []interface{} `json:"user_accessory_level_up_item_by_id"` + UserAccessoryRarityUpItemByID []interface{} `json:"user_accessory_rarity_up_item_by_id"` + UserUnlockScenesByEnum []interface{} `json:"user_unlock_scenes_by_enum"` + UserSceneTipsByEnum []interface{} `json:"user_scene_tips_by_enum"` + UserRuleDescriptionByID []interface{} `json:"user_rule_description_by_id"` + UserExchangeEventPointByID []interface{} `json:"user_exchange_event_point_by_id"` + UserSchoolIdolFestivalIDRewardMissionByID []interface{} `json:"user_school_idol_festival_id_reward_mission_by_id"` + UserGpsPresentReceivedByID []interface{} `json:"user_gps_present_received_by_id"` + UserEventMarathonByEventMasterID []interface{} `json:"user_event_marathon_by_event_master_id"` + UserEventMiningByEventMasterID []interface{} `json:"user_event_mining_by_event_master_id"` + UserEventCoopByEventMasterID []interface{} `json:"user_event_coop_by_event_master_id"` + UserLiveSkipTicketByID []interface{} `json:"user_live_skip_ticket_by_id"` + UserStoryEventUnlockItemByID []interface{} `json:"user_story_event_unlock_item_by_id"` + UserEventMarathonBoosterByID []interface{} `json:"user_event_marathon_booster_by_id"` + UserReferenceBookByID []interface{} `json:"user_reference_book_by_id"` + UserReviewRequestProcessFlowByID []interface{} `json:"user_review_request_process_flow_by_id"` + UserRankExpByID []interface{} `json:"user_rank_exp_by_id"` + UserShareByID []interface{} `json:"user_share_by_id"` + UserTowerByTowerID []interface{} `json:"user_tower_by_tower_id"` + UserRecoveryTowerCardUsedCountItemByRecoveryTowerCardUsedCountItemMasterID []interface{} `json:"user_recovery_tower_card_used_count_item_by_recovery_tower_card_used_count_item_master_id"` + UserStoryLinkageByID []interface{} `json:"user_story_linkage_by_id"` + UserSubscriptionStatusByID []interface{} `json:"user_subscription_status_by_id"` + UserStoryMainPartDigestMovieByID []interface{} `json:"user_story_main_part_digest_movie_by_id"` + UserMemberGuildByID []interface{} `json:"user_member_guild_by_id"` + UserMemberGuildSupportItemByID []interface{} `json:"user_member_guild_support_item_by_id"` + UserDailyTheaterByDailyTheaterID []interface{} `json:"user_daily_theater_by_daily_theater_id"` + UserPlayListByID []interface{} `json:"user_play_list_by_id"` +} + +// Name ... +type Name struct { + DotUnderText string `json:"dot_under_text"` +} + +// Nickname ... +type Nickname struct { + DotUnderText string `json:"dot_under_text"` +} + +// Message ... +type Message struct { + DotUnderText string `json:"dot_under_text"` +} + +// AsUserStatus ... +type AsUserStatus struct { + Name Name `json:"name"` + Nickname Nickname `json:"nickname"` + LastLoginAt int64 `json:"last_login_at"` + Rank int `json:"rank"` + Exp int `json:"exp"` + Message Message `json:"message"` + RecommendCardMasterID int `json:"recommend_card_master_id"` + MaxFriendNum int `json:"max_friend_num"` + LivePointFullAt int `json:"live_point_full_at"` + LivePointBroken int `json:"live_point_broken"` + LivePointSubscriptionRecoveryDailyCount int `json:"live_point_subscription_recovery_daily_count"` + LivePointSubscriptionRecoveryDailyResetAt int `json:"live_point_subscription_recovery_daily_reset_at"` + ActivityPointCount int `json:"activity_point_count"` + ActivityPointResetAt int `json:"activity_point_reset_at"` + ActivityPointPaymentRecoveryDailyCount int `json:"activity_point_payment_recovery_daily_count"` + ActivityPointPaymentRecoveryDailyResetAt int `json:"activity_point_payment_recovery_daily_reset_at"` + GameMoney int `json:"game_money"` + CardExp int `json:"card_exp"` + FreeSnsCoin int `json:"free_sns_coin"` + AppleSnsCoin int `json:"apple_sns_coin"` + GoogleSnsCoin int `json:"google_sns_coin"` + Cash int `json:"cash"` + SubscriptionCoin int `json:"subscription_coin"` + BirthDate interface{} `json:"birth_date"` + BirthMonth int `json:"birth_month"` + BirthDay int `json:"birth_day"` + LatestLiveDeckID int `json:"latest_live_deck_id"` + MainLessonDeckID int `json:"main_lesson_deck_id"` + FavoriteMemberID int `json:"favorite_member_id"` + LastLiveDifficultyID int `json:"last_live_difficulty_id"` + LpMagnification int `json:"lp_magnification"` + EmblemID int `json:"emblem_id"` + DeviceToken string `json:"device_token"` + TutorialPhase int `json:"tutorial_phase"` + TutorialEndAt int `json:"tutorial_end_at"` + LoginDays int `json:"login_days"` + NaviTapCount int `json:"navi_tap_count"` + NaviTapRecoverAt int `json:"navi_tap_recover_at"` + IsAutoMode bool `json:"is_auto_mode"` + MaxScoreLiveDifficultyMasterID int `json:"max_score_live_difficulty_master_id"` + LiveMaxScore int `json:"live_max_score"` + MaxComboLiveDifficultyMasterID int `json:"max_combo_live_difficulty_master_id"` + LiveMaxCombo int `json:"live_max_combo"` + LessonResumeStatus int `json:"lesson_resume_status"` + AccessoryBoxAdditional int `json:"accessory_box_additional"` + TermsOfUseVersion int `json:"terms_of_use_version"` + BootstrapSifidCheckAt int `json:"bootstrap_sifid_check_at"` + GdprVersion int `json:"gdpr_version"` + MemberGuildMemberMasterID int `json:"member_guild_member_master_id"` + MemberGuildLastUpdatedAt int `json:"member_guild_last_updated_at"` +} + +// GdprConsentedInfo ... +type GdprConsentedInfo struct { + HasConsentedAdPurposeOfUse bool `json:"has_consented_ad_purpose_of_use"` + HasConsentedCrashReport bool `json:"has_consented_crash_report"` +} + +// MemberLovePanels ... +type MemberLovePanels struct { + MemberID int `json:"member_id"` + MemberLovePanelCellIds []int `json:"member_love_panel_cell_ids"` +} + +// ReproInfo ... +type ReproInfo struct { + GroupNo int `json:"group_no"` +} + +// AsCardInfo ... +type AsCardInfo struct { + CardMasterID int `json:"card_master_id"` + Level int `json:"level"` + Exp int `json:"exp"` + LovePoint int `json:"love_point"` + IsFavorite bool `json:"is_favorite"` + IsAwakening bool `json:"is_awakening"` + IsAwakeningImage bool `json:"is_awakening_image"` + IsAllTrainingActivated bool `json:"is_all_training_activated"` + TrainingActivatedCellCount int `json:"training_activated_cell_count"` + MaxFreePassiveSkill int `json:"max_free_passive_skill"` + Grade int `json:"grade"` + TrainingLife int `json:"training_life"` + TrainingAttack int `json:"training_attack"` + TrainingDexterity int `json:"training_dexterity"` + ActiveSkillLevel int `json:"active_skill_level"` + PassiveSkillALevel int `json:"passive_skill_a_level"` + PassiveSkillBLevel int `json:"passive_skill_b_level"` + PassiveSkillCLevel int `json:"passive_skill_c_level"` + AdditionalPassiveSkill1ID int `json:"additional_passive_skill_1_id"` + AdditionalPassiveSkill2ID int `json:"additional_passive_skill_2_id"` + AdditionalPassiveSkill3ID int `json:"additional_passive_skill_3_id"` + AdditionalPassiveSkill4ID int `json:"additional_passive_skill_4_id"` + AcquiredAt int64 `json:"acquired_at"` + IsNew bool `json:"is_new"` +} + +// AsSuitInfo ... +type AsSuitInfo struct { + SuitMasterID int `json:"suit_master_id"` + IsNew bool `json:"is_new"` +} + +// AsEmblemInfo ... +type AsEmblemInfo struct { + EmblemMID int `json:"emblem_m_id"` + IsNew bool `json:"is_new"` + EmblemParam interface{} `json:"emblem_param"` + AcquiredAt int64 `json:"acquired_at"` +} + +// AsEmblemId ... +type AsEmblemId struct { + EmblemMasterID int `json:"emblem_master_id"` + IsNew bool `json:"is_new"` +} + +// AsLiveDifficultyInfo ... +type AsLiveDifficultyInfo struct { + LiveDifficultyID int `json:"live_difficulty_id"` + MaxScore int `json:"max_score"` + MaxCombo int `json:"max_combo"` + PlayCount int `json:"play_count"` + ClearCount int `json:"clear_count"` + CancelCount int `json:"cancel_count"` + NotClearedCount int `json:"not_cleared_count"` + IsFullCombo bool `json:"is_full_combo"` + ClearedDifficultyAchievement1 interface{} `json:"cleared_difficulty_achievement_1"` + ClearedDifficultyAchievement2 interface{} `json:"cleared_difficulty_achievement_2"` + ClearedDifficultyAchievement3 interface{} `json:"cleared_difficulty_achievement_3"` + EnableAutoplay bool `json:"enable_autoplay"` + IsAutoplay bool `json:"is_autoplay"` + IsNew bool `json:"is_new"` +} + +// AsMainStoryInfo ... +type AsMainStoryInfo struct { + StoryMainMasterID int `json:"story_main_master_id"` +} + +// AsNaviVoiceInfo ... +type AsNaviVoiceInfo struct { + NaviVoiceMasterID int `json:"navi_voice_master_id"` + IsNew bool `json:"is_new"` +} + +// AsCustomBackgroundInfo ... +type AsCustomBackgroundInfo struct { + CustomBackgroundMasterID int `json:"custom_background_master_id"` + IsNew bool `json:"is_new"` +} + +// AsStorySideInfo ... +type AsStorySideInfo struct { + StorySideMasterID int `json:"story_side_master_id"` + IsNew bool `json:"is_new"` + AcquiredAt int64 `json:"acquired_at"` +} + +// AsStoryMemberInfo ... +type AsStoryMemberInfo struct { + StoryMemberMasterID int `json:"story_member_master_id"` + IsNew bool `json:"is_new"` + AcquiredAt int64 `json:"acquired_at"` +} + +// AsStoryEventInfo ... +type AsStoryEventInfo struct { + StoryEventID int `json:"story_event_id"` +} + +// AsMissionRes ... +type AsMissionRes struct { + ID int `xorm:"id"` + Count int `xorm:"mission_clear_condition_count"` +} + +// AsFreeMissionInfo ... +type AsFreeMissionInfo struct { + MissionMID int `json:"mission_m_id"` + IsNew bool `json:"is_new"` + MissionCount int `json:"mission_count"` + IsCleared bool `json:"is_cleared"` + IsReceivedReward bool `json:"is_received_reward"` + NewExpiredAt int64 `json:"new_expired_at"` +} + +// AsDailyMissionInfo ... +type AsDailyMissionInfo struct { + MissionMID int `json:"mission_m_id"` + IsNew bool `json:"is_new"` + MissionStartCount int `json:"mission_start_count"` + MissionCount int `json:"mission_count"` + IsCleared bool `json:"is_cleared"` + IsReceivedReward bool `json:"is_received_reward"` + ClearedExpiredAt int64 `json:"cleared_expired_at"` +} + +// AsWeeklyMissionInfo ... +type AsWeeklyMissionInfo struct { + MissionMID int `json:"mission_m_id"` + IsNew bool `json:"is_new"` + MissionStartCount int `json:"mission_start_count"` + MissionCount int `json:"mission_count"` + IsCleared bool `json:"is_cleared"` + IsReceivedReward bool `json:"is_received_reward"` + ClearedExpiredAt int64 `json:"cleared_expired_at"` + NewExpiredAt int64 `json:"new_expired_at"` +} + +// AsMemberLovePanelInfo ... +type AsMemberLovePanelInfo struct { + MemberID int `json:"member_id"` + MemberLovePanelCellIds []int `json:"member_love_panel_cell_ids"` +} + +// AsCardRes ... +type AsCardRes struct { + ID int `xorm:"id"` + CardRarityType int `xorm:"card_rarity_type"` + MaxPassiveSkillSlot int `xorm:"max_passive_skill_slot"` +} + +// AsSaveDeckReq ... +type AsSaveDeckReq struct { + DeckID int `json:"deck_id"` + CardWithSuit []int `json:"card_with_suit"` + SquadDict []interface{} `json:"squad_dict"` +} + +// AsDeckSquadDict ... +type AsDeckSquadDict struct { + CardMasterIds []int `json:"card_master_ids"` + UserAccessoryIds []int64 `json:"user_accessory_ids"` +} + +// AsDeckInfo ... +type AsDeckInfo struct { + UserLiveDeckID int `json:"user_live_deck_id"` + Name AsDeckName `json:"name"` + CardMasterID1 int `json:"card_master_id_1"` + CardMasterID2 int `json:"card_master_id_2"` + CardMasterID3 int `json:"card_master_id_3"` + CardMasterID4 int `json:"card_master_id_4"` + CardMasterID5 int `json:"card_master_id_5"` + CardMasterID6 int `json:"card_master_id_6"` + CardMasterID7 int `json:"card_master_id_7"` + CardMasterID8 int `json:"card_master_id_8"` + CardMasterID9 int `json:"card_master_id_9"` + SuitMasterID1 int `json:"suit_master_id_1"` + SuitMasterID2 int `json:"suit_master_id_2"` + SuitMasterID3 int `json:"suit_master_id_3"` + SuitMasterID4 int `json:"suit_master_id_4"` + SuitMasterID5 int `json:"suit_master_id_5"` + SuitMasterID6 int `json:"suit_master_id_6"` + SuitMasterID7 int `json:"suit_master_id_7"` + SuitMasterID8 int `json:"suit_master_id_8"` + SuitMasterID9 int `json:"suit_master_id_9"` +} + +// AsDeckName ... +type AsDeckName struct { + DotUnderText string `json:"dot_under_text"` +} + +// AsPartyInfo ... +type AsPartyInfo struct { + PartyID int `json:"party_id"` + UserLiveDeckID int `json:"user_live_deck_id"` + Name AsPartyName `json:"name"` + IconMasterID int `json:"icon_master_id"` + CardMasterID1 int `json:"card_master_id_1"` + CardMasterID2 int `json:"card_master_id_2"` + CardMasterID3 int `json:"card_master_id_3"` + UserAccessoryID1 int64 `json:"user_accessory_id_1"` + UserAccessoryID2 int64 `json:"user_accessory_id_2"` + UserAccessoryID3 int64 `json:"user_accessory_id_3"` +} + +// AsPartyName ... +type AsPartyName struct { + DotUnderText string `json:"dot_under_text"` +} + +// AsLiveStartReq ... +type AsLiveStartReq struct { + LiveDifficultyID int `json:"live_difficulty_id"` + DeckID int `json:"deck_id"` + PartnerUserID int `json:"partner_user_id"` + PartnerCardMasterID int `json:"partner_card_master_id"` + LpMagnification int `json:"lp_magnification"` + IsAutoPlay bool `json:"is_auto_play"` + IsReferenceBook bool `json:"is_reference_book"` +} + +// AsLivePartnerInfo ... +type AsLivePartnerInfo struct { + UserID int `json:"user_id"` + Name PartnerName `json:"name"` + Rank int `json:"rank"` + LastPlayedAt int64 `json:"last_played_at"` + RecommendCardMasterID int `json:"recommend_card_master_id"` + RecommendCardLevel int `json:"recommend_card_level"` + IsRecommendCardImageAwaken bool `json:"is_recommend_card_image_awaken"` + IsRecommendCardAllTrainingActivated bool `json:"is_recommend_card_all_training_activated"` + EmblemID int `json:"emblem_id"` + IsNew bool `json:"is_new"` + IntroductionMessage IntroductionMessage `json:"introduction_message"` + FriendApprovedAt interface{} `json:"friend_approved_at"` + RequestStatus int `json:"request_status"` + IsRequestPending bool `json:"is_request_pending"` +} + +// PartnerName ... +type PartnerName struct { + DotUnderText string `json:"dot_under_text"` +} + +// IntroductionMessage ... +type IntroductionMessage struct { + DotUnderText string `json:"dot_under_text"` +} + +// AsLiveResultAchievementStatus ... +type AsLiveResultAchievementStatus struct { + ClearCount int64 `json:"clear_count"` + GotVoltage int64 `json:"got_voltage"` + RemainingStamina int64 `json:"remaining_stamina"` +} + +// AsMvpInfo ... +type AsMvpInfo struct { + CardMasterID int64 `json:"card_master_id"` + GetVoltage int64 `json:"get_voltage"` + SkillTriggeredCount int64 `json:"skill_triggered_count"` + AppealCount int64 `json:"appeal_count"` +} + +// AsUserCardReq ... +type AsUserCardReq struct { + UserID int64 `json:"user_id"` + CardMasterID int64 `json:"card_master_id"` +} + +// AsCardAwakeningReq ... +type AsCardAwakeningReq struct { + CardMasterID int `json:"card_master_id"` + IsAwakeningImage bool `json:"is_awakening_image"` +} + +// AsReq ... +type AsReq interface{} + +// AsResp ... +type AsResp interface{} + +// PackUrlReqBody ... +type PackUrlReqBody struct { + PackNames []string `json:"pack_names"` +} + +// PackUrlRespBody ... +type PackUrlRespBody struct { + UrlList []string `json:"url_list"` +} + +// LiveSaveDeckReq ... +type LiveSaveDeckReq struct { + LiveMasterID int `json:"live_master_id"` + LiveMvDeckType int `json:"live_mv_deck_type"` + MemberMasterIDByPos []int `json:"member_master_id_by_pos"` + SuitMasterIDByPos []int `json:"suit_master_id_by_pos"` + ViewStatusByPos []int `json:"view_status_by_pos"` +} + +// LiveSaveDeckResp ... +type LiveSaveDeckResp struct { + UserModel UserModel `json:"user_model"` +} + +// UserMemberInfo ... +type UserMemberInfo struct { + MemberMasterID int `json:"member_master_id"` + CustomBackgroundMasterID int `json:"custom_background_master_id"` + SuitMasterID int `json:"suit_master_id"` + LovePoint int `json:"love_point"` + LovePointLimit int `json:"love_point_limit"` + LoveLevel int `json:"love_level"` + ViewStatus int `json:"view_status"` + IsNew bool `json:"is_new"` +} + +// UserMemberByMemberID ... +type UserMemberByMemberID interface{} + +// UserLiveMvDeckInfo ... +type UserLiveMvDeckInfo struct { + LiveMasterID interface{} `json:"live_master_id"` + MemberMasterID1 interface{} `json:"member_master_id_1"` + MemberMasterID2 interface{} `json:"member_master_id_2"` + MemberMasterID3 interface{} `json:"member_master_id_3"` + MemberMasterID4 interface{} `json:"member_master_id_4"` + MemberMasterID5 interface{} `json:"member_master_id_5"` + MemberMasterID6 interface{} `json:"member_master_id_6"` + MemberMasterID7 interface{} `json:"member_master_id_7"` + MemberMasterID8 interface{} `json:"member_master_id_8"` + MemberMasterID9 interface{} `json:"member_master_id_9"` + MemberMasterID10 interface{} `json:"member_master_id_10"` + MemberMasterID11 interface{} `json:"member_master_id_11"` + MemberMasterID12 interface{} `json:"member_master_id_12"` + SuitMasterID1 interface{} `json:"suit_master_id_1"` + SuitMasterID2 interface{} `json:"suit_master_id_2"` + SuitMasterID3 interface{} `json:"suit_master_id_3"` + SuitMasterID4 interface{} `json:"suit_master_id_4"` + SuitMasterID5 interface{} `json:"suit_master_id_5"` + SuitMasterID6 interface{} `json:"suit_master_id_6"` + SuitMasterID7 interface{} `json:"suit_master_id_7"` + SuitMasterID8 interface{} `json:"suit_master_id_8"` + SuitMasterID9 interface{} `json:"suit_master_id_9"` + SuitMasterID10 interface{} `json:"suit_master_id_10"` + SuitMasterID11 interface{} `json:"suit_master_id_11"` + SuitMasterID12 interface{} `json:"suit_master_id_12"` +} + +// UserLiveMvDeckCustomByID ... +type UserLiveMvDeckCustomByID interface{} + +// SetThemeRes ... +type SetThemeRes interface{} + +// UserCommunicationMemberDetailBadgeByID ... +type UserCommunicationMemberDetailBadgeByID struct { + MemberMasterID int `json:"member_master_id"` + IsStoryMemberBadge bool `json:"is_story_member_badge"` + IsStorySideBadge bool `json:"is_story_side_badge"` + IsVoiceBadge bool `json:"is_voice_badge"` + IsThemeBadge bool `json:"is_theme_badge"` + IsCardBadge bool `json:"is_card_badge"` + IsMusicBadge bool `json:"is_music_badge"` +} diff --git a/model/live.go b/model/live.go index 7d297b7..45369f5 100644 --- a/model/live.go +++ b/model/live.go @@ -1,6 +1,5 @@ package model -/* ==== SIF START ==== */ // GameOverResp ... type GameOverResp struct { ResponseData []interface{} `json:"response_data"` @@ -654,67 +653,3 @@ type LiveIconInfoResp struct { CommandNum bool `json:"commandNum"` TimeStamp int64 `json:"timeStamp"` } - -/* ==== SIF END ==== */ - -/* ==== AS START ==== */ -// LiveSaveDeckReq ... -type LiveSaveDeckReq struct { - LiveMasterID int `json:"live_master_id"` - LiveMvDeckType int `json:"live_mv_deck_type"` - MemberMasterIDByPos []int `json:"member_master_id_by_pos"` - SuitMasterIDByPos []int `json:"suit_master_id_by_pos"` - ViewStatusByPos []int `json:"view_status_by_pos"` -} - -// LiveSaveDeckResp ... -type LiveSaveDeckResp struct { - UserModel UserModel `json:"user_model"` -} - -// UserMemberInfo ... -type UserMemberInfo struct { - MemberMasterID int `json:"member_master_id"` - CustomBackgroundMasterID int `json:"custom_background_master_id"` - SuitMasterID int `json:"suit_master_id"` - LovePoint int `json:"love_point"` - LovePointLimit int `json:"love_point_limit"` - LoveLevel int `json:"love_level"` - ViewStatus int `json:"view_status"` - IsNew bool `json:"is_new"` -} - -// UserMemberByMemberID ... -type UserMemberByMemberID interface{} - -// UserLiveMvDeckInfo ... -type UserLiveMvDeckInfo struct { - LiveMasterID interface{} `json:"live_master_id"` - MemberMasterID1 interface{} `json:"member_master_id_1"` - MemberMasterID2 interface{} `json:"member_master_id_2"` - MemberMasterID3 interface{} `json:"member_master_id_3"` - MemberMasterID4 interface{} `json:"member_master_id_4"` - MemberMasterID5 interface{} `json:"member_master_id_5"` - MemberMasterID6 interface{} `json:"member_master_id_6"` - MemberMasterID7 interface{} `json:"member_master_id_7"` - MemberMasterID8 interface{} `json:"member_master_id_8"` - MemberMasterID9 interface{} `json:"member_master_id_9"` - MemberMasterID10 interface{} `json:"member_master_id_10"` - MemberMasterID11 interface{} `json:"member_master_id_11"` - MemberMasterID12 interface{} `json:"member_master_id_12"` - SuitMasterID1 interface{} `json:"suit_master_id_1"` - SuitMasterID2 interface{} `json:"suit_master_id_2"` - SuitMasterID3 interface{} `json:"suit_master_id_3"` - SuitMasterID4 interface{} `json:"suit_master_id_4"` - SuitMasterID5 interface{} `json:"suit_master_id_5"` - SuitMasterID6 interface{} `json:"suit_master_id_6"` - SuitMasterID7 interface{} `json:"suit_master_id_7"` - SuitMasterID8 interface{} `json:"suit_master_id_8"` - SuitMasterID9 interface{} `json:"suit_master_id_9"` - SuitMasterID10 interface{} `json:"suit_master_id_10"` - SuitMasterID11 interface{} `json:"suit_master_id_11"` - SuitMasterID12 interface{} `json:"suit_master_id_12"` -} - -// UserLiveMvDeckCustomByID ... -type UserLiveMvDeckCustomByID interface{} diff --git a/model/login.go b/model/login.go index ce84975..41b7a25 100644 --- a/model/login.go +++ b/model/login.go @@ -1,6 +1,5 @@ package model -/* ==== SIF START ==== */ // LoginRes ... type LoginRes struct { AuthorizeToken string `json:"authorize_token"` @@ -18,476 +17,3 @@ type LoginResp struct { ReleaseInfo []interface{} `json:"release_info"` StatusCode int `json:"status_code"` } - -/* ==== SIF END ==== */ - -/* ==== AS START ==== */ -// AsLoginRes ... -type AsLoginRes struct { - SessionKey string `json:"session_key"` - UserModel UserModel `json:"user_model"` - IsPlatformServiceLinked bool `json:"is_platform_service_linked"` - LastTimestamp int64 `json:"last_timestamp"` - Cautions []interface{} `json:"cautions"` - ShowHomeCaution bool `json:"show_home_caution"` - LiveResume interface{} `json:"live_resume"` - FromEea bool `json:"from_eea"` - GdprConsentedInfo GdprConsentedInfo `json:"gdpr_consented_info"` - UserID int `json:"user_id"` - IsUnderAge int `json:"is_under_age"` - AreaID int `json:"area_id"` - AuthCount int `json:"auth_count"` - MemberLovePanels []MemberLovePanels `json:"member_love_panels"` - CheckMaintenance bool `json:"check_maintenance"` - ReproInfo ReproInfo `json:"repro_info"` -} - -// UserModel ... -type UserModel struct { - UserStatus AsUserStatus `json:"user_status"` - UserMemberByMemberID interface{} `json:"user_member_by_member_id"` - UserCardByCardID []interface{} `json:"user_card_by_card_id"` - UserSuitBySuitID []interface{} `json:"user_suit_by_suit_id"` - UserLiveDeckByID []interface{} `json:"user_live_deck_by_id"` - UserLivePartyByID []interface{} `json:"user_live_party_by_id"` - UserLessonDeckByID []interface{} `json:"user_lesson_deck_by_id"` - UserLiveMvDeckByID []interface{} `json:"user_live_mv_deck_by_id"` - UserLiveMvDeckCustomByID interface{} `json:"user_live_mv_deck_custom_by_id"` - UserLiveDifficultyByDifficultyID []interface{} `json:"user_live_difficulty_by_difficulty_id"` - UserStoryMainByStoryMainID []interface{} `json:"user_story_main_by_story_main_id"` - UserStoryMainSelectedByStoryMainCellID []interface{} `json:"user_story_main_selected_by_story_main_cell_id"` - UserVoiceByVoiceID []interface{} `json:"user_voice_by_voice_id"` - UserEmblemByEmblemID []interface{} `json:"user_emblem_by_emblem_id"` - UserGachaTicketByTicketID []interface{} `json:"user_gacha_ticket_by_ticket_id"` - UserGachaPointByPointID []interface{} `json:"user_gacha_point_by_point_id"` - UserLessonEnhancingItemByItemID []interface{} `json:"user_lesson_enhancing_item_by_item_id"` - UserTrainingMaterialByItemID []interface{} `json:"user_training_material_by_item_id"` - UserGradeUpItemByItemID []interface{} `json:"user_grade_up_item_by_item_id"` - UserCustomBackgroundByID []interface{} `json:"user_custom_background_by_id"` - UserStorySideByID []interface{} `json:"user_story_side_by_id"` - UserStoryMemberByID []interface{} `json:"user_story_member_by_id"` - UserCommunicationMemberDetailBadgeByID []interface{} `json:"user_communication_member_detail_badge_by_id"` - UserStoryEventHistoryByID []interface{} `json:"user_story_event_history_by_id"` - UserRecoveryLpByID []interface{} `json:"user_recovery_lp_by_id"` - UserRecoveryApByID []interface{} `json:"user_recovery_ap_by_id"` - UserMissionByMissionID []interface{} `json:"user_mission_by_mission_id"` - UserDailyMissionByMissionID []interface{} `json:"user_daily_mission_by_mission_id"` - UserWeeklyMissionByMissionID []interface{} `json:"user_weekly_mission_by_mission_id"` - UserInfoTriggerBasicByTriggerID []interface{} `json:"user_info_trigger_basic_by_trigger_id"` - UserInfoTriggerCardGradeUpByTriggerID []interface{} `json:"user_info_trigger_card_grade_up_by_trigger_id"` - UserInfoTriggerMemberGuildSupportItemExpiredByTriggerID []interface{} `json:"user_info_trigger_member_guild_support_item_expired_by_trigger_id"` - UserInfoTriggerMemberLoveLevelUpByTriggerID []interface{} `json:"user_info_trigger_member_love_level_up_by_trigger_id"` - UserAccessoryByUserAccessoryID []interface{} `json:"user_accessory_by_user_accessory_id"` - UserAccessoryLevelUpItemByID []interface{} `json:"user_accessory_level_up_item_by_id"` - UserAccessoryRarityUpItemByID []interface{} `json:"user_accessory_rarity_up_item_by_id"` - UserUnlockScenesByEnum []interface{} `json:"user_unlock_scenes_by_enum"` - UserSceneTipsByEnum []interface{} `json:"user_scene_tips_by_enum"` - UserRuleDescriptionByID []interface{} `json:"user_rule_description_by_id"` - UserExchangeEventPointByID []interface{} `json:"user_exchange_event_point_by_id"` - UserSchoolIdolFestivalIDRewardMissionByID []interface{} `json:"user_school_idol_festival_id_reward_mission_by_id"` - UserGpsPresentReceivedByID []interface{} `json:"user_gps_present_received_by_id"` - UserEventMarathonByEventMasterID []interface{} `json:"user_event_marathon_by_event_master_id"` - UserEventMiningByEventMasterID []interface{} `json:"user_event_mining_by_event_master_id"` - UserEventCoopByEventMasterID []interface{} `json:"user_event_coop_by_event_master_id"` - UserLiveSkipTicketByID []interface{} `json:"user_live_skip_ticket_by_id"` - UserStoryEventUnlockItemByID []interface{} `json:"user_story_event_unlock_item_by_id"` - UserEventMarathonBoosterByID []interface{} `json:"user_event_marathon_booster_by_id"` - UserReferenceBookByID []interface{} `json:"user_reference_book_by_id"` - UserReviewRequestProcessFlowByID []interface{} `json:"user_review_request_process_flow_by_id"` - UserRankExpByID []interface{} `json:"user_rank_exp_by_id"` - UserShareByID []interface{} `json:"user_share_by_id"` - UserTowerByTowerID []interface{} `json:"user_tower_by_tower_id"` - UserRecoveryTowerCardUsedCountItemByRecoveryTowerCardUsedCountItemMasterID []interface{} `json:"user_recovery_tower_card_used_count_item_by_recovery_tower_card_used_count_item_master_id"` - UserStoryLinkageByID []interface{} `json:"user_story_linkage_by_id"` - UserSubscriptionStatusByID []interface{} `json:"user_subscription_status_by_id"` - UserStoryMainPartDigestMovieByID []interface{} `json:"user_story_main_part_digest_movie_by_id"` - UserMemberGuildByID []interface{} `json:"user_member_guild_by_id"` - UserMemberGuildSupportItemByID []interface{} `json:"user_member_guild_support_item_by_id"` - UserDailyTheaterByDailyTheaterID []interface{} `json:"user_daily_theater_by_daily_theater_id"` - UserPlayListByID []interface{} `json:"user_play_list_by_id"` -} - -// Name ... -type Name struct { - DotUnderText string `json:"dot_under_text"` -} - -// Nickname ... -type Nickname struct { - DotUnderText string `json:"dot_under_text"` -} - -// Message ... -type Message struct { - DotUnderText string `json:"dot_under_text"` -} - -// AsUserStatus ... -type AsUserStatus struct { - Name Name `json:"name"` - Nickname Nickname `json:"nickname"` - LastLoginAt int64 `json:"last_login_at"` - Rank int `json:"rank"` - Exp int `json:"exp"` - Message Message `json:"message"` - RecommendCardMasterID int `json:"recommend_card_master_id"` - MaxFriendNum int `json:"max_friend_num"` - LivePointFullAt int `json:"live_point_full_at"` - LivePointBroken int `json:"live_point_broken"` - LivePointSubscriptionRecoveryDailyCount int `json:"live_point_subscription_recovery_daily_count"` - LivePointSubscriptionRecoveryDailyResetAt int `json:"live_point_subscription_recovery_daily_reset_at"` - ActivityPointCount int `json:"activity_point_count"` - ActivityPointResetAt int `json:"activity_point_reset_at"` - ActivityPointPaymentRecoveryDailyCount int `json:"activity_point_payment_recovery_daily_count"` - ActivityPointPaymentRecoveryDailyResetAt int `json:"activity_point_payment_recovery_daily_reset_at"` - GameMoney int `json:"game_money"` - CardExp int `json:"card_exp"` - FreeSnsCoin int `json:"free_sns_coin"` - AppleSnsCoin int `json:"apple_sns_coin"` - GoogleSnsCoin int `json:"google_sns_coin"` - Cash int `json:"cash"` - SubscriptionCoin int `json:"subscription_coin"` - BirthDate interface{} `json:"birth_date"` - BirthMonth int `json:"birth_month"` - BirthDay int `json:"birth_day"` - LatestLiveDeckID int `json:"latest_live_deck_id"` - MainLessonDeckID int `json:"main_lesson_deck_id"` - FavoriteMemberID int `json:"favorite_member_id"` - LastLiveDifficultyID int `json:"last_live_difficulty_id"` - LpMagnification int `json:"lp_magnification"` - EmblemID int `json:"emblem_id"` - DeviceToken string `json:"device_token"` - TutorialPhase int `json:"tutorial_phase"` - TutorialEndAt int `json:"tutorial_end_at"` - LoginDays int `json:"login_days"` - NaviTapCount int `json:"navi_tap_count"` - NaviTapRecoverAt int `json:"navi_tap_recover_at"` - IsAutoMode bool `json:"is_auto_mode"` - MaxScoreLiveDifficultyMasterID int `json:"max_score_live_difficulty_master_id"` - LiveMaxScore int `json:"live_max_score"` - MaxComboLiveDifficultyMasterID int `json:"max_combo_live_difficulty_master_id"` - LiveMaxCombo int `json:"live_max_combo"` - LessonResumeStatus int `json:"lesson_resume_status"` - AccessoryBoxAdditional int `json:"accessory_box_additional"` - TermsOfUseVersion int `json:"terms_of_use_version"` - BootstrapSifidCheckAt int `json:"bootstrap_sifid_check_at"` - GdprVersion int `json:"gdpr_version"` - MemberGuildMemberMasterID int `json:"member_guild_member_master_id"` - MemberGuildLastUpdatedAt int `json:"member_guild_last_updated_at"` -} - -// GdprConsentedInfo ... -type GdprConsentedInfo struct { - HasConsentedAdPurposeOfUse bool `json:"has_consented_ad_purpose_of_use"` - HasConsentedCrashReport bool `json:"has_consented_crash_report"` -} - -// MemberLovePanels ... -type MemberLovePanels struct { - MemberID int `json:"member_id"` - MemberLovePanelCellIds []int `json:"member_love_panel_cell_ids"` -} - -// ReproInfo ... -type ReproInfo struct { - GroupNo int `json:"group_no"` -} - -// AsCardInfo ... -type AsCardInfo struct { - CardMasterID int `json:"card_master_id"` - Level int `json:"level"` - Exp int `json:"exp"` - LovePoint int `json:"love_point"` - IsFavorite bool `json:"is_favorite"` - IsAwakening bool `json:"is_awakening"` - IsAwakeningImage bool `json:"is_awakening_image"` - IsAllTrainingActivated bool `json:"is_all_training_activated"` - TrainingActivatedCellCount int `json:"training_activated_cell_count"` - MaxFreePassiveSkill int `json:"max_free_passive_skill"` - Grade int `json:"grade"` - TrainingLife int `json:"training_life"` - TrainingAttack int `json:"training_attack"` - TrainingDexterity int `json:"training_dexterity"` - ActiveSkillLevel int `json:"active_skill_level"` - PassiveSkillALevel int `json:"passive_skill_a_level"` - PassiveSkillBLevel int `json:"passive_skill_b_level"` - PassiveSkillCLevel int `json:"passive_skill_c_level"` - AdditionalPassiveSkill1ID int `json:"additional_passive_skill_1_id"` - AdditionalPassiveSkill2ID int `json:"additional_passive_skill_2_id"` - AdditionalPassiveSkill3ID int `json:"additional_passive_skill_3_id"` - AdditionalPassiveSkill4ID int `json:"additional_passive_skill_4_id"` - AcquiredAt int64 `json:"acquired_at"` - IsNew bool `json:"is_new"` -} - -// AsSuitInfo ... -type AsSuitInfo struct { - SuitMasterID int `json:"suit_master_id"` - IsNew bool `json:"is_new"` -} - -// AsEmblemInfo ... -type AsEmblemInfo struct { - EmblemMID int `json:"emblem_m_id"` - IsNew bool `json:"is_new"` - EmblemParam interface{} `json:"emblem_param"` - AcquiredAt int64 `json:"acquired_at"` -} - -// AsEmblemId ... -type AsEmblemId struct { - EmblemMasterID int `json:"emblem_master_id"` - IsNew bool `json:"is_new"` -} - -// AsLiveDifficultyInfo ... -type AsLiveDifficultyInfo struct { - LiveDifficultyID int `json:"live_difficulty_id"` - MaxScore int `json:"max_score"` - MaxCombo int `json:"max_combo"` - PlayCount int `json:"play_count"` - ClearCount int `json:"clear_count"` - CancelCount int `json:"cancel_count"` - NotClearedCount int `json:"not_cleared_count"` - IsFullCombo bool `json:"is_full_combo"` - ClearedDifficultyAchievement1 interface{} `json:"cleared_difficulty_achievement_1"` - ClearedDifficultyAchievement2 interface{} `json:"cleared_difficulty_achievement_2"` - ClearedDifficultyAchievement3 interface{} `json:"cleared_difficulty_achievement_3"` - EnableAutoplay bool `json:"enable_autoplay"` - IsAutoplay bool `json:"is_autoplay"` - IsNew bool `json:"is_new"` -} - -// AsMainStoryInfo ... -type AsMainStoryInfo struct { - StoryMainMasterID int `json:"story_main_master_id"` -} - -// AsNaviVoiceInfo ... -type AsNaviVoiceInfo struct { - NaviVoiceMasterID int `json:"navi_voice_master_id"` - IsNew bool `json:"is_new"` -} - -// AsCustomBackgroundInfo ... -type AsCustomBackgroundInfo struct { - CustomBackgroundMasterID int `json:"custom_background_master_id"` - IsNew bool `json:"is_new"` -} - -// AsStorySideInfo ... -type AsStorySideInfo struct { - StorySideMasterID int `json:"story_side_master_id"` - IsNew bool `json:"is_new"` - AcquiredAt int64 `json:"acquired_at"` -} - -// AsStoryMemberInfo ... -type AsStoryMemberInfo struct { - StoryMemberMasterID int `json:"story_member_master_id"` - IsNew bool `json:"is_new"` - AcquiredAt int64 `json:"acquired_at"` -} - -// AsStoryEventInfo ... -type AsStoryEventInfo struct { - StoryEventID int `json:"story_event_id"` -} - -// AsMissionRes ... -type AsMissionRes struct { - ID int `xorm:"id"` - Count int `xorm:"mission_clear_condition_count"` -} - -// AsFreeMissionInfo ... -type AsFreeMissionInfo struct { - MissionMID int `json:"mission_m_id"` - IsNew bool `json:"is_new"` - MissionCount int `json:"mission_count"` - IsCleared bool `json:"is_cleared"` - IsReceivedReward bool `json:"is_received_reward"` - NewExpiredAt int64 `json:"new_expired_at"` -} - -// AsDailyMissionInfo ... -type AsDailyMissionInfo struct { - MissionMID int `json:"mission_m_id"` - IsNew bool `json:"is_new"` - MissionStartCount int `json:"mission_start_count"` - MissionCount int `json:"mission_count"` - IsCleared bool `json:"is_cleared"` - IsReceivedReward bool `json:"is_received_reward"` - ClearedExpiredAt int64 `json:"cleared_expired_at"` -} - -// AsWeeklyMissionInfo ... -type AsWeeklyMissionInfo struct { - MissionMID int `json:"mission_m_id"` - IsNew bool `json:"is_new"` - MissionStartCount int `json:"mission_start_count"` - MissionCount int `json:"mission_count"` - IsCleared bool `json:"is_cleared"` - IsReceivedReward bool `json:"is_received_reward"` - ClearedExpiredAt int64 `json:"cleared_expired_at"` - NewExpiredAt int64 `json:"new_expired_at"` -} - -// AsMemberLovePanelInfo ... -type AsMemberLovePanelInfo struct { - MemberID int `json:"member_id"` - MemberLovePanelCellIds []int `json:"member_love_panel_cell_ids"` -} - -// AsCardRes ... -type AsCardRes struct { - ID int `xorm:"id"` - CardRarityType int `xorm:"card_rarity_type"` - MaxPassiveSkillSlot int `xorm:"max_passive_skill_slot"` -} - -// AsSaveDeckReq ... -type AsSaveDeckReq struct { - DeckID int `json:"deck_id"` - CardWithSuit []int `json:"card_with_suit"` - SquadDict []interface{} `json:"squad_dict"` -} - -// AsDeckSquadDict ... -type AsDeckSquadDict struct { - CardMasterIds []int `json:"card_master_ids"` - UserAccessoryIds []int64 `json:"user_accessory_ids"` -} - -// AsDeckInfo ... -type AsDeckInfo struct { - UserLiveDeckID int `json:"user_live_deck_id"` - Name AsDeckName `json:"name"` - CardMasterID1 int `json:"card_master_id_1"` - CardMasterID2 int `json:"card_master_id_2"` - CardMasterID3 int `json:"card_master_id_3"` - CardMasterID4 int `json:"card_master_id_4"` - CardMasterID5 int `json:"card_master_id_5"` - CardMasterID6 int `json:"card_master_id_6"` - CardMasterID7 int `json:"card_master_id_7"` - CardMasterID8 int `json:"card_master_id_8"` - CardMasterID9 int `json:"card_master_id_9"` - SuitMasterID1 int `json:"suit_master_id_1"` - SuitMasterID2 int `json:"suit_master_id_2"` - SuitMasterID3 int `json:"suit_master_id_3"` - SuitMasterID4 int `json:"suit_master_id_4"` - SuitMasterID5 int `json:"suit_master_id_5"` - SuitMasterID6 int `json:"suit_master_id_6"` - SuitMasterID7 int `json:"suit_master_id_7"` - SuitMasterID8 int `json:"suit_master_id_8"` - SuitMasterID9 int `json:"suit_master_id_9"` -} - -// AsDeckName ... -type AsDeckName struct { - DotUnderText string `json:"dot_under_text"` -} - -// AsPartyInfo ... -type AsPartyInfo struct { - PartyID int `json:"party_id"` - UserLiveDeckID int `json:"user_live_deck_id"` - Name AsPartyName `json:"name"` - IconMasterID int `json:"icon_master_id"` - CardMasterID1 int `json:"card_master_id_1"` - CardMasterID2 int `json:"card_master_id_2"` - CardMasterID3 int `json:"card_master_id_3"` - UserAccessoryID1 int64 `json:"user_accessory_id_1"` - UserAccessoryID2 int64 `json:"user_accessory_id_2"` - UserAccessoryID3 int64 `json:"user_accessory_id_3"` -} - -// AsPartyName ... -type AsPartyName struct { - DotUnderText string `json:"dot_under_text"` -} - -// AsLiveStartReq ... -type AsLiveStartReq struct { - LiveDifficultyID int `json:"live_difficulty_id"` - DeckID int `json:"deck_id"` - PartnerUserID int `json:"partner_user_id"` - PartnerCardMasterID int `json:"partner_card_master_id"` - LpMagnification int `json:"lp_magnification"` - IsAutoPlay bool `json:"is_auto_play"` - IsReferenceBook bool `json:"is_reference_book"` -} - -// AsLivePartnerInfo ... -type AsLivePartnerInfo struct { - UserID int `json:"user_id"` - Name PartnerName `json:"name"` - Rank int `json:"rank"` - LastPlayedAt int64 `json:"last_played_at"` - RecommendCardMasterID int `json:"recommend_card_master_id"` - RecommendCardLevel int `json:"recommend_card_level"` - IsRecommendCardImageAwaken bool `json:"is_recommend_card_image_awaken"` - IsRecommendCardAllTrainingActivated bool `json:"is_recommend_card_all_training_activated"` - EmblemID int `json:"emblem_id"` - IsNew bool `json:"is_new"` - IntroductionMessage IntroductionMessage `json:"introduction_message"` - FriendApprovedAt interface{} `json:"friend_approved_at"` - RequestStatus int `json:"request_status"` - IsRequestPending bool `json:"is_request_pending"` -} - -// PartnerName ... -type PartnerName struct { - DotUnderText string `json:"dot_under_text"` -} - -// IntroductionMessage ... -type IntroductionMessage struct { - DotUnderText string `json:"dot_under_text"` -} - -// AsLiveResultAchievementStatus ... -type AsLiveResultAchievementStatus struct { - ClearCount int64 `json:"clear_count"` - GotVoltage int64 `json:"got_voltage"` - RemainingStamina int64 `json:"remaining_stamina"` -} - -// AsMvpInfo ... -type AsMvpInfo struct { - CardMasterID int64 `json:"card_master_id"` - GetVoltage int64 `json:"get_voltage"` - SkillTriggeredCount int64 `json:"skill_triggered_count"` - AppealCount int64 `json:"appeal_count"` -} - -// AsUserCardReq ... -type AsUserCardReq struct { - UserID int64 `json:"user_id"` - CardMasterID int64 `json:"card_master_id"` -} - -// AsCardAwakeningReq ... -type AsCardAwakeningReq struct { - CardMasterID int `json:"card_master_id"` - IsAwakeningImage bool `json:"is_awakening_image"` -} - -// AsReq ... -type AsReq interface{} - -// AsResp ... -type AsResp interface{} - -// PackUrlReqBody ... -type PackUrlReqBody struct { - PackNames []string `json:"pack_names"` -} - -// PackUrlRespBody ... -type PackUrlRespBody struct { - UrlList []string `json:"url_list"` -} - -/* ==== AS END ==== */ diff --git a/router/router.go b/router/router.go index 29db1e7..f0edddd 100644 --- a/router/router.go +++ b/router/router.go @@ -1,40 +1,18 @@ package router import ( - "encoding/base64" - "encoding/json" - "fmt" - "honoka-chan/config" - "honoka-chan/database" - "honoka-chan/encrypt" "honoka-chan/handler" "honoka-chan/middleware" - "honoka-chan/model" - "honoka-chan/utils" "net/http" "os" "path/filepath" - "strconv" "strings" - "time" "github.com/gin-contrib/sessions" "github.com/gin-contrib/sessions/cookie" "github.com/gin-gonic/gin" - "github.com/tidwall/gjson" - "xorm.io/xorm" ) -var ( - sessionKey = "12345678123456781234567812345678" - - mEng *xorm.Engine -) - -func init() { - mEng = config.MainEng -} - func SifRouter(r *gin.Engine) { // Static r.Static("/static", "static") @@ -166,933 +144,38 @@ func AsRouter(r *gin.Engine) { r.Static("/llas-dev/static", "static/llas-dev/static") s := r.Group("ep3071").Use(middleware.CommonAs) { - s.POST("/login/login", func(ctx *gin.Context) { - reqBody := ctx.GetString("reqBody") - - var mask string - req := gjson.Parse(reqBody) - req.ForEach(func(key, value gjson.Result) bool { - if value.Get("mask").String() != "" { - mask = value.Get("mask").String() - return false - } - return true - }) - // fmt.Println("Request data:", req.String()) - // fmt.Println("Mask:", mask) - - mask64, err := base64.StdEncoding.DecodeString(mask) - if err != nil { - panic(err) - } - randomBytes := encrypt.RSA_DecryptOAEP(mask64, "privatekey.pem") - // fmt.Println("Random Bytes:", randomBytes) - - newKey := utils.SliceXor(randomBytes, []byte(sessionKey)) - newKey64 := base64.StdEncoding.EncodeToString(newKey) - - loginBody := strings.ReplaceAll(utils.ReadAllText("assets/as/login.json"), "SESSION_KEY", newKey64) - resp := SignResp(ctx.GetString("ep"), loginBody, config.StartUpKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/bootstrap/fetchBootstrap", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchBootstrap.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/billing/fetchBillingHistory", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchBillingHistory.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/notice/fetchNotice", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchNotice.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/asset/getPackUrl", func(ctx *gin.Context) { - reqBody := ctx.GetString("reqBody") - - var req []model.AsReq - err := json.Unmarshal([]byte(reqBody), &req) - if err != nil { - panic(err) - } - // fmt.Println(req) - - packBody, ok := req[0].(map[string]interface{}) - if !ok { - panic("Assertion failed!") - } - // fmt.Println(packBody) - - packNames, ok := packBody["pack_names"].([]interface{}) - if !ok { - panic("Assertion failed!") - } - - // 生成更新包 map - var packageList []string - var urlList []string - - err = json.Unmarshal([]byte(utils.ReadAllText("assets/as/packages.json")), &packageList) - if err != nil { - panic(err) - } - - err = json.Unmarshal([]byte(utils.ReadAllText("assets/as/urls.json")), &urlList) - if err != nil { - panic(err) - } - - if len(packageList) != len(urlList) { - fmt.Println("File size not match!") - return - } - - packageUrls := map[string]string{} - for k, p := range packageList { - packageUrls[p] = urlList[k] - } - - // Response - var respUrls []string - for _, pack := range packNames { - packName, ok := pack.(string) - if !ok { - panic("Assertion failed!") - } - // fmt.Println(packageUrls[packName]) - respUrls = append(respUrls, packageUrls[packName]) - } - - urlResp := model.PackUrlRespBody{ - UrlList: respUrls, - } - - var resp []model.AsResp - resp = append(resp, time.Now().UnixMilli()) // 时间戳 - resp = append(resp, config.MasterVersion) // 版本号 - resp = append(resp, 0) // 固定值 - resp = append(resp, urlResp) // 数据体 - - mm, err := json.Marshal(resp) - if err != nil { - panic(err) - } - // fmt.Println(string(mm)) - - signBody := mm[1 : len(mm)-1] - // fmt.Println(string(signBody)) - - ep := strings.ReplaceAll(ctx.Request.URL.String(), "/ep3071", "") - // fmt.Println(ep) - - sign := encrypt.HMAC_SHA1_Encrypt([]byte(ep+" "+string(signBody)), []byte(sessionKey)) - - resp = append(resp, sign) - mm, err = json.Marshal(resp) - if err != nil { - panic(err) - } - // fmt.Println(string(mm)) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, string(mm)) - }) - s.POST("/card/updateCardNewFlag", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/updateCardNewFlag.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/bootstrap/getClearedPlatformAchievement", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/getClearedPlatformAchievement.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/live/fetchLiveMusicSelect", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchLiveMusicSelect.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/liveMv/start", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/liveMvStart.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/liveMv/saveDeck", func(ctx *gin.Context) { - reqBody := ctx.GetString("reqBody") - - var req []model.AsReq - err := json.Unmarshal([]byte(reqBody), &req) - if err != nil { - panic(err) - } - - body, ok := req[0].(map[string]interface{}) - if !ok { - panic("Assertion failed!") - } - - reqB, err := json.Marshal(body) - if err != nil { - panic(err) - } - // fmt.Println(string(reqB)) - - saveReq := model.LiveSaveDeckReq{} - err = json.Unmarshal(reqB, &saveReq) - if err != nil { - panic(err) - } - // fmt.Println(saveReq) - - userLiveMvDeckInfo := model.UserLiveMvDeckInfo{ - LiveMasterID: saveReq.LiveMasterID, - } - - memberIds := map[int]int{} - for k, v := range saveReq.MemberMasterIDByPos { - if k%2 == 0 { - memberId := saveReq.MemberMasterIDByPos[k+1] - memberIds[v] = memberId - - switch v { - case 1: - userLiveMvDeckInfo.MemberMasterID1 = memberId - case 2: - userLiveMvDeckInfo.MemberMasterID2 = memberId - case 3: - userLiveMvDeckInfo.MemberMasterID3 = memberId - case 4: - userLiveMvDeckInfo.MemberMasterID4 = memberId - case 5: - userLiveMvDeckInfo.MemberMasterID5 = memberId - case 6: - userLiveMvDeckInfo.MemberMasterID6 = memberId - case 7: - userLiveMvDeckInfo.MemberMasterID7 = memberId - case 8: - userLiveMvDeckInfo.MemberMasterID8 = memberId - case 9: - userLiveMvDeckInfo.MemberMasterID9 = memberId - case 10: - userLiveMvDeckInfo.MemberMasterID10 = memberId - case 11: - userLiveMvDeckInfo.MemberMasterID11 = memberId - case 12: - userLiveMvDeckInfo.MemberMasterID12 = memberId - } - } - } - // fmt.Println(memberIds) - - suitIds := map[int]int{} - for k, v := range saveReq.SuitMasterIDByPos { - if k%2 == 0 { - suitId := saveReq.SuitMasterIDByPos[k+1] - suitIds[v] = suitId - - switch v { - case 1: - userLiveMvDeckInfo.SuitMasterID1 = suitId - case 2: - userLiveMvDeckInfo.SuitMasterID2 = suitId - case 3: - userLiveMvDeckInfo.SuitMasterID3 = suitId - case 4: - userLiveMvDeckInfo.SuitMasterID4 = suitId - case 5: - userLiveMvDeckInfo.SuitMasterID5 = suitId - case 6: - userLiveMvDeckInfo.SuitMasterID6 = suitId - case 7: - userLiveMvDeckInfo.SuitMasterID7 = suitId - case 8: - userLiveMvDeckInfo.SuitMasterID8 = suitId - case 9: - userLiveMvDeckInfo.SuitMasterID9 = suitId - case 10: - userLiveMvDeckInfo.SuitMasterID10 = suitId - case 11: - userLiveMvDeckInfo.SuitMasterID11 = suitId - case 12: - userLiveMvDeckInfo.SuitMasterID12 = suitId - } - } - } - // fmt.Println(suitIds) - - var userLiveMvDeckCustomByID []model.UserLiveMvDeckCustomByID - userLiveMvDeckCustomByID = append(userLiveMvDeckCustomByID, saveReq.LiveMasterID) - userLiveMvDeckCustomByID = append(userLiveMvDeckCustomByID, userLiveMvDeckInfo) - // fmt.Println(userLiveMvDeckCustomByID) - - viewStatusIds := map[int]int{} - for k, v := range saveReq.ViewStatusByPos { - if k%2 == 0 { - viewStatusId := saveReq.ViewStatusByPos[k+1] - viewStatusIds[v] = viewStatusId - } - } - // fmt.Println(viewStatusIds) - - var userMemberByMemberID []model.UserMemberByMemberID - for k, v := range memberIds { - userMemberByMemberID = append(userMemberByMemberID, v) - userMemberByMemberID = append(userMemberByMemberID, model.UserMemberInfo{ - MemberMasterID: v, - CustomBackgroundMasterID: 103506600, - SuitMasterID: suitIds[k], - LovePoint: 0, - LovePointLimit: 999999, - LoveLevel: 1, - ViewStatus: viewStatusIds[k], - IsNew: true, - }) - } - // fmt.Println(userMemberByMemberID) - - saveResp := model.LiveSaveDeckResp{ - UserModel: model.UserModel{ - UserStatus: CommonUserStatus(), - UserMemberByMemberID: userMemberByMemberID, - UserCardByCardID: []interface{}{}, - UserSuitBySuitID: []interface{}{}, - UserLiveDeckByID: []interface{}{}, - UserLivePartyByID: []interface{}{}, - UserLessonDeckByID: []interface{}{}, - UserLiveMvDeckByID: []interface{}{}, - UserLiveMvDeckCustomByID: userLiveMvDeckCustomByID, - UserLiveDifficultyByDifficultyID: []interface{}{}, - UserStoryMainByStoryMainID: []interface{}{}, - UserStoryMainSelectedByStoryMainCellID: []interface{}{}, - UserVoiceByVoiceID: []interface{}{}, - UserEmblemByEmblemID: []interface{}{}, - UserGachaTicketByTicketID: []interface{}{}, - UserGachaPointByPointID: []interface{}{}, - UserLessonEnhancingItemByItemID: []interface{}{}, - UserTrainingMaterialByItemID: []interface{}{}, - UserGradeUpItemByItemID: []interface{}{}, - UserCustomBackgroundByID: []interface{}{}, - UserStorySideByID: []interface{}{}, - UserStoryMemberByID: []interface{}{}, - UserCommunicationMemberDetailBadgeByID: []interface{}{}, - UserStoryEventHistoryByID: []interface{}{}, - UserRecoveryLpByID: []interface{}{}, - UserRecoveryApByID: []interface{}{}, - UserMissionByMissionID: []interface{}{}, - UserDailyMissionByMissionID: []interface{}{}, - UserWeeklyMissionByMissionID: []interface{}{}, - UserInfoTriggerBasicByTriggerID: []interface{}{}, - UserInfoTriggerCardGradeUpByTriggerID: []interface{}{}, - UserInfoTriggerMemberGuildSupportItemExpiredByTriggerID: []interface{}{}, - UserInfoTriggerMemberLoveLevelUpByTriggerID: []interface{}{}, - UserAccessoryByUserAccessoryID: []interface{}{}, - UserAccessoryLevelUpItemByID: []interface{}{}, - UserAccessoryRarityUpItemByID: []interface{}{}, - UserUnlockScenesByEnum: []interface{}{}, - UserSceneTipsByEnum: []interface{}{}, - UserRuleDescriptionByID: []interface{}{}, - UserExchangeEventPointByID: []interface{}{}, - UserSchoolIdolFestivalIDRewardMissionByID: []interface{}{}, - UserGpsPresentReceivedByID: []interface{}{}, - UserEventMarathonByEventMasterID: []interface{}{}, - UserEventMiningByEventMasterID: []interface{}{}, - UserEventCoopByEventMasterID: []interface{}{}, - UserLiveSkipTicketByID: []interface{}{}, - UserStoryEventUnlockItemByID: []interface{}{}, - UserEventMarathonBoosterByID: []interface{}{}, - UserReferenceBookByID: []interface{}{}, - UserReviewRequestProcessFlowByID: []interface{}{}, - UserRankExpByID: []interface{}{}, - UserShareByID: []interface{}{}, - UserTowerByTowerID: []interface{}{}, - UserRecoveryTowerCardUsedCountItemByRecoveryTowerCardUsedCountItemMasterID: []interface{}{}, - UserStoryLinkageByID: []interface{}{}, - UserSubscriptionStatusByID: []interface{}{}, - UserStoryMainPartDigestMovieByID: []interface{}{}, - UserMemberGuildByID: []interface{}{}, - UserMemberGuildSupportItemByID: []interface{}{}, - UserDailyTheaterByDailyTheaterID: []interface{}{}, - UserPlayListByID: []interface{}{}, - }, - } - respB, err := json.Marshal(saveResp) - if err != nil { - panic(err) - } - // fmt.Println(string(b)) - - resp := SignResp(ctx.GetString("ep"), string(respB), sessionKey) - // fmt.Println(resp) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/communicationMember/fetchCommunicationMemberDetail", func(ctx *gin.Context) { - reqBody := ctx.GetString("reqBody") - var memberId string - gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { - if value.Get("member_id").String() != "" { - memberId = value.Get("member_id").String() - return false - } - return true - }) - - signBody := strings.ReplaceAll(utils.ReadAllText("assets/as/fetchCommunicationMemberDetail.json"), `"MEMBER_ID"`, memberId) - resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/navi/tapLovePoint", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/tapLovePoint.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/communicationMember/updateUserCommunicationMemberDetailBadge", func(ctx *gin.Context) { - reqBody := ctx.GetString("reqBody") - var memberMasterId string - gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { - if value.Get("member_master_id").String() != "" { - memberMasterId = value.Get("member_master_id").String() - return false - } - return true - }) - - signBody := strings.ReplaceAll(utils.ReadAllText("assets/as/updateUserCommunicationMemberDetailBadge.json"), `"MEMBER_MASTER_ID"`, memberMasterId) - resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/communicationMember/updateUserLiveDifficultyNewFlag", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/updateUserLiveDifficultyNewFlag.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/communicationMember/finishUserStorySide", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/finishUserStorySide.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/communicationMember/finishUserStoryMember", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/finishUserStoryMember.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/communicationMember/setTheme", func(ctx *gin.Context) { - reqBody := ctx.GetString("reqBody") - var memberMasterId, suitMasterId, backgroundMasterId string - gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { - if value.Get("member_master_id").String() != "" { - memberMasterId = value.Get("member_master_id").String() - suitMasterId = value.Get("suit_master_id").String() - backgroundMasterId = value.Get("custom_background_master_id").String() - return false - } - return true - }) - - signBody := strings.ReplaceAll(utils.ReadAllText("assets/as/setTheme.json"), `"MEMBER_MASTER_ID"`, memberMasterId) - signBody = strings.ReplaceAll(signBody, `"BACKGROUND_MASTER_ID"`, backgroundMasterId) - signBody = strings.ReplaceAll(signBody, `"SUIT_MASTER_ID"`, suitMasterId) - resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/userProfile/fetchProfile", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchProfile.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/emblem/fetchEmblem", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchEmblem.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/emblem/activateEmblem", func(ctx *gin.Context) { - reqBody := ctx.GetString("reqBody") - var emblemId string - gjson.Parse(reqBody).ForEach(func(key, value gjson.Result) bool { - if value.Get("emblem_master_id").String() != "" { - emblemId = value.Get("emblem_master_id").String() - return false - } - return true - }) - signBody := strings.ReplaceAll(utils.ReadAllText("assets/as/activateEmblem.json"), `"EMBLEM_ID"`, emblemId) - resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/navi/saveUserNaviVoice", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/saveUserNaviVoice.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/liveDeck/saveDeckAll", func(ctx *gin.Context) { - reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] - // fmt.Println(reqBody.String()) - - req := model.AsSaveDeckReq{} - decoder := json.NewDecoder(strings.NewReader(reqBody.String())) - decoder.UseNumber() - err := decoder.Decode(&req) - CheckErr(err) - // fmt.Println("Raw:", req.SquadDict) - - if req.CardWithSuit[1] == 0 { - req.CardWithSuit[1] = req.CardWithSuit[0] - } - if req.CardWithSuit[3] == 0 { - req.CardWithSuit[3] = req.CardWithSuit[2] - } - if req.CardWithSuit[5] == 0 { - req.CardWithSuit[5] = req.CardWithSuit[4] - } - if req.CardWithSuit[7] == 0 { - req.CardWithSuit[7] = req.CardWithSuit[6] - } - if req.CardWithSuit[9] == 0 { - req.CardWithSuit[9] = req.CardWithSuit[8] - } - if req.CardWithSuit[11] == 0 { - req.CardWithSuit[11] = req.CardWithSuit[10] - } - if req.CardWithSuit[13] == 0 { - req.CardWithSuit[13] = req.CardWithSuit[12] - } - if req.CardWithSuit[15] == 0 { - req.CardWithSuit[15] = req.CardWithSuit[14] - } - if req.CardWithSuit[17] == 0 { - req.CardWithSuit[17] = req.CardWithSuit[16] - } - - deckInfo := model.AsDeckInfo{ - UserLiveDeckID: req.DeckID, - Name: model.AsDeckName{ - DotUnderText: "队伍名称变了?", - }, - CardMasterID1: req.CardWithSuit[0], - CardMasterID2: req.CardWithSuit[2], - CardMasterID3: req.CardWithSuit[4], - CardMasterID4: req.CardWithSuit[6], - CardMasterID5: req.CardWithSuit[8], - CardMasterID6: req.CardWithSuit[10], - CardMasterID7: req.CardWithSuit[12], - CardMasterID8: req.CardWithSuit[14], - CardMasterID9: req.CardWithSuit[16], - SuitMasterID1: req.CardWithSuit[1], - SuitMasterID2: req.CardWithSuit[3], - SuitMasterID3: req.CardWithSuit[5], - SuitMasterID4: req.CardWithSuit[7], - SuitMasterID5: req.CardWithSuit[9], - SuitMasterID6: req.CardWithSuit[11], - SuitMasterID7: req.CardWithSuit[13], - SuitMasterID8: req.CardWithSuit[15], - SuitMasterID9: req.CardWithSuit[17], - } - // fmt.Println(deckInfo) - - deckInfoRes := []model.AsResp{} - deckInfoRes = append(deckInfoRes, req.DeckID) - deckInfoRes = append(deckInfoRes, deckInfo) - - partyInfoRes := []model.AsResp{} - for k, v := range req.SquadDict { - if k%2 == 0 { - partyId, err := v.(json.Number).Int64() - CheckErr(err) - // fmt.Println("Party ID:", partyId) - - rDictInfo, err := json.Marshal(req.SquadDict[k+1]) - CheckErr(err) - - dictInfo := model.AsDeckSquadDict{} - if err = json.Unmarshal(rDictInfo, &dictInfo); err != nil { - panic(err) - } - // fmt.Println("Party Info:", dictInfo) - - roleIds := []int{} - err = mEng.Table("m_card"). - Where("id IN (?,?,?)", dictInfo.CardMasterIds[0], dictInfo.CardMasterIds[1], dictInfo.CardMasterIds[2]). - Cols("role").Find(&roleIds) - CheckErr(err) - // fmt.Println("roleIds:", roleIds) - - var partyIcon int - var partyName string - // 脑残逻辑部分 - exists, err := mEng.Table("m_live_party_name"). - Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[0], roleIds[1], roleIds[2]). - Cols("name,live_party_icon").Get(&partyName, &partyIcon) - CheckErr(err) - if !exists { - exists, err = mEng.Table("m_live_party_name"). - Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[0], roleIds[2], roleIds[1]). - Cols("name,live_party_icon").Get(&partyName, &partyIcon) - CheckErr(err) - if !exists { - exists, err = mEng.Table("m_live_party_name"). - Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[1], roleIds[0], roleIds[2]). - Cols("name,live_party_icon").Get(&partyName, &partyIcon) - CheckErr(err) - if !exists { - exists, err = mEng.Table("m_live_party_name"). - Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[1], roleIds[2], roleIds[0]). - Cols("name,live_party_icon").Get(&partyName, &partyIcon) - CheckErr(err) - if !exists { - exists, err = mEng.Table("m_live_party_name"). - Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[2], roleIds[0], roleIds[1]). - Cols("name,live_party_icon").Get(&partyName, &partyIcon) - CheckErr(err) - if !exists { - exists, err = mEng.Table("m_live_party_name"). - Where("role_1 = ? AND role_2 = ? AND role_3 = ?", roleIds[2], roleIds[1], roleIds[0]). - Cols("name,live_party_icon").Get(&partyName, &partyIcon) - CheckErr(err) - if !exists { - panic("Fuck you!") - } - } - } - } - } - } - - var realPartyName string - _, err = mEng.Table("m_dictionary").Where("id = ?", strings.ReplaceAll(partyName, "k.", "")).Cols("message").Get(&realPartyName) - CheckErr(err) - - partyInfo := model.AsPartyInfo{ - PartyID: int(partyId), - UserLiveDeckID: req.DeckID, - Name: model.AsPartyName{ - DotUnderText: realPartyName, - }, - IconMasterID: partyIcon, - CardMasterID1: dictInfo.CardMasterIds[0], - CardMasterID2: dictInfo.CardMasterIds[1], - CardMasterID3: dictInfo.CardMasterIds[2], - UserAccessoryID1: dictInfo.UserAccessoryIds[0], - UserAccessoryID2: dictInfo.UserAccessoryIds[1], - UserAccessoryID3: dictInfo.UserAccessoryIds[2], - } - // fmt.Println(partyInfo) - - partyInfoRes = append(partyInfoRes, partyId) - partyInfoRes = append(partyInfoRes, partyInfo) - } - } - - // fmt.Println(deckInfoRes) - // fmt.Println(partyInfoRes) - - m1, err := json.Marshal(deckInfoRes) - CheckErr(err) - - m2, err := json.Marshal(partyInfoRes) - CheckErr(err) - - respBody := utils.ReadAllText("assets/as/saveDeckAll.json") - respBody = strings.ReplaceAll(respBody, `"DECK_INFO"`, string(m1)) - respBody = strings.ReplaceAll(respBody, `"PARTY_INFO"`, string(m2)) - // fmt.Println(respBody) - - resp := SignResp(ctx.GetString("ep"), respBody, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/livePartners/fetch", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchLivePartners.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/liveDeck/fetchLiveDeckSelect", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/fetchLiveDeckSelect.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/live/start", func(ctx *gin.Context) { - reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] - // fmt.Println(reqBody.String()) - - liveStartReq := model.AsLiveStartReq{} - if err := json.Unmarshal([]byte(reqBody.String()), &liveStartReq); err != nil { - panic(err) - } - // fmt.Println(liveStartReq) - - var cardInfo string - partnerResp := gjson.Parse(utils.ReadAllText("assets/as/fetchLivePartners.json")).Get("partner_select_state.live_partners") - partnerResp.ForEach(func(k, v gjson.Result) bool { - userId := v.Get("user_id").Int() - if userId == int64(liveStartReq.PartnerUserID) { - v.Get("card_by_category").ForEach(func(kk, vv gjson.Result) bool { - if vv.IsObject() { - cardId := vv.Get("card_master_id").Int() - if cardId == int64(liveStartReq.PartnerCardMasterID) { - cardInfo = vv.String() - // fmt.Println(cardInfo) - return false - } - } - return true - }) - return false - } - return true - }) - - // 保存请求包因为 /live/finish 接口的响应包里有部分字段不在该接口的请求包里 - liveId := strconv.Itoa(int(time.Now().UnixNano())) - err := database.LevelDb.Put([]byte("live_"+liveId), []byte(reqBody.String())) - CheckErr(err) - - liveDifficultyId := strconv.Itoa(liveStartReq.LiveDifficultyID) - liveNotes := utils.ReadAllText("assets/as/notes/" + liveDifficultyId + ".json") - if liveNotes == "" { - panic("歌曲情报信息不存在!") - } - - liveStartResp := utils.ReadAllText("assets/as/liveStart.json") - liveStartResp = strings.ReplaceAll(liveStartResp, `"LIVE_ID"`, liveId) - liveStartResp = strings.ReplaceAll(liveStartResp, `"DECK_ID"`, strconv.Itoa(liveStartReq.DeckID)) - liveStartResp = strings.ReplaceAll(liveStartResp, `"LIVE_NOTES"`, liveNotes) - liveStartResp = strings.ReplaceAll(liveStartResp, `"LIVE_PARTNER"`, cardInfo) - liveStartResp = strings.ReplaceAll(liveStartResp, `"LIVE_DIFFICULTY_ID"`, liveDifficultyId) - - resp := SignResp(ctx.GetString("ep"), liveStartResp, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/live/finish", func(ctx *gin.Context) { - reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] - // fmt.Println(reqBody.String()) - - var cardMasterId, maxVolt, skillCount, appealCount int64 - liveFinishReq := gjson.Parse(reqBody.String()) - liveFinishReq.Get("live_score.card_stat_dict").ForEach(func(key, value gjson.Result) bool { - if value.IsObject() { - volt := value.Get("got_voltage").Int() - if volt > maxVolt { - maxVolt = volt - - cardMasterId = value.Get("card_master_id").Int() - skillCount = value.Get("skill_triggered_count").Int() - appealCount = value.Get("appeal_count").Int() - } - } - return true - }) - - mvpInfo := model.AsMvpInfo{ - CardMasterID: cardMasterId, - GetVoltage: maxVolt, - SkillTriggeredCount: skillCount, - AppealCount: appealCount, - } - mvp, err := json.Marshal(mvpInfo) - CheckErr(err) - // fmt.Println("mvpInfo:", mvpInfo) - - liveId := liveFinishReq.Get("live_id").String() - res, err := database.LevelDb.Get([]byte("live_" + liveId)) - CheckErr(err) - - liveStartReq := model.AsLiveStartReq{} - if err := json.Unmarshal(res, &liveStartReq); err != nil { - panic(err) - } - // fmt.Println("liveStartReq:", liveStartReq) - - partnerInfo := model.AsLivePartnerInfo{ - LastPlayedAt: time.Now().Unix(), - RecommendCardMasterID: liveStartReq.PartnerCardMasterID, - RecommendCardLevel: 1, - IsRecommendCardImageAwaken: true, - IsRecommendCardAllTrainingActivated: true, - IsNew: false, - FriendApprovedAt: nil, - RequestStatus: 3, - IsRequestPending: false, - } - partnerResp := gjson.Parse(utils.ReadAllText("assets/as/fetchLivePartners.json")).Get("partner_select_state.live_partners") - partnerResp.ForEach(func(k, v gjson.Result) bool { - userId := v.Get("user_id").Int() - if userId == int64(liveStartReq.PartnerUserID) { - partnerInfo.UserID = int(userId) - partnerInfo.Name.DotUnderText = v.Get("name.dot_under_text").String() - partnerInfo.Rank = int(v.Get("rank").Int()) - partnerInfo.EmblemID = int(v.Get("emblem_id").Int()) - partnerInfo.IntroductionMessage.DotUnderText = v.Get("introduction_message.dot_under_text").String() - } - return true - }) - partner, err := json.Marshal(partnerInfo) - CheckErr(err) - // fmt.Println(partnerInfo) - - liveResultResp := model.AsLiveResultAchievementStatus{ - ClearCount: 1, - GotVoltage: liveFinishReq.Get("live_score.current_score").Int(), - RemainingStamina: liveFinishReq.Get("live_score.remaining_stamina").Int(), - } - liveResult, err := json.Marshal(liveResultResp) - CheckErr(err) - // fmt.Println(liveResultResp) - - liveFinishResp := utils.ReadAllText("assets/as/liveFinish.json") - liveFinishResp = strings.ReplaceAll(liveFinishResp, `"LIVE_DIFFICULTY_ID"`, strconv.Itoa(liveStartReq.LiveDifficultyID)) - liveFinishResp = strings.ReplaceAll(liveFinishResp, `"DECK_ID"`, strconv.Itoa(liveStartReq.DeckID)) - liveFinishResp = strings.ReplaceAll(liveFinishResp, `"MVP_INFO"`, string(mvp)) - liveFinishResp = strings.ReplaceAll(liveFinishResp, `"PARTNER_INFO"`, string(partner)) - liveFinishResp = strings.ReplaceAll(liveFinishResp, `"LIVE_RESULT"`, string(liveResult)) - liveFinishResp = strings.ReplaceAll(liveFinishResp, `"LIVE_VOLTAGE"`, liveFinishReq.Get("live_score.current_score").String()) - // fmt.Println(liveFinishResp) - - resp := SignResp(ctx.GetString("ep"), liveFinishResp, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/card/getOtherUserCard", func(ctx *gin.Context) { - reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] - // fmt.Println(reqBody.String()) - - userCardReq := model.AsUserCardReq{} - if err := json.Unmarshal([]byte(reqBody.String()), &userCardReq); err != nil { - panic(err) - } - // fmt.Println(liveStartReq) - - var cardInfo string - partnerResp := gjson.Parse(utils.ReadAllText("assets/as/fetchLivePartners.json")).Get("partner_select_state.live_partners") - partnerResp.ForEach(func(k, v gjson.Result) bool { - userId := v.Get("user_id").Int() - if userId == userCardReq.UserID { - v.Get("card_by_category").ForEach(func(kk, vv gjson.Result) bool { - if vv.IsObject() { - cardId := vv.Get("card_master_id").Int() - if cardId == userCardReq.CardMasterID { - cardInfo = vv.String() - // fmt.Println(cardInfo) - return false - } - } - return true - }) - return false - } - return true - }) - - userCardResp := utils.ReadAllText("assets/as/getOtherUserCard.json") - userCardResp = strings.ReplaceAll(userCardResp, `"USER_CARD_INFO"`, cardInfo) - - resp := SignResp(ctx.GetString("ep"), userCardResp, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/notice/fetchNoticeDetail", func(ctx *gin.Context) { - reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] - // fmt.Println(reqBody.String()) - - noticeId := reqBody.Get("notice_id").String() - - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/notices/"+noticeId+".json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/card/changeIsAwakeningImage", func(ctx *gin.Context) { - reqBody := gjson.Parse(ctx.GetString("reqBody")).Array()[0] - // fmt.Println(reqBody.String()) - - req := model.AsCardAwakeningReq{} - if err := json.Unmarshal([]byte(reqBody.String()), &req); err != nil { - panic(err) - } - - cardInfo := model.AsCardInfo{} - gjson.Parse(utils.ReadAllText("assets/as/login.json")).Get("user_model.user_card_by_card_id"). - ForEach(func(key, value gjson.Result) bool { - if value.IsObject() { - if err := json.Unmarshal([]byte(value.String()), &cardInfo); err != nil { - panic(err) - } - - if cardInfo.CardMasterID == req.CardMasterID { - cardInfo.IsAwakeningImage = req.IsAwakeningImage - - return false - } - } - return true - }) - - card, err := json.Marshal(cardInfo) - CheckErr(err) - - jsonStr := fmt.Sprintf("[%d,%s]", cardInfo.CardMasterID, string(card)) - // fmt.Println(jsonStr) - - cardResp := utils.ReadAllText("assets/as/changeIsAwakeningImage.json") - cardResp = strings.ReplaceAll(cardResp, `"USER_CARD_INFO"`, jsonStr) - // fmt.Println(cardResp) - - resp := SignResp(ctx.GetString("ep"), cardResp, sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/storyEventHistory/finishStory", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/finishStory.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/story/finishUserStoryMain", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/finishUserStoryMain.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) - s.POST("/story/finishStoryLinkage", func(ctx *gin.Context) { - resp := SignResp(ctx.GetString("ep"), utils.ReadAllText("assets/as/finishStoryLinkage.json"), sessionKey) - - ctx.Header("Content-Type", "application/json") - ctx.String(http.StatusOK, resp) - }) + s.POST("/login/login", handler.AsLogin) + s.POST("/bootstrap/fetchBootstrap", handler.AsFetchBootstrap) + s.POST("/billing/fetchBillingHistory", handler.AsFetchBillingHistory) + s.POST("/notice/fetchNotice", handler.AsFetchNotice) + s.POST("/asset/getPackUrl", handler.AsGetPackUrl) + s.POST("/card/updateCardNewFlag", handler.AsUpdateCardNewFlag) + s.POST("/bootstrap/getClearedPlatformAchievement", handler.AsGetClearedPlatformAchievement) + s.POST("/live/fetchLiveMusicSelect", handler.AsFetchLiveMusicSelect) + s.POST("/liveMv/start", handler.AsLiveMvStart) + s.POST("/liveMv/saveDeck", handler.AsLiveMvSaveDeck) + s.POST("/communicationMember/fetchCommunicationMemberDetail", handler.AsFetchCommunicationMemberDetail) + s.POST("/navi/tapLovePoint", handler.AsTapLovePoint) + s.POST("/communicationMember/updateUserCommunicationMemberDetailBadge", handler.AsUpdateUserCommunicationMemberDetailBadge) + s.POST("/communicationMember/updateUserLiveDifficultyNewFlag", handler.AsUpdateUserLiveDifficultyNewFlag) + s.POST("/communicationMember/finishUserStorySide", handler.AsFinishUserStorySide) + s.POST("/communicationMember/finishUserStoryMember", handler.AsFinishUserStoryMember) + s.POST("/communicationMember/setTheme", handler.AsSetTheme) + s.POST("/userProfile/fetchProfile", handler.AsFetchProfile) + s.POST("/emblem/fetchEmblem", handler.AsFetchEmblem) + s.POST("/emblem/activateEmblem", handler.AsActivateEmblem) + s.POST("/navi/saveUserNaviVoice", handler.AsSaveUserNaviVoice) + s.POST("/liveDeck/saveDeckAll", handler.AsSaveDeckAll) + s.POST("/livePartners/fetch", handler.AsFetchLivePartners) + s.POST("/liveDeck/fetchLiveDeckSelect", handler.AsFetchLiveDeckSelect) + s.POST("/live/start", handler.AsLiveStart) + s.POST("/live/finish", handler.AsLiveFinish) + s.POST("/card/getOtherUserCard", handler.AsGetOtherUserCard) + s.POST("/notice/fetchNoticeDetail", handler.AsFetchNoticeDetail) + s.POST("/card/changeIsAwakeningImage", handler.AsChangeIsAwakeningImage) + s.POST("/storyEventHistory/finishStory", handler.AsFinishStory) + s.POST("/story/finishUserStoryMain", handler.AsFinishStoryMain) + s.POST("/story/finishStoryLinkage", handler.AsFinishStoryLinkage) + s.POST("/trainingTree/fetchTrainingTree", handler.AsFetchTrainingTree) } } diff --git a/router/utils.go b/router/utils.go deleted file mode 100644 index 1d27d51..0000000 --- a/router/utils.go +++ /dev/null @@ -1,85 +0,0 @@ -package router - -import ( - "fmt" - "honoka-chan/config" - "honoka-chan/encrypt" - "honoka-chan/model" - "time" -) - -func CheckErr(err error) { - if err != nil { - panic(err) - } -} - -func SignResp(ep, body, key string) (resp string) { - signBody := fmt.Sprintf("%d,\"%s\",0,%s", time.Now().UnixMilli(), config.MasterVersion, body) - sign := encrypt.HMAC_SHA1_Encrypt([]byte(ep+" "+signBody), []byte(key)) - // fmt.Println(sign) - - resp = fmt.Sprintf("[%s,\"%s\"]", signBody, sign) - return -} - -func CommonUserStatus() model.AsUserStatus { - return model.AsUserStatus{ - Name: model.Name{ - DotUnderText: "梦路2号机@果果厨", - }, - Nickname: model.Nickname{ - DotUnderText: "梦路", - }, - LastLoginAt: time.Now().Unix(), - Rank: 122, - Exp: 416263, - Message: model.Message{ - DotUnderText: "B站主播:梦路_YumeMichi", - }, - RecommendCardMasterID: 200013001, - MaxFriendNum: 0, - LivePointFullAt: 1684158189, - LivePointBroken: 150, - LivePointSubscriptionRecoveryDailyCount: 1, - LivePointSubscriptionRecoveryDailyResetAt: 1656259200, - ActivityPointCount: 0, - ActivityPointResetAt: 1684123200, - ActivityPointPaymentRecoveryDailyCount: 10, - ActivityPointPaymentRecoveryDailyResetAt: 1683734400, - GameMoney: 115665089, - CardExp: 32316167, - FreeSnsCoin: 280, - AppleSnsCoin: 0, - GoogleSnsCoin: 0, - Cash: 0, - SubscriptionCoin: 30, - BirthDate: nil, - BirthMonth: 10, - BirthDay: 18, - LatestLiveDeckID: 1, - MainLessonDeckID: 1, - FavoriteMemberID: 1, - LastLiveDifficultyID: 12092302, - LpMagnification: 1, - EmblemID: 13100608, - DeviceToken: "", - TutorialPhase: 99, - TutorialEndAt: 1622217482, - LoginDays: 446, - NaviTapCount: 2, - NaviTapRecoverAt: 1684771200, - IsAutoMode: false, - MaxScoreLiveDifficultyMasterID: 12037401, - LiveMaxScore: 40553270, - MaxComboLiveDifficultyMasterID: 12037401, - LiveMaxCombo: 301, - LessonResumeStatus: 1, - AccessoryBoxAdditional: 90, - TermsOfUseVersion: 0, - BootstrapSifidCheckAt: 1683178908, - GdprVersion: 0, - MemberGuildMemberMasterID: 1, - MemberGuildLastUpdatedAt: 1659485328, - } -}