eprolo-cli 1.0.101 → 1.0.103

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 CHANGED
@@ -54,10 +54,10 @@ function postJson(url, body, headers = {},method = "POST") {
54
54
  signValue.timestamp = config.timestamp;
55
55
  signValue.sign = config.accessToken;
56
56
  }
57
- url += "?" + new URLSearchParams(signValue).toString();
58
- if(method == "GET") {
59
- body = {};
57
+ if(method == "GET") {
58
+ signValue = {...signValue, ...body};
60
59
  }
60
+ url += "?" + new URLSearchParams(signValue).toString();
61
61
  return new Promise((resolve, reject) => {
62
62
  const target = new URL(url);
63
63
  const payload = JSON.stringify(body);
@@ -265,13 +265,16 @@ async function insertProduct(arg) {
265
265
  imageList.push({src:edge.url,images_id:getId(edge.id)});
266
266
  })
267
267
  const data = await postJsonWithRetry(BASE_URL+'/insert_product.html', info, config, "POST");
268
- if(data.data.code==-1){
268
+ if(data.data.code=='-1'){
269
269
  if(data.data.msg=="product_id exist"){
270
270
  const result = await postJsonWithRetry(BASE_URL+'/getproduct.html', {product_id:info.product_id}, config);
271
271
  if(result.data.code==0){
272
272
  console.log(JSON.stringify({product_id:result.data.data.id}, null, 2));
273
273
  process.exit(0);
274
274
  }
275
+ }else{
276
+ console.log(JSON.stringify(data, null, 2));
277
+ process.exit(0);
275
278
  }
276
279
  }
277
280
  console.log(JSON.stringify({product_id:data.data.data.id}, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eprolo-cli",
3
- "version": "1.0.101",
3
+ "version": "1.0.103",
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"