q-koa 8.4.3 → 8.4.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
@@ -68,6 +68,7 @@ const connectDatabase = (database) => (config) => {
68
68
 
69
69
  const defaultConfig = require('./config')
70
70
 
71
+ const is_dev = process.env.NODE_ENV !== 'production'
71
72
  class APP {
72
73
  constructor(_config) {
73
74
  const config = _.defaultsDeep(_config, defaultConfig)
@@ -299,7 +300,7 @@ class APP {
299
300
  appName: appName,
300
301
  })
301
302
  }
302
- if (process.env.NODE_ENV === 'production') {
303
+ if (!is_dev) {
303
304
  process.on('SIGINT', () => {
304
305
  console.log('Closing server...')
305
306
  this.server.close(() => {
@@ -338,7 +339,7 @@ class APP {
338
339
 
339
340
  try {
340
341
  const db = connectDatabase(appName)(this.config.db)
341
- if (process.env.NODE_ENV === 'production') {
342
+ if (!is_dev) {
342
343
  if (!dbFlag) {
343
344
  console.log(chalk.green(`检查${appName}数据库`))
344
345
  await db.authenticate()
@@ -1741,7 +1742,9 @@ class APP {
1741
1742
  if (_.get(app, `${appName}.afterExecute.${controller}.${fn}`)) {
1742
1743
  app[appName].afterExecute[controller][fn](ctx)
1743
1744
  .then((res) => {
1744
- console.log('afterUpdate', res)
1745
+ if (is_dev) {
1746
+ console.log('afterUpdate', res)
1747
+ }
1745
1748
  })
1746
1749
  .catch((e) => {
1747
1750
  console.log('错误', e)
package/core/config.js CHANGED
@@ -5,6 +5,7 @@ module.exports = {
5
5
  static: {
6
6
  dir: 'public',
7
7
  },
8
+ is_check_admin: false,
8
9
  log: {
9
10
  request: true,
10
11
  },
@@ -107,7 +107,7 @@ exports.loadModel = async ({ app, appName }) => {
107
107
  defaultValue = `${model[name].defaultValue}`
108
108
  }
109
109
  if (Array.isArray(model[name].defaultValue)) {
110
- defaultValue = '[]'
110
+ defaultValue = JSON.stringify(model[name].defaultValue)
111
111
  }
112
112
  if (
113
113
  Object.prototype.toString.call(model[name].defaultValue) ===
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "8.4.3",
3
+ "version": "8.4.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {