fix: preserve xiaodian ios platform in asset queries

This commit is contained in:
yml2213
2026-08-09 10:10:49 +08:00
parent feb72196c1
commit c41fd48b1c
3 changed files with 27 additions and 13 deletions
+8 -2
View File
@@ -147,10 +147,16 @@ func TestProductsAutomaticallyResolvesXiaodianRoleAndPaginates(t *testing.T) {
if got := r.URL.Query().Get("_act_id"); got != "46195" {
t.Errorf("_act_id = %q", got)
}
_, _ = w.Write([]byte(`var info = {"gameOpenId":"openid","roleId":1192083858,"roleName":"测试角色","type":"qq","area":1};`))
_, _ = w.Write([]byte(`var info = {"gameOpenId":"openid","roleId":1192083858,"roleName":"测试角色","type":"qq","area":1,"platId":0};`))
case "/role/":
if got := r.URL.Query().Get("plat"); got != "0" {
t.Errorf("plat = %q, want iOS platform 0", got)
}
switch r.URL.Query().Get("_jsvar") {
case "banlanceInfo":
if got := r.URL.Query().Get("_time"); len(got) != 13 {
t.Errorf("_time = %q, want millisecond timestamp", got)
}
_, _ = w.Write([]byte(`var banlanceInfo={"balance":8800};`))
case "jbInfos":
_, _ = w.Write([]byte(`var jbInfos={"jb2":"36"};`))
@@ -236,7 +242,7 @@ func TestProductsAutomaticallyResolvesXiaodianRoleAndPaginates(t *testing.T) {
t.Fatalf("资产 = %#v", assets)
}
role, err := cli.XiaodianRole("acf_uid=uid; acf_stk=stk; acf_ltkid=ltkid")
if err != nil || role.RoleName != "测试角色" || role.AreaID != 2 {
if err != nil || role.RoleName != "测试角色" || role.AreaID != 2 || role.PlatID != 0 {
t.Fatalf("角色 = %#v, err=%v", role, err)
}
}