eprolo-cli 1.0.69 → 1.0.70

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 CHANGED
@@ -6,9 +6,9 @@ const os = require("os");
6
6
  const path = require("path");
7
7
  const https = require("https");
8
8
 
9
- const LOGIN_API = "https://wixtest.eprolo.com/v1/auth/verify-code";
9
+ const LOGIN_API = "https://wixtest.eprolo.com/v1/auth/verifyCode.stm";
10
10
  const REFRESH_API = "https://wixtest.eprolo.com/v1/auth/refresh-code";
11
- const ORDERS_API = "https://wixtest.eprolo.com/test/orders";
11
+ const ORDERS_API = "https://wixtest.eprolo.com/order_list.html";
12
12
  const CONFIG_DIR = path.join(os.homedir(), ".eprolo-toolkit");
13
13
  const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
14
14
 
@@ -44,7 +44,7 @@ function readFlag(argv, flag) {
44
44
  // HTTPS POST 请求
45
45
  // ---------------------------------------------------------------------------
46
46
 
47
- function postJson(url, body, headers = {}) {
47
+ function postJson(url, body, headers = {},method = "POST") {
48
48
  return new Promise((resolve, reject) => {
49
49
  const target = new URL(url);
50
50
  const payload = JSON.stringify(body);
@@ -52,7 +52,7 @@ function postJson(url, body, headers = {}) {
52
52
  hostname: target.hostname,
53
53
  port: target.port || 443,
54
54
  path: `${target.pathname}${target.search}`,
55
- method: "POST",
55
+ method: method,
56
56
  headers: {
57
57
  "content-type": "application/json",
58
58
  "content-length": Buffer.byteLength(payload),
@@ -85,11 +85,11 @@ function postJson(url, body, headers = {}) {
85
85
  // 3. 仍然 401 → 抛错
86
86
  // ---------------------------------------------------------------------------
87
87
 
88
- async function postJsonWithRetry(url, body, config) {
88
+ async function postJsonWithRetry(url, body, config, method = "POST") {
89
89
  let headers = {};
90
- if (config.accessToken) headers["accessToken"] = `${config.accessToken}`;
90
+ if (config.apiKey) headers["apiKey"] = `${config.apiKey}`;
91
91
 
92
- let result = await postJson(url, body, headers);
92
+ let result = await postJson(url, body, headers, method);
93
93
  if (result.data.code == 400) {
94
94
  // 刷新 token
95
95
  const refreshRes = await postJson(REFRESH_API, {},{
@@ -150,7 +150,7 @@ async function login(argv) {
150
150
  }));
151
151
  process.exit(1);
152
152
  }
153
- res.data.data.openApiKey = userCode;
153
+ // res.data.data.openApiKey = userCode;
154
154
  // const { account, accessToken, accountId, shopId } = res.data;
155
155
  // const config = { account, accessToken, defaultShop, accountId, shopId, version: 1 };
156
156
  writeConfig(res.data.data);
@@ -198,7 +198,7 @@ async function queryOrders(orderId) {
198
198
  console.error(JSON.stringify({ success: false, errorMessage: "缺少订单 ID" }));
199
199
  process.exit(1);
200
200
  }
201
- const data = await postJsonWithRetry(ORDERS_API, {id:orderId}, config);
201
+ const data = await postJsonWithRetry(ORDERS_API, {id:orderId}, config, "GET");
202
202
  console.log(JSON.stringify(data, null, 2));
203
203
  process.exit(0);
204
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eprolo-cli",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
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"