(account)
| 160 | } |
| 161 | |
| 162 | function GetUserPoint(account) { |
| 163 | const opts = { |
| 164 | url: 'https://manga.bilibili.com/twirp/pointshop.v1.Pointshop/GetUserPoint', |
| 165 | headers: { |
| 166 | "User-Agent": "comic-universal/3412 CFNetwork/1410.0.3 Darwin/22.6.0 os/ios model/iPhone 12 mobi_app/iphone_comic build/3412 osVer/16.6 network/2 channel/AppStore", |
| 167 | "Cookie": account.cookie |
| 168 | }, |
| 169 | throwHttpErrors: false |
| 170 | }; |
| 171 | |
| 172 | $.debug(`Send GetUserPoint request:`, $.toStr(opts, null, null, 1)); |
| 173 | |
| 174 | return $.http.post(opts) |
| 175 | .then((resp) => { |
| 176 | $.debug(`Receive GetUserPoint response:`, $.toStr(resp, null, null, 1)); |
| 177 | const body = JSON.parse(resp.body?.startsWith('{') && resp.body || '{}'); |
| 178 | if (body.code == 0 && body.data) { |
| 179 | return parseInt(body.data.point); |
| 180 | } else { |
| 181 | throw new Error(body.msg || '查询积分失败'); |
| 182 | } |
| 183 | }) |
| 184 | .catch((err) => { |
| 185 | $.error(`GetUserPoint error:`, err); |
| 186 | throw err; |
| 187 | }); |
| 188 | } |
| 189 | |
| 190 | function ListProduct(account) { |
| 191 | const opts = { |
no test coverage detected