优化和平小店商品列表界面

This commit is contained in:
yml2213
2026-08-08 18:01:10 +08:00
parent 395096e229
commit 06ad1498da
5 changed files with 125 additions and 30 deletions
+16
View File
@@ -148,6 +148,15 @@ func TestProductsAutomaticallyResolvesXiaodianRoleAndPaginates(t *testing.T) {
t.Errorf("_act_id = %q", got)
}
_, _ = w.Write([]byte(`var info = {"gameOpenId":"openid","roleId":1192083858,"type":"qq","area":1};`))
case "/role/":
switch r.URL.Query().Get("_jsvar") {
case "banlanceInfo":
_, _ = w.Write([]byte(`var banlanceInfo={"balance":8800};`))
case "jbInfos":
_, _ = w.Write([]byte(`var jbInfos={"jb2":"36"};`))
default:
http.Error(w, "unknown asset query", http.StatusBadRequest)
}
case "/goods":
offset := r.URL.Query().Get("page_begin")
goodsOffsets = append(goodsOffsets, offset)
@@ -204,6 +213,13 @@ func TestProductsAutomaticallyResolvesXiaodianRoleAndPaginates(t *testing.T) {
if got := strings.Join(goodsOffsets, ","); got != strings.Join([]string{"0", strconv.Itoa(2), strconv.Itoa(4)}, ",") {
t.Fatalf("分页偏移 = %s", got)
}
assets, err := cli.XiaodianAssets("acf_uid=uid; acf_stk=stk; acf_ltkid=ltkid")
if err != nil {
t.Fatalf("XiaodianAssets() error = %v", err)
}
if assets.Coupons != 8800 || assets.Fragments != 36 {
t.Fatalf("资产 = %#v", assets)
}
}
func testCTNClient(t *testing.T, ctnURL string) *DouyuClient {