fix: 余量查询按营业厅请求格式提交

This commit is contained in:
Nixevol
2026-10-16 16:52:16 +08:00
parent 83b62ca7d2
commit 08f8cafa4b
+11 -4
View File
@@ -226,9 +226,7 @@ func (c *Client) Query(ctx context.Context, phone string) (Snapshot, error) {
"ticket": {""},
"ticketPhone": {""},
"ticketChannel": {""},
}
if phone != "" {
extra.Set("userNumber", phone)
"userNumber": {""},
}
if c.plan.Language != "" {
extra.Set("language", c.plan.Language)
@@ -472,9 +470,18 @@ func (c *Client) postBill(ctx context.Context, api billAPI, extra url.Values) (j
if err != nil {
return nil, err
}
c.decorate(req, api.Referer)
c.decorate(req, strings.TrimRight(api.Origin, "/")+"/")
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("Accept", "application/json, text/plain, */*")
req.Header.Set("Origin", api.Origin)
req.Header.Del("X-Requested-With")
if u, err := url.Parse(api.URL); err == nil {
names := make([]string, 0)
for _, ck := range c.jar.Cookies(u) {
names = append(names, ck.Name)
}
debugf("账单 %s Cookie %s", u.Path, strings.Join(names, ","))
}
body, ctype, err := c.doRequest(req)
if err != nil {
return nil, err