q-koa 10.1.1 → 10.1.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const md5 = require('js-md5')
|
|
2
|
-
const { getAppByCtx, getConfig, lodash } = require('q-koa')
|
|
2
|
+
const { getAppByCtx, getConfig, lodash, moment } = require('q-koa')
|
|
3
3
|
const { getAppConfig } = require('../../utils')
|
|
4
4
|
|
|
5
5
|
exports.login = async (ctx) => {
|
|
@@ -395,6 +395,16 @@ exports.checkLogin = async (ctx) => {
|
|
|
395
395
|
const token = await app.sign({
|
|
396
396
|
user: tokenResult,
|
|
397
397
|
})
|
|
398
|
+
|
|
399
|
+
if (
|
|
400
|
+
result.updated_at &&
|
|
401
|
+
moment().diff(moment(result.updated_at), 'hours') > 24
|
|
402
|
+
) {
|
|
403
|
+
app.model.user.upsert({
|
|
404
|
+
id: result.id,
|
|
405
|
+
updated_at: moment(),
|
|
406
|
+
})
|
|
407
|
+
}
|
|
398
408
|
return ctx.SUCCESS({
|
|
399
409
|
token,
|
|
400
410
|
user: app.appConfig.loginData
|