q-koa 8.0.6 → 8.1.0

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
@@ -179,7 +179,7 @@ class APP {
179
179
  ctx.cookies.get(`${appName}-${tokenKey}`) ||
180
180
  ctx.query[`${appName}-${tokenKey}`]
181
181
 
182
- if (url.length > 2) {
182
+ if (url.length > 2 && this.config.log.request) {
183
183
  console.log(
184
184
  moment().format('HH:mm:ss'),
185
185
  url,
@@ -191,7 +191,9 @@ class APP {
191
191
  try {
192
192
  const { user } = await verify(token, secret)
193
193
  if (user) {
194
- console.log('user id ---> ', appName, '--->', user.id, user.name)
194
+ if (this.config.log.request) {
195
+ console.log('user id ---> ', appName, '--->', user.id, user.name)
196
+ }
195
197
  ctx.request[`${appName}-user`] = user
196
198
  }
197
199
  } catch (e) {
@@ -344,9 +346,9 @@ class APP {
344
346
  }
345
347
 
346
348
  // const proxyConfig = _.get(this.app[appName], 'appConfig.proxy');
347
- const taskConfig = _.get(this.app[appName], 'appConfig.task', {
348
- is_available: false,
349
- })
349
+ // const taskConfig = _.get(this.app[appName], 'appConfig.task', {
350
+ // is_available: false,
351
+ // })
350
352
  // if (proxyConfig) {
351
353
  // this.app.use(proxy(`/${appName}`, proxyConfig));
352
354
  // }
@@ -375,9 +377,9 @@ class APP {
375
377
 
376
378
  await this.initModel(appName)
377
379
  // const models = Object.keys(this.app[appName].model).join(' / ')
378
- if (taskConfig.is_available) {
379
- this.initTask(appName)
380
- }
380
+ // if (taskConfig.is_available) {
381
+ // this.initTask(appName)
382
+ // }
381
383
  } catch (e) {
382
384
  console.log(`${appName}数据库连接失败`)
383
385
  console.log(e)
package/core/config.js CHANGED
@@ -5,6 +5,9 @@ module.exports = {
5
5
  static: {
6
6
  dir: 'public',
7
7
  },
8
+ log: {
9
+ request: true,
10
+ },
8
11
  task: {
9
12
  dir: 'task',
10
13
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "8.0.6",
3
+ "version": "8.1.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {