eprolo-cli 1.0.100 → 1.0.101
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 +11 -3
- package/package.json +1 -1
package/bin/eprolo-cli.js
CHANGED
|
@@ -236,7 +236,6 @@ function getId(id){
|
|
|
236
236
|
}
|
|
237
237
|
async function insertProduct(arg) {
|
|
238
238
|
const config = readConfig();
|
|
239
|
-
console.log('insertProduct666-----------------------------6',arg);
|
|
240
239
|
const product = JSON.parse(arg);
|
|
241
240
|
const info={};
|
|
242
241
|
const optionList=[];
|
|
@@ -265,8 +264,17 @@ async function insertProduct(arg) {
|
|
|
265
264
|
product.media.edges.forEach((edge)=>{
|
|
266
265
|
imageList.push({src:edge.url,images_id:getId(edge.id)});
|
|
267
266
|
})
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
const data = await postJsonWithRetry(BASE_URL+'/insert_product.html', info, config, "POST");
|
|
268
|
+
if(data.data.code==-1){
|
|
269
|
+
if(data.data.msg=="product_id exist"){
|
|
270
|
+
const result = await postJsonWithRetry(BASE_URL+'/getproduct.html', {product_id:info.product_id}, config);
|
|
271
|
+
if(result.data.code==0){
|
|
272
|
+
console.log(JSON.stringify({product_id:result.data.data.id}, null, 2));
|
|
273
|
+
process.exit(0);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
console.log(JSON.stringify({product_id:data.data.data.id}, null, 2));
|
|
270
278
|
process.exit(0);
|
|
271
279
|
}
|
|
272
280
|
async function addOrder(arg) {
|
package/package.json
CHANGED