q-koa 10.8.3 → 10.8.5

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
@@ -340,7 +340,17 @@ class APP {
340
340
  let dirList = await fsPromise.readdir(
341
341
  path.resolve(__dirname, `${rootDirectory}/${APP_DIR}`)
342
342
  )
343
- dirList = dirList.filter((item) => this.config.includes.includes(item))
343
+ const includeList = this.config.includes.filter(Boolean).map((item) => {
344
+ if (typeof item === 'string') {
345
+ return {
346
+ app: item,
347
+ db: item,
348
+ }
349
+ } else {
350
+ return item
351
+ }
352
+ })
353
+ dirList = dirList.filter((item) => includeList.some((i) => i.app === item))
344
354
 
345
355
  let dbFlag = false
346
356
  for (let i = 0; i < dirList.length; i++) {
@@ -362,7 +372,9 @@ class APP {
362
372
  )
363
373
 
364
374
  try {
365
- const dbName = this.config.db.name || appName
375
+ const target = includeList.find((i) => i.app === appName)
376
+ const dbName =
377
+ (target ? target.db : '') || this.config.db.name || appName
366
378
  const db = connectDatabase(dbName)(this.config.db)
367
379
  if (!is_dev) {
368
380
  if (!dbFlag) {
@@ -198,6 +198,16 @@ exports.login = async (ctx) => {
198
198
  user: tokenResult,
199
199
  })
200
200
 
201
+ if (
202
+ result.updated_at &&
203
+ moment().diff(moment(result.updated_at), 'hours') > 24
204
+ ) {
205
+ app.model.user.upsert({
206
+ id: result.id,
207
+ updated_at: moment(),
208
+ })
209
+ }
210
+
201
211
  return ctx.SUCCESS({
202
212
  token,
203
213
  user: app.appConfig.loginData
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "10.8.3",
3
+ "version": "10.8.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {