eprolo-cli 1.0.111 → 1.0.113
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 +12 -8
- package/package.json +1 -1
package/bin/eprolo-cli.js
CHANGED
|
@@ -9,9 +9,6 @@ const http = require("http");
|
|
|
9
9
|
const LOGIN_API = "https://wixtest.eprolo.com/v1/auth/verifyCode.stm";
|
|
10
10
|
const BASE_URL = "https://wixtest.eprolo.com";
|
|
11
11
|
const REFRESH_API = "https://wixtest.eprolo.com/v1/auth/refresh-code";
|
|
12
|
-
const ORDERS_API = "https://wixtest.eprolo.com/order_list.html";
|
|
13
|
-
const PRODUCT_TYPE_API = "https://wixtest.eprolo.com/getproduct.html";
|
|
14
|
-
const PRODUCT_LIST_API = "https://wixtest.eprolo.com/product_list.html";
|
|
15
12
|
const CONFIG_DIR = path.join(os.homedir(), ".eprolo-toolkit");
|
|
16
13
|
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
17
14
|
|
|
@@ -192,13 +189,13 @@ async function queryOrders(orderId) {
|
|
|
192
189
|
console.error(JSON.stringify({ success: false, errorMessage: "缺少订单 ID" }));
|
|
193
190
|
process.exit(1);
|
|
194
191
|
}
|
|
195
|
-
const data = await postJsonWithRetry(
|
|
192
|
+
const data = await postJsonWithRetry(BASE_URL+"/order.html?page_index=0&page_size=1&order_id="+orderId, {}, config, "GET");
|
|
196
193
|
console.log(JSON.stringify(data, null, 2));
|
|
197
194
|
process.exit(0);
|
|
198
195
|
}
|
|
199
196
|
async function queryOrderList() {
|
|
200
197
|
const config = readConfig();
|
|
201
|
-
const data = await postJsonWithRetry(
|
|
198
|
+
const data = await postJsonWithRetry(BASE_URL+"/order_list.html?page_index=0&page_size=10", {}, config, "GET");
|
|
202
199
|
console.log(JSON.stringify(data, null, 2));
|
|
203
200
|
process.exit(0);
|
|
204
201
|
}
|
|
@@ -208,13 +205,13 @@ async function queryProductId(productId) {
|
|
|
208
205
|
console.error(JSON.stringify({ success: false, errorMessage: "缺少产品 ID" }));
|
|
209
206
|
process.exit(1);
|
|
210
207
|
}
|
|
211
|
-
const data = await postJsonWithRetry(
|
|
208
|
+
const data = await postJsonWithRetry(BASE_URL+"/getproduct.html?id="+productId, {}, config, "GET");
|
|
212
209
|
console.log(JSON.stringify(data, null, 2));
|
|
213
210
|
process.exit(0);
|
|
214
211
|
}
|
|
215
212
|
async function queryProductList() {
|
|
216
213
|
const config = readConfig();
|
|
217
|
-
const data = await postJsonWithRetry(
|
|
214
|
+
const data = await postJsonWithRetry(BASE_URL+"/product_list.html?page_index=0&page_size=10", {}, config, "GET");
|
|
218
215
|
console.log(JSON.stringify(data, null, 2));
|
|
219
216
|
process.exit(0);
|
|
220
217
|
}
|
|
@@ -352,7 +349,10 @@ Usage:
|
|
|
352
349
|
eprolo-cli auth login [--default-shop <shop>] 登录并写凭据文件(框架通过 env 注入 EPROLO_USER_CODE)
|
|
353
350
|
eprolo-cli auth status 查看授权状态
|
|
354
351
|
eprolo-cli auth logout 退出授权
|
|
352
|
+
eprolo-cli product <product_id> 查询产品详情
|
|
353
|
+
eprolo-cli product-list 查询产品列表
|
|
355
354
|
eprolo-cli orders 查询订单列表
|
|
355
|
+
eprolo-cli list 查询订单列表
|
|
356
356
|
eprolo-cli add-order <order> 提交订单
|
|
357
357
|
eprolo-cli insert-product <product> 插入产品
|
|
358
358
|
Authorization:
|
|
@@ -384,7 +384,11 @@ Credential file (~/.eprolo-toolkit/config.json):
|
|
|
384
384
|
|
|
385
385
|
async function main() {
|
|
386
386
|
const argv = process.argv.slice(2);
|
|
387
|
-
|
|
387
|
+
const [group, command] = args._;
|
|
388
|
+
if (!group || args.help || args.h) {
|
|
389
|
+
printHelp();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
388
392
|
if (argv[0] === "auth" && argv[1] === "login") {
|
|
389
393
|
await login(argv.slice(2));
|
|
390
394
|
return;
|
package/package.json
CHANGED