add more routes
This commit is contained in:
20
routes/api/user/param_userid/music/param_musicid.go
Normal file
20
routes/api/user/param_userid/music/param_musicid.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package music
|
||||
|
||||
import (
|
||||
"bdgrp_go/routes"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
path := routes.PathOf()
|
||||
routes.Register(func(app *fiber.App) {
|
||||
app.Post(path, music)
|
||||
fmt.Println("Loaded:", path)
|
||||
})
|
||||
}
|
||||
|
||||
func music(c *fiber.Ctx) error {
|
||||
return c.SendStatus(200)
|
||||
}
|
||||
82
routes/api/user/param_userid/music/param_musicid/continue.go
Normal file
82
routes/api/user/param_userid/music/param_musicid/continue.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package param_musicid
|
||||
|
||||
import (
|
||||
"bdgrp_go/db"
|
||||
"bdgrp_go/pbutil"
|
||||
"bdgrp_go/routes"
|
||||
"bdgrp_go/utils"
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
path := routes.PathOf()
|
||||
routes.Register(func(app *fiber.App) {
|
||||
app.Put(path, musicContinue)
|
||||
fmt.Println("Loaded:", path)
|
||||
})
|
||||
}
|
||||
|
||||
func musicContinue(c *fiber.Ctx) error {
|
||||
userid := c.Params("userid")
|
||||
|
||||
decrypted, err := utils.Decrypt(c.Body())
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
decoded, err := pbutil.Decode("UserMusicContinueRequest", decrypted)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
user := db.FindUser(userid)
|
||||
|
||||
str := userid + decoded["continueCount"].(string) + decoded["continueTime"].(string)
|
||||
|
||||
data := map[string]any{
|
||||
"userGamedata": map[string]any{
|
||||
"userId": userid,
|
||||
"rank": user["rank"],
|
||||
"exp": user["exp"],
|
||||
"coin": user["coin"],
|
||||
"mainDeck": user["mainDeck"],
|
||||
"paidStar": user["paidStar"],
|
||||
"freeStar": user["freeStar"],
|
||||
"seal": user["seal"],
|
||||
"degree": user["degree"],
|
||||
"publishTotalDeckPowerFlg": user["publishTotalDeckPowerFlg"],
|
||||
"publishBandRankFlg": user["publishBandRankFlg"],
|
||||
"publishMusicClearedFlg": user["publishMusicClearedFlg"],
|
||||
"publishMusicFullComboFlg": user["publishMusicFullComboFlg"],
|
||||
"publishHighScoreRatingFlg": user["publishHighScoreRatingFlg"],
|
||||
"pooledExp": user["pooledExp"],
|
||||
"totalExp": user["totalExp"],
|
||||
"nextExp": user["nextExp"],
|
||||
"publishUpdatedAtFlg": user["publishUpdatedAtFlg"],
|
||||
"userPaidStarRecallResponse": nil,
|
||||
"startDashLoginBonusReceiveFlg": user["startDashLoginBonusReceiveFlg"],
|
||||
"publishMusicAllPerfectFlg": user["publishMusicAllPerfectFlg"],
|
||||
"publishDeckRankFlg": user["publishDeckRankFlg"],
|
||||
"publishStageAchievementConditionsFlg": user["publishStageAchievementConditionsFlg"],
|
||||
"publishStageFriendRankingFlg": user["publishStageFriendRankingFlg"],
|
||||
"publishCharacterRankFlg": user["publishCharacterRankFlg"],
|
||||
"loginDays": user["loginDays"],
|
||||
},
|
||||
"continueHash": fmt.Sprintf("%x", sha1.Sum([]byte(str))),
|
||||
}
|
||||
|
||||
encoded, err := pbutil.Encode("UserMusicContinueResponse", data)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
encrypted, err := utils.Encrypt(encoded)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
return c.Send(encrypted)
|
||||
}
|
||||
20
routes/api/user/param_userid/music/param_musicid/retry.go
Normal file
20
routes/api/user/param_userid/music/param_musicid/retry.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package param_musicid
|
||||
|
||||
import (
|
||||
"bdgrp_go/routes"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
path := routes.PathOf()
|
||||
routes.Register(func(app *fiber.App) {
|
||||
app.Post(path, retry)
|
||||
fmt.Println("Loaded:", path)
|
||||
})
|
||||
}
|
||||
|
||||
func retry(c *fiber.Ctx) error {
|
||||
return c.SendStatus(200)
|
||||
}
|
||||
Reference in New Issue
Block a user