eprolo-cli 1.0.109 → 1.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/eprolo-cli.js +23 -18
- package/package.json +1 -1
package/bin/eprolo-cli.js
CHANGED
|
@@ -254,13 +254,13 @@ async function insertProduct(arg) {
|
|
|
254
254
|
title: variant.title,
|
|
255
255
|
sku: variant.sku
|
|
256
256
|
};
|
|
257
|
-
if(variant.selectedOptions && variant.selectedOptions.length > 0){
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
if (variant.selectedOptions && variant.selectedOptions.length > 0) {
|
|
258
|
+
variant.selectedOptions.forEach((option, optionIndex) => {
|
|
259
|
+
if (index == 0) {
|
|
260
|
+
optionList.push({ name: option.name });
|
|
261
|
+
}
|
|
262
|
+
newInfo['option' + optionIndex] = option.name;
|
|
263
|
+
})
|
|
264
264
|
}
|
|
265
265
|
variantsList.push(newInfo);
|
|
266
266
|
})
|
|
@@ -275,29 +275,29 @@ async function insertProduct(arg) {
|
|
|
275
275
|
if (data.data.msg == "product_id exist") {
|
|
276
276
|
const result = await postJsonWithRetry(BASE_URL + '/getproduct.html', { product_id: info.product_id }, config, "GET");
|
|
277
277
|
if (result.data.code == 0) {
|
|
278
|
-
console.log(
|
|
278
|
+
console.log({
|
|
279
279
|
variantlist: result.data.data.variantlist.map((item) => {
|
|
280
280
|
return {
|
|
281
281
|
variantsid: item.id,
|
|
282
282
|
sku: item.sku
|
|
283
283
|
}
|
|
284
284
|
})
|
|
285
|
-
}
|
|
285
|
+
});
|
|
286
286
|
process.exit(0);
|
|
287
287
|
}
|
|
288
288
|
} else {
|
|
289
|
-
console.log(
|
|
289
|
+
console.log(data);
|
|
290
290
|
process.exit(0);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
console.log(
|
|
293
|
+
console.log({
|
|
294
294
|
variantlist: data.data.data.variantsList.map((item) => {
|
|
295
295
|
return {
|
|
296
296
|
variantsid: item.id,
|
|
297
297
|
sku: item.sku
|
|
298
298
|
}
|
|
299
299
|
})
|
|
300
|
-
}
|
|
300
|
+
});
|
|
301
301
|
process.exit(0);
|
|
302
302
|
}
|
|
303
303
|
async function addOrder(arg) {
|
|
@@ -324,16 +324,21 @@ async function addOrder(arg) {
|
|
|
324
324
|
}
|
|
325
325
|
if (order.lineItems && order.lineItems.edges) {
|
|
326
326
|
order.lineItems.edges.forEach((edge) => {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
console.log("-------666----------", order.lineItems.eproloSyncResult[edge.node.product.id].message);
|
|
328
|
+
let newOrderItemlist = { quantity: edge.node.quantity }
|
|
329
|
+
let messageResult = order.lineItems.eproloSyncResult[edge.node.product.id].message;
|
|
330
|
+
if (messageResult) {
|
|
331
|
+
let newMessage = JSON.parse(messageResult);
|
|
332
|
+
newOrderItemlist.variantsid = newMessage.variantlist.find((item) => item.sku == edge.node.sku).variantsid;
|
|
333
|
+
}
|
|
334
|
+
orderItemlist.push(newOrderItemlist)
|
|
331
335
|
})
|
|
332
336
|
newOrder.orderItemlist = orderItemlist;
|
|
333
337
|
}
|
|
334
338
|
console.log("-------222----------", newOrder);
|
|
335
|
-
const data = await postJsonWithRetry(`http://43.153.35.208:3000/addInfo`, newOrder, config, "POST");
|
|
336
|
-
|
|
339
|
+
// const data = await postJsonWithRetry(`http://43.153.35.208:3000/addInfo`, newOrder, config, "POST");
|
|
340
|
+
const data = await postJsonWithRetry(BASE_URL + '/add_order.html', newOrder, config, "POST");
|
|
341
|
+
console.log(data);
|
|
337
342
|
process.exit(0);
|
|
338
343
|
}
|
|
339
344
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED