Skip to content

Commit

Permalink
fix: fix home api needs device info
Browse files Browse the repository at this point in the history
  • Loading branch information
starudream committed Jul 23, 2024
1 parent acde560 commit ddf517d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/miyoushe/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func (h *Home) GetSignActId() string {
return ""
}

func GetHome(gameId string) (*Home, error) {
req := common.R().SetQueryParam("gids", gameId)
func GetHome(gameId string, account config.Account) (*Home, error) {
req := common.R(account.Device).SetQueryParam("gids", gameId)
return common.Exec[*Home](req, "GET", AddrBBS+"/apihub/api/home/new")
}

Expand Down
8 changes: 4 additions & 4 deletions api/miyoushe/home_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ import (

func TestGetHome(t *testing.T) {
t.Run(common.GameIdDBY, func(t *testing.T) {
data, err := GetHome(common.GameIdDBY)
data, err := GetHome(common.GameIdDBY, config.C().FirstAccount())
testutil.LogNoErr(t, err, data)
})

t.Run(common.GameIdYS, func(t *testing.T) {
data, err := GetHome(common.GameIdYS)
data, err := GetHome(common.GameIdYS, config.C().FirstAccount())
testutil.LogNoErr(t, err, data, data.GetSignActId())
})

t.Run(common.GameIdSR, func(t *testing.T) {
data, err := GetHome(common.GameIdSR)
data, err := GetHome(common.GameIdSR, config.C().FirstAccount())
testutil.LogNoErr(t, err, data, data.GetSignActId())
})

t.Run(common.GameIdBH3, func(t *testing.T) {
data, err := GetHome(common.GameIdBH3)
data, err := GetHome(common.GameIdBH3, config.C().FirstAccount())
testutil.LogNoErr(t, err, data, data.GetSignActId())
})
}
Expand Down
2 changes: 1 addition & 1 deletion api/miyoushe/sign_game_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func GetRole(t *testing.T, gameBiz string) (string, string, string, string) {
gameName := strings.Split(gameBiz, "_")[0]
gameId := gameIdByName[gameName]

data1, err := GetHome(gameId)
data1, err := GetHome(gameId, config.C().FirstAccount())
testutil.LogNoErr(t, err, data1)
actId := data1.GetSignActId()
testutil.MustNotEqual(t, "", actId)
Expand Down
2 changes: 1 addition & 1 deletion job/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func SignGameRole(role *miyoushe.GameRole, account config.Account) (record SignG

gameName := strings.Split(role.GameBiz, "_")[0]

home, err := miyoushe.GetHome(gameId)
home, err := miyoushe.GetHome(gameId, account)
if err != nil {
err = fmt.Errorf("get home error: %w", err)
return
Expand Down

0 comments on commit ddf517d

Please sign in to comment.