eprolo-cli 1.0.77 → 1.0.81
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 +31 -0
- package/package.json +1 -1
package/bin/eprolo-cli.js
CHANGED
|
@@ -7,6 +7,7 @@ const path = require("path");
|
|
|
7
7
|
const https = require("https");
|
|
8
8
|
|
|
9
9
|
const LOGIN_API = "https://wixtest.eprolo.com/v1/auth/verifyCode.stm";
|
|
10
|
+
const BASE_URL = "https://wixtest.eprolo.com";
|
|
10
11
|
const REFRESH_API = "https://wixtest.eprolo.com/v1/auth/refresh-code";
|
|
11
12
|
const ORDERS_API = "https://wixtest.eprolo.com/order_list.html";
|
|
12
13
|
const PRODUCT_TYPE_API = "https://wixtest.eprolo.com/getproduct.html";
|
|
@@ -229,6 +230,28 @@ async function queryProductList() {
|
|
|
229
230
|
console.log(JSON.stringify(data, null, 2));
|
|
230
231
|
process.exit(0);
|
|
231
232
|
}
|
|
233
|
+
async function insertProduct(argv) {
|
|
234
|
+
console.log('insertProduct66',argv);
|
|
235
|
+
const config = readConfig();
|
|
236
|
+
if (!argv) {
|
|
237
|
+
console.error(JSON.stringify({ success: false, errorMessage: "缺少产品 JSON 字符串" }));
|
|
238
|
+
process.exit(1);
|
|
239
|
+
}
|
|
240
|
+
const data = await postJsonWithRetry(`${BASE_URL}/insert_product.html`, JSON.parse(argv), config, "POST");
|
|
241
|
+
console.log(JSON.stringify(data, null, 2));
|
|
242
|
+
process.exit(0);
|
|
243
|
+
}
|
|
244
|
+
async function addOrder(argv) {
|
|
245
|
+
console.log('addOrder', JSON.stringify(argv, null, 2));
|
|
246
|
+
const config = readConfig();
|
|
247
|
+
if (!argv) {
|
|
248
|
+
console.error(JSON.stringify({ success: false, errorMessage: "缺少订单 JSON 字符串" }));
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
const data = await postJsonWithRetry(`${BASE_URL}/add_order.html`, JSON.parse(argv), config, "POST");
|
|
252
|
+
console.log(JSON.stringify(data, null, 2));
|
|
253
|
+
process.exit(0);
|
|
254
|
+
}
|
|
232
255
|
// ---------------------------------------------------------------------------
|
|
233
256
|
// help
|
|
234
257
|
// ---------------------------------------------------------------------------
|
|
@@ -303,6 +326,14 @@ async function main() {
|
|
|
303
326
|
await queryProductList();
|
|
304
327
|
return;
|
|
305
328
|
}
|
|
329
|
+
if (argv[0] === "insert-product") {
|
|
330
|
+
await insertProduct(argv.slice(1));
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (argv[0] === "add-order") {
|
|
334
|
+
await addOrder(argv.slice(1));
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
306
337
|
printHelp();
|
|
307
338
|
}
|
|
308
339
|
|
package/package.json
CHANGED