Skip to content

Commit

Permalink
Fix 加入购物车判定 (#38)
Browse files Browse the repository at this point in the history
* fix: 预约参数修改
* fix: 购物车成功判定
  • Loading branch information
xxxXXX95 authored Jan 20, 2022
1 parent 46d26dd commit b40638d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,14 @@ class Tools {
const res = await this.request(url + `?${qs.stringify(payload)}`, {
headers
});
if (res.url.indexOf('https://cart.jd.com/addToCart.html') !== -1) {
const text = await res.text();
if (
// res.url.indexOf('https://cart.jd.com/addToCart.html') !== -1 ||
res.url.indexOf('https://cart.jd.com/gateResult') !== -1
) {
// const text = await res.text();
// const text.match()
const isSuccess = text.match(/(class="ftx-02")/i)[1];
return {
pageUrl: `https://cart.jd.com/addToCart.html`,
msg: isSuccess ? '已经成功添加购物车' : '添加购物车失败'
};
// const isSuccess = text.match(/(class="ftx-02")/i)[1];
return true
}
if (
res.url.indexOf(`https://cart.jd.com/cart_asyc_index_utf8.html`) !== -1
Expand Down

0 comments on commit b40638d

Please sign in to comment.