Skip to content

Commit b916617

Browse files
NexqNexq
Nexq
authored and
Nexq
committed
TEST
1 parent 0163bfa commit b916617

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

jd_cleancart.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,7 @@ function getCart_xh() {
115115
}
116116
$.get(option, async (err, resp, data) => {
117117
try {
118-
data = getSubstr(data, "window.cartData = ", "window._PFM_TIMING");
119-
data = data.replace(' ;', '');
120-
data = data.replace(/\s+/g,'');
121-
data = JSON.parse(data);
122-
118+
data = JSON.parse(data.match(/window\.cartData = ([^;]*)/)[1])
123119
$.areaId = data.areaId; // locationId的传值
124120
$.traceId = data.traceId; // traceid的传值
125121
venderCart = data.cart.venderCart;
@@ -208,13 +204,6 @@ function removeCart() {
208204
})
209205
}
210206

211-
function getSubstr(str, leftStr, rightStr) {
212-
let left = str.indexOf(leftStr);
213-
let right = str.indexOf(rightStr, left);
214-
if (left < 0 || right < left) return '';
215-
return str.substring(left + leftStr.length, right);
216-
}
217-
218207
function TotalBean() {
219208
return new Promise(async resolve => {
220209
const options = {

0 commit comments

Comments
 (0)