eprolo-cli 1.0.68 → 1.0.69

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 +14 -2
  2. package/package.json +1 -1
package/bin/eprolo-cli.js CHANGED
@@ -105,7 +105,19 @@ async function postJsonWithRetry(url, body, config) {
105
105
  // 用新 token 重试
106
106
  headers["accessToken"] = `${config.accessToken}`;
107
107
  result = await postJson(url, body, headers);
108
- } else {
108
+ }else if (refreshRes.data.code == 400) {
109
+ const res = await postJson(LOGIN_API, { openApiKey: config.openApiKey });
110
+ if (res.data.code != 0) {
111
+ const err = new Error(`HTTP ${res.statusCode}`);
112
+ err.response = res.data.data.msg;
113
+ throw err;
114
+ }
115
+ res.data.data.openApiKey = config.openApiKey;
116
+ writeConfig(res.data.data);
117
+ headers["accessToken"] = `${res.data.data.accessToken}`;
118
+ result = await postJson(url, body, headers);
119
+ }
120
+ else {
109
121
  const err = new Error("Token 刷新失败,请重新登录授权");
110
122
  err.response = refreshRes.data;
111
123
  throw err;
@@ -138,7 +150,7 @@ async function login(argv) {
138
150
  }));
139
151
  process.exit(1);
140
152
  }
141
-
153
+ res.data.data.openApiKey = userCode;
142
154
  // const { account, accessToken, accountId, shopId } = res.data;
143
155
  // const config = { account, accessToken, defaultShop, accountId, shopId, version: 1 };
144
156
  writeConfig(res.data.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eprolo-cli",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
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"