eprolo-cli 1.0.100 → 1.0.102

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.
Files changed (2) hide show
  1. package/bin/eprolo-cli.js +14 -3
  2. 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,20 @@ 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
- const data = await postJsonWithRetry(BASE_URL+'/insert_product.html', info, config, "POST");
269
- console.log(JSON.stringify(data, null, 2));
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
+ }else{
276
+ console.log(JSON.stringify(data, null, 2));
277
+ process.exit(0);
278
+ }
279
+ }
280
+ console.log(JSON.stringify({product_id:data.data.data.id}, null, 2));
270
281
  process.exit(0);
271
282
  }
272
283
  async function addOrder(arg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eprolo-cli",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
4
4
  "description": "CLI for Dianxiaobao ICBU AI publishing, authorization profile management, task submission, and task status checks.",
5
5
  "bin": {
6
6
  "eprolo": "bin/eprolo-cli.js"