q-koa 13.8.14 → 13.8.16

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/core/app.js CHANGED
@@ -214,8 +214,17 @@ class APP {
214
214
  }
215
215
 
216
216
  /**
217
- * jwt sign 方法已在 initApp 时定义,此处跳过
217
+ * 挂在jwt解密方法
218
218
  */
219
+ if (this.app[appName]) {
220
+ this.app[appName].sign = async (user) => {
221
+ const result = await jwt.sign(user, secret, {
222
+ expiresIn,
223
+ algorithm: 'HS256',
224
+ })
225
+ return result
226
+ }
227
+ }
219
228
  // eslint-disable-next-line no-nested-ternary
220
229
  ctx.request.clientType = ctx.header['client-type']
221
230
  ? Number(ctx.header['client-type'])
@@ -509,12 +518,6 @@ class APP {
509
518
  { appName, ip: this.config.ip, port: this.port }
510
519
  ),
511
520
  }
512
- const jwtCfg = this.app[appName].appConfig.jwt
513
- this.app[appName].sign = (user) =>
514
- jwt.sign(user, jwtCfg.secret, {
515
- expiresIn: jwtCfg.expiresIn,
516
- algorithm: 'HS256',
517
- })
518
521
  } else {
519
522
  this.app[appName] = {
520
523
  sequelize: db,
@@ -525,12 +528,6 @@ class APP {
525
528
  { appName, ip: this.config.ip, port: this.port }
526
529
  ),
527
530
  }
528
- const jwtCfg = this.app[appName].appConfig.jwt
529
- this.app[appName].sign = (user) =>
530
- jwt.sign(user, jwtCfg.secret, {
531
- expiresIn: jwtCfg.expiresIn,
532
- algorithm: 'HS256',
533
- })
534
531
  }
535
532
 
536
533
  // const proxyConfig = _.get(this.app[appName], 'appConfig.proxy');
@@ -1411,11 +1411,6 @@ exports.union_notify = async (ctx) => {
1411
1411
  try {
1412
1412
  const notifyData = ctx.request.body
1413
1413
 
1414
- app.service.log.push({
1415
- app,
1416
- message: JSON.stringify(notifyData),
1417
- })
1418
-
1419
1414
  const {
1420
1415
  trxcode,
1421
1416
  trxstatus,
@@ -1488,6 +1483,11 @@ exports.union_notify = async (ctx) => {
1488
1483
  refundid: trxid,
1489
1484
  })
1490
1485
  }
1486
+ } else {
1487
+ app.service.log.push({
1488
+ app,
1489
+ message: JSON.stringify(notifyData),
1490
+ })
1491
1491
  }
1492
1492
  } else {
1493
1493
  app.service.log.push({
@@ -133,7 +133,7 @@ class AllinPay {
133
133
  console.error('Response status:', error.response.status)
134
134
  console.error('Response data:', JSON.stringify(error.response.data))
135
135
  }
136
- throw new Error(`AllinPay request error: ${error.message}`)
136
+ throw new Error(error.message)
137
137
  }
138
138
  }
139
139
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.8.14",
3
+ "version": "13.8.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {