eprolo-cli 1.0.124 → 1.0.126

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 +29 -5
  2. package/package.json +1 -1
package/bin/eprolo-cli.js CHANGED
@@ -209,9 +209,13 @@ async function queryProductId(productId) {
209
209
  console.log(JSON.stringify(data, null, 2));
210
210
  process.exit(0);
211
211
  }
212
- async function queryProductList() {
212
+ async function queryProductList(title) {
213
+ let params = {title: title,page:1,limitSize:10};
214
+ if (title) {
215
+ params.title=title;
216
+ }
213
217
  const config = readConfig();
214
- const data = await postJsonWithRetry(BASE_URL+"/product_list.html", {page_index: 0, page_size: 10}, config, "GET");
218
+ const data = await postJsonWithRetry("https://eprolo.com/app/getProductByCatId.html", params, config, "GET");
215
219
  console.log(JSON.stringify(data, null, 2));
216
220
  process.exit(0);
217
221
  }
@@ -297,6 +301,17 @@ async function insertProduct(arg) {
297
301
  });
298
302
  process.exit(0);
299
303
  }
304
+ async function placeOrder(arg) {
305
+
306
+ }
307
+ // 修改订单地址
308
+ async function modifyOrderAddress(arg){
309
+ const config = readConfig();
310
+ const product = JSON.parse(arg);
311
+ const result = await postJsonWithRetry(BASE_URL + '/modify_order_address.html',product , config, "POST");
312
+ console.log(JSON.stringify(result, null, 2));
313
+ process.exit(0);
314
+ }
300
315
  async function addOrder(arg) {
301
316
  const config = readConfig();
302
317
  const order = JSON.parse(arg);
@@ -353,8 +368,9 @@ Usage:
353
368
  eprolo-cli product-list 查询产品列表
354
369
  eprolo-cli orders 查询订单列表
355
370
  eprolo-cli list 查询订单列表
356
- eprolo-cli add-order <order> 提交订单
357
- eprolo-cli insert-product <product> 插入产品
371
+ eprolo-cli add-order <order> 提交订单
372
+ eprolo-cli modify-order-address <order> 修改订单地址
373
+ eprolo-cli insert-product <product> 插入产品
358
374
  Authorization:
359
375
  框架通过 fieldInjection 把表单值递交给 CLI:
360
376
  userCode → env 通道 → process.env.EPROLO_USER_CODE
@@ -416,7 +432,7 @@ async function main() {
416
432
  return;
417
433
  }
418
434
  if (argv[0] === "product-list" ) {
419
- await queryProductList();
435
+ await queryProductList(argv[1]);
420
436
  return;
421
437
  }
422
438
  if (argv[0] === "insert-product" ) {
@@ -427,6 +443,14 @@ async function main() {
427
443
  await addOrder(argv[1]);
428
444
  return;
429
445
  }
446
+ if (argv[0] === "place-order" ) {
447
+ await placeOrder(argv[1]);
448
+ return;
449
+ }
450
+ if (argv[0] === "modify-order-address" ) {
451
+ await modifyOrderAddress(argv[1]);
452
+ return;
453
+ }
430
454
  printHelp();
431
455
  }
432
456
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eprolo-cli",
3
- "version": "1.0.124",
3
+ "version": "1.0.126",
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"