q-koa 12.5.6 → 12.5.7

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/config.js CHANGED
@@ -107,7 +107,7 @@ module.exports = {
107
107
  jwt: {
108
108
  secret: 'token',
109
109
  tokenKey: 'token',
110
- expiresIn: '60480000',
110
+ expiresIn: '172800000',
111
111
  whiteList: [], // 应用覆盖
112
112
  _whiteList: [
113
113
  '/',
@@ -1,5 +1,4 @@
1
- const { Sequelize, Random } = require('q-koa');
2
-
1
+ const { Sequelize, Random } = require('q-koa')
3
2
 
4
3
  exports.name = {
5
4
  type: Sequelize.STRING,
@@ -31,7 +30,7 @@ exports.desc = {
31
30
  defaultValue: '',
32
31
  sortOrder: 3,
33
32
  mock: () => Random.csentence(),
34
- extra: {"type":"markdown"},
33
+ extra: { type: 'markdown' },
35
34
  }
36
35
 
37
36
  exports.role_id = {
@@ -54,7 +53,6 @@ exports.sortOrder = {
54
53
  is_mock: false,
55
54
  defaultValue: 0,
56
55
  sortOrder: 5,
57
-
58
56
  }
59
57
 
60
58
  exports.is_on = {
@@ -65,5 +63,36 @@ exports.is_on = {
65
63
  defaultValue: true,
66
64
  sortOrder: 6,
67
65
  mock: () => Random.boolean(),
68
- extra: {"controlInline":true},
66
+ extra: { controlInline: true },
67
+ }
68
+
69
+ exports.extra = {
70
+ type: Sequelize.JSON,
71
+ comment: '额外数据',
72
+ allowNull: true,
73
+ is_mock: false,
74
+ defaultValue: {},
75
+ sortOrder: 7,
76
+ set: function (value) {
77
+ try {
78
+ const dataValue = typeof value === 'object' ? value : JSON.parse(value)
79
+ this.setDataValue('extra', dataValue)
80
+ } catch {
81
+ throw new Error('extra值不合法')
82
+ }
83
+ },
84
+ get: function () {
85
+ const value = this.getDataValue('extra')
86
+ try {
87
+ const dataValue =
88
+ typeof value === 'object' ? value || {} : JSON.parse(value)
89
+
90
+ return dataValue
91
+ } catch {
92
+ return {
93
+ text: value,
94
+ }
95
+ }
96
+ },
97
+ extra: { type: 'json-editor' },
69
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "12.5.6",
3
+ "version": "12.5.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {