q-koa 8.0.4 → 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 +10 -8
- package/core/config.js +3 -0
- package/package.json +2 -1
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "q-koa",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"koa-static": "^5.0.0",
|
|
41
41
|
"koa-useragent": "^4.0.0",
|
|
42
42
|
"koa-xml-body": "^2.1.0",
|
|
43
|
+
"koa-proxies": "^0.12.2",
|
|
43
44
|
"lodash": "^4.17.15",
|
|
44
45
|
"lru-cache": "^5.1.1",
|
|
45
46
|
"mockjs": "^1.0.1-beta3",
|