fix msk style
This commit is contained in:
@@ -883,10 +883,27 @@ func get(c *fiber.Ctx) error {
|
||||
"userLimitBreakItemList": nil,
|
||||
"userDecoAppealInventoryMap": nil,
|
||||
"userInvitationInfo": nil,
|
||||
"userCharacterUseStyleMap": nil,
|
||||
"userPurchaseStarList": nil,
|
||||
"userInviteMissionListMap": nil,
|
||||
"userGachaBonusMap": nil,
|
||||
"userCharacterUseStyleMap": func() map[string]any {
|
||||
useCharacterId := 15
|
||||
status := "normal"
|
||||
if user["msk"] != nil {
|
||||
msk := user["msk"].(map[string]any)
|
||||
useCharacterId = int(msk["useCharacterId"].(float64))
|
||||
status = msk["status"].(string)
|
||||
}
|
||||
return map[string]any{
|
||||
"entries": map[string]any{
|
||||
"15": map[string]any{
|
||||
"characterId": 15,
|
||||
"useCharacterId": useCharacterId,
|
||||
"status": status,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
"userPurchaseStarList": nil,
|
||||
"userInviteMissionListMap": nil,
|
||||
"userGachaBonusMap": nil,
|
||||
"userStampVoiceMap": func() map[string]any {
|
||||
result := map[string]any{}
|
||||
if sm, ok := m["masterStampMap"].(map[string]any); ok {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package style
|
||||
|
||||
import (
|
||||
"bdgrp_go/db"
|
||||
"bdgrp_go/pbutil"
|
||||
"bdgrp_go/routes"
|
||||
"bdgrp_go/utils"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
path := routes.PathOf()
|
||||
routes.Register(func(app *fiber.App) {
|
||||
app.Put(path, handle)
|
||||
fmt.Println("Loaded:", path)
|
||||
})
|
||||
}
|
||||
|
||||
func handle(c *fiber.Ctx) error {
|
||||
decrypted, err := utils.Decrypt(c.Body())
|
||||
if err != nil {
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
decoded, err := pbutil.Decode("UserCharacterChangeUseStyleStatusRequest", decrypted)
|
||||
if err != nil {
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
user := db.FindUser(c.Params("userid"))
|
||||
if user["msk"] == nil {
|
||||
user["msk"] = map[string]any{}
|
||||
}
|
||||
|
||||
msk := user["msk"].(map[string]any)
|
||||
useCharacterId := 15
|
||||
if decoded["status"] == "another" {
|
||||
useCharacterId = 601
|
||||
}
|
||||
|
||||
msk["useCharacterId"] = useCharacterId
|
||||
msk["status"] = decoded["status"]
|
||||
|
||||
db.Save()
|
||||
|
||||
data := map[string]any{
|
||||
"userCharacterUseStyleMap": map[string]any{
|
||||
"entries": map[string]any{
|
||||
"15": map[string]any{
|
||||
"characterId": 15,
|
||||
"useCharacterId": useCharacterId,
|
||||
"status": msk["status"],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
encoded, err := pbutil.Encode("SuiteUserGetResponse", data)
|
||||
if err != nil {
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
encrypted, err := utils.Encrypt(encoded)
|
||||
if err != nil {
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
return c.Send(encrypted)
|
||||
}
|
||||
Reference in New Issue
Block a user