Skip to content

Commit 4855a6b

Browse files
committed
Update jdGuaranteedPrice.js
1 parent fb944e2 commit 4855a6b

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

task/jdGuaranteedPrice.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,29 @@ cookies = Array.from(new Set([...cookies, ...extraCookies]));
9090
console.log(`💥 获得首页面,解析超参数`);
9191
await getHyperParams();
9292
// console.log($.HyperParam)
93+
console.log(`----------`);
9394
console.log(`🧾 获取所有价格保护列表,排除附件商品`);
9495
for (let page = 1; $.hasNext; page++) {
9596
await getApplyData(page);
9697
}
98+
console.log(`----------`);
9799
console.log(`🗑 删除不符合订单`);
100+
console.log(`----------`);
98101
let taskList = [];
99102
for (let order of $.orderList) {
100103
taskList.push(historyResultQuery(order));
101104
}
102105
await Promise.all(taskList);
106+
console.log(`----------`);
103107
console.log(`📊 ${$.orderList.length}个商品即将申请价格保护!`);
108+
console.log(`----------`);
104109
for (let order of $.orderList) {
105110
await skuApply(order);
106111
await $.wait(300);
107112
}
113+
console.log(`----------`);
108114
console.log(`⏳ 等待申请价格保护结果...`);
115+
console.log(`----------`);
109116
for (let i = 1; i <= 30 && Object.keys($.applyMap).length > 0; i++) {
110117
await $.wait(1000);
111118
if (i % 5 == 0) {
@@ -184,14 +191,15 @@ function getApplyData(page) {
184191
return new Promise((resolve, reject) => {
185192
$.hasNext = false;
186193
const { sid_hid, type_hid, forcebot } = $.HyperParam;
194+
const pageSize = 5;
187195

188196
let paramObj = {
189197
page,
190-
pageSize: 5,
198+
pageSize,
191199
keyWords: '',
192200
sid: sid_hid,
193201
type: type_hid,
194-
forcebot: forcebot,
202+
forcebot,
195203
token: $.token,
196204
feSt: $.feSt,
197205
};
@@ -238,6 +246,8 @@ function getApplyData(page) {
238246
data,
239247
skuRefundTypeDiv_orderId
240248
);
249+
// 设置原路返还
250+
item.refundtype === '2' && item.refundtype = '1';
241251
$.orderList.push(item);
242252
}
243253
//else...尊敬的顾客您好,您选择的商品本身为赠品,是不支持价保的呦,请您理解。
@@ -370,10 +380,15 @@ function getApplyResult() {
370380
if (ajaxResultObj.applyResultVo.proApplyStatus == 'ApplySuccess') {
371381
//价保成功
372382
$.refundtotalamount += ajaxResultObj.applyResultVo.refundtotalamount;
383+
console.log(
384+
`📋 ${order.title} \n🟢 申请成功:¥${$.refundtotalamount}`
385+
);
386+
console.log(`-----`);
373387
} else {
374388
console.log(
375389
`📋 ${order.title} \n🔴 申请失败:${ajaxResultObj.applyResultVo.failTypeStr} \n🔴 失败类型:${ajaxResultObj.applyResultVo.failType}`
376390
);
391+
console.log(`-----`);
377392
}
378393
}
379394
}
@@ -418,7 +433,7 @@ function getApplyResult() {
418433

419434
function taskUrl(functionid, body) {
420435
let urlStr = selfDomain + 'rest/priceprophone/priceskusPull';
421-
const { useColorApi, forcebot, useColorApi } = $.HyperParam;
436+
const { useColorApi, forcebot } = $.HyperParam;
422437

423438
if (useColorApi == 'true') {
424439
urlStr =

0 commit comments

Comments
 (0)