q-koa 13.8.21 → 13.8.23

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.
@@ -57,8 +57,8 @@ exports.push = async ({ app, appName = '通知', url, message }) => {
57
57
  : {
58
58
  url: encodeURIComponent(
59
59
  url ||
60
- `${app.appConfig && app.appConfig.ip}:${
61
- app.appConfig && app.appConfig.port
60
+ `${app && app.appConfig && app.appConfig.ip}:${
61
+ app && app.appConfig && app.appConfig.port
62
62
  }`
63
63
  ),
64
64
  }),
@@ -229,11 +229,11 @@ exports.login = async (ctx) => {
229
229
 
230
230
  if (
231
231
  result.updated_at &&
232
- moment().diff(moment(result.updated_at), 'hours') > 24
232
+ Date.now() - new Date(result.updated_at).getTime() > 24 * 3600 * 1000
233
233
  ) {
234
234
  app.model.user.upsert({
235
235
  id: result.id,
236
- updated_at: moment(),
236
+ updated_at: new Date(),
237
237
  })
238
238
  }
239
239
 
@@ -420,11 +420,9 @@ exports.checkLogin = async (ctx) => {
420
420
  }
421
421
 
422
422
  if (config.includes('mp')) {
423
- const appConfig = getConfig(app)
424
- const { app_id } = await appConfig.getObject(config)
425
423
  if (
426
424
  !result.mp_user ||
427
- (result.mp_user.appid && result.mp_user.appid !== app_id)
425
+ (result.mp_user.appid && result.mp_user.appid !== appid)
428
426
  ) {
429
427
  return ctx.SUCCESS({
430
428
  token: null,
@@ -432,11 +430,9 @@ exports.checkLogin = async (ctx) => {
432
430
  })
433
431
  }
434
432
  } else if (config.includes('h5')) {
435
- const appConfig = getConfig(app)
436
- const { app_id } = await appConfig.getObject(config)
437
433
  if (
438
434
  !result.h5_user ||
439
- (result.h5_user.appid && result.h5_user.appid !== app_id)
435
+ (result.h5_user.appid && result.h5_user.appid !== appid)
440
436
  ) {
441
437
  return ctx.SUCCESS({
442
438
  token: null,
@@ -481,11 +477,11 @@ exports.checkLogin = async (ctx) => {
481
477
 
482
478
  if (
483
479
  result.updated_at &&
484
- moment().diff(moment(result.updated_at), 'hours') > 24
480
+ Date.now() - new Date(result.updated_at).getTime() > 24 * 3600 * 1000
485
481
  ) {
486
482
  app.model.user.upsert({
487
483
  id: result.id,
488
- updated_at: moment(),
484
+ updated_at: new Date(),
489
485
  })
490
486
  }
491
487
  return ctx.SUCCESS({
@@ -551,11 +551,11 @@ exports.mp_login = async (ctx) => {
551
551
 
552
552
  if (
553
553
  result.updated_at &&
554
- moment().diff(moment(result.updated_at), 'hours') > 24
554
+ Date.now() - new Date(result.updated_at).getTime() > 24 * 3600 * 1000
555
555
  ) {
556
556
  app.model.user.upsert({
557
557
  id: result.id,
558
- updated_at: moment(),
558
+ updated_at: new Date(),
559
559
  })
560
560
  }
561
561
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.8.21",
3
+ "version": "13.8.23",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {