eprolo-cli 1.0.123 → 1.0.125
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 +17 -6
- package/package.json +1 -1
package/bin/eprolo-cli.js
CHANGED
|
@@ -6,9 +6,9 @@ const os = require("os");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const https = require("https");
|
|
8
8
|
const http = require("http");
|
|
9
|
-
const LOGIN_API = "https://
|
|
10
|
-
const BASE_URL = "https://
|
|
11
|
-
const REFRESH_API = "https://
|
|
9
|
+
const LOGIN_API = "https://openapi.eprolo.com/v1/auth/verifyCode.stm";
|
|
10
|
+
const BASE_URL = "https://openapi.eprolo.com";
|
|
11
|
+
const REFRESH_API = "https://openapi.eprolo.com/v1/auth/refresh-code";
|
|
12
12
|
const CONFIG_DIR = path.join(os.homedir(), ".eprolo-toolkit");
|
|
13
13
|
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
14
14
|
|
|
@@ -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(
|
|
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
|
}
|
|
@@ -296,6 +300,9 @@ async function insertProduct(arg) {
|
|
|
296
300
|
})
|
|
297
301
|
});
|
|
298
302
|
process.exit(0);
|
|
303
|
+
}
|
|
304
|
+
async function placeOrder(arg) {
|
|
305
|
+
|
|
299
306
|
}
|
|
300
307
|
async function addOrder(arg) {
|
|
301
308
|
const config = readConfig();
|
|
@@ -416,7 +423,7 @@ async function main() {
|
|
|
416
423
|
return;
|
|
417
424
|
}
|
|
418
425
|
if (argv[0] === "product-list" ) {
|
|
419
|
-
await queryProductList();
|
|
426
|
+
await queryProductList(argv[1]);
|
|
420
427
|
return;
|
|
421
428
|
}
|
|
422
429
|
if (argv[0] === "insert-product" ) {
|
|
@@ -427,6 +434,10 @@ async function main() {
|
|
|
427
434
|
await addOrder(argv[1]);
|
|
428
435
|
return;
|
|
429
436
|
}
|
|
437
|
+
if (argv[0] === "place-order" ) {
|
|
438
|
+
await placeOrder(argv[1]);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
430
441
|
printHelp();
|
|
431
442
|
}
|
|
432
443
|
|
package/package.json
CHANGED