diff --git a/api/miyoushe/api.go b/api/miyoushe/api.go index 0993585..78f3786 100644 --- a/api/miyoushe/api.go +++ b/api/miyoushe/api.go @@ -1,6 +1,7 @@ package miyoushe const ( - AddrTakumi = "https://api-takumi.mihoyo.com" - AddrBBS = "https://bbs-api.miyoushe.com" + AddrTakumi = "https://api-takumi.mihoyo.com" + AddrTakumiRecord = "https://api-takumi-record.mihoyo.com" + AddrBBS = "https://bbs-api.miyoushe.com" ) diff --git a/api/miyoushe/game.go b/api/miyoushe/game.go index 1a469f9..142dd74 100644 --- a/api/miyoushe/game.go +++ b/api/miyoushe/game.go @@ -47,3 +47,30 @@ func ListGameRole(gameBiz string, account config.Account) (*ListGameRoleData, er req := common.R(account.Device).SetCookies(common.SToken(account)).SetQueryParam("game_biz", gameBiz) return common.Exec[*ListGameRoleData](req, "GET", AddrTakumi+"/binding/api/getUserGameRolesByStoken") } + +type ListGameCardData struct { + List []*GameCard `json:"list"` +} + +type GameCard struct { + HasRole bool `json:"has_role"` + IsPublic bool `json:"is_public"` + GameId int `json:"game_id"` + GameRoleId string `json:"game_role_id"` + Region string `json:"region"` + RegionName string `json:"region_name"` + Level int `json:"level"` + Nickname string `json:"nickname"` + Data []*GameCardItem `json:"data"` +} + +type GameCardItem struct { + Type int `json:"type"` + Name string `json:"name"` + Value string `json:"value"` +} + +func ListGameCard(account config.Account) (*ListGameCardData, error) { + req := common.R(account.Device).SetCookies(common.SToken(account)).SetQueryParam("uid", account.Uid) + return common.Exec[*ListGameCardData](req, "GET", AddrTakumiRecord+"/game_record/card/api/getGameRecordCard") +} diff --git a/api/miyoushe/game_test.go b/api/miyoushe/game_test.go index 117a0eb..9f0bcd3 100644 --- a/api/miyoushe/game_test.go +++ b/api/miyoushe/game_test.go @@ -27,3 +27,8 @@ func TestListGameRole(t *testing.T) { testutil.LogNoErr(t, err, data) }) } + +func TestListGameCard(t *testing.T) { + data, err := ListGameCard(config.C().FirstAccount()) + testutil.LogNoErr(t, err, data) +}