eprolo-cli 1.0.45 → 1.0.46

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 +23 -0
  2. package/package.json +1 -1
package/bin/eprolo-cli.js CHANGED
@@ -8,6 +8,7 @@ const https = require("https");
8
8
 
9
9
  const LOGIN_API = "https://wixtest.eprolo.com/v1/auth/verify-code";
10
10
  const REFRESH_API = "https://wixtest.eprolo.com/v1/auth/refresh-code";
11
+ const ORDERS_API = "https://wixtest.eprolo.com/test/orders";
11
12
  const CONFIG_DIR = path.join(os.homedir(), ".eprolo-toolkit");
12
13
  const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
13
14
 
@@ -178,6 +179,22 @@ function authLogout() {
178
179
  process.exit(0);
179
180
  }
180
181
 
182
+ // ---------------------------------------------------------------------------
183
+ // orders query — 查询订单(带 401 自动刷新)
184
+ // ---------------------------------------------------------------------------
185
+
186
+ async function queryOrders() {
187
+ const config = readConfig();
188
+ if (!config.accessToken) {
189
+ console.error(JSON.stringify({ success: false, errorMessage: "未授权,请先登录" }));
190
+ process.exit(1);
191
+ }
192
+
193
+ const data = await postJsonWithRetry(ORDERS_API, {}, config);
194
+ console.log(JSON.stringify(data, null, 2));
195
+ process.exit(0);
196
+ }
197
+
181
198
  // ---------------------------------------------------------------------------
182
199
  // help
183
200
  // ---------------------------------------------------------------------------
@@ -189,6 +206,7 @@ Usage:
189
206
  eprolo-cli auth login [--default-shop <shop>] 登录并写凭据文件(框架通过 env 注入 EPROLO_USER_CODE)
190
207
  eprolo-cli auth status 查看授权状态
191
208
  eprolo-cli auth logout 退出授权
209
+ eprolo-cli orders 查询订单列表
192
210
 
193
211
  Authorization:
194
212
  框架通过 fieldInjection 把表单值递交给 CLI:
@@ -235,6 +253,11 @@ async function main() {
235
253
  return;
236
254
  }
237
255
 
256
+ if (argv[0] === "orders") {
257
+ await queryOrders();
258
+ return;
259
+ }
260
+
238
261
  printHelp();
239
262
  }
240
263
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eprolo-cli",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
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"