q-koa 10.6.5 → 10.6.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.
@@ -39,6 +39,27 @@ exports.query = {
39
39
  is_mock: false,
40
40
  defaultValue: {},
41
41
  sortOrder: 4,
42
+ set: function (value) {
43
+ try {
44
+ const dataValue = typeof value === 'object' ? value : JSON.parse(value)
45
+ this.setDataValue('query', dataValue)
46
+ } catch {
47
+ throw new Error('query值不合法')
48
+ }
49
+ },
50
+ get: function () {
51
+ try {
52
+ const value = this.getDataValue('query')
53
+ const dataValue =
54
+ typeof value === 'object' ? value || {} : JSON.parse(value)
55
+ return dataValue
56
+ } catch {
57
+ return {}
58
+ }
59
+ },
60
+ extra: {
61
+ type: 'json-editor',
62
+ },
42
63
  }
43
64
 
44
65
  exports.post = {
@@ -48,4 +69,25 @@ exports.post = {
48
69
  is_mock: false,
49
70
  defaultValue: {},
50
71
  sortOrder: 5,
72
+ set: function (value) {
73
+ try {
74
+ const dataValue = typeof value === 'object' ? value : JSON.parse(value)
75
+ this.setDataValue('post', dataValue)
76
+ } catch {
77
+ throw new Error('post值不合法')
78
+ }
79
+ },
80
+ get: function () {
81
+ try {
82
+ const value = this.getDataValue('post')
83
+ const dataValue =
84
+ typeof value === 'object' ? value || {} : JSON.parse(value)
85
+ return dataValue
86
+ } catch {
87
+ return {}
88
+ }
89
+ },
90
+ extra: {
91
+ type: 'json-editor',
92
+ },
51
93
  }
@@ -23,6 +23,27 @@ exports.header = {
23
23
  comment: 'Header',
24
24
  allowNull: false,
25
25
  defaultValue: {},
26
+ set: function (value) {
27
+ try {
28
+ const dataValue = typeof value === 'object' ? value : JSON.parse(value)
29
+ this.setDataValue('header', dataValue)
30
+ } catch {
31
+ throw new Error('header值不合法')
32
+ }
33
+ },
34
+ get: function () {
35
+ try {
36
+ const value = this.getDataValue('header')
37
+ const dataValue =
38
+ typeof value === 'object' ? value || {} : JSON.parse(value)
39
+ return dataValue
40
+ } catch {
41
+ return {}
42
+ }
43
+ },
44
+ extra: {
45
+ type: 'json-editor',
46
+ },
26
47
  }
27
48
 
28
49
  exports.body = {
@@ -30,6 +51,27 @@ exports.body = {
30
51
  comment: '参数',
31
52
  allowNull: false,
32
53
  defaultValue: {},
54
+ set: function (value) {
55
+ try {
56
+ const dataValue = typeof value === 'object' ? value : JSON.parse(value)
57
+ this.setDataValue('body', dataValue)
58
+ } catch {
59
+ throw new Error('body值不合法')
60
+ }
61
+ },
62
+ get: function () {
63
+ try {
64
+ const value = this.getDataValue('body')
65
+ const dataValue =
66
+ typeof value === 'object' ? value || {} : JSON.parse(value)
67
+ return dataValue
68
+ } catch {
69
+ return {}
70
+ }
71
+ },
72
+ extra: {
73
+ type: 'json-editor',
74
+ },
33
75
  }
34
76
 
35
77
  exports.message = {
@@ -16,6 +16,27 @@ exports.query = {
16
16
  is_mock: false,
17
17
  defaultValue: {},
18
18
  sortOrder: 2,
19
+ set: function (value) {
20
+ try {
21
+ const dataValue = typeof value === 'object' ? value : JSON.parse(value)
22
+ this.setDataValue('query', dataValue)
23
+ } catch {
24
+ throw new Error('query值不合法')
25
+ }
26
+ },
27
+ get: function () {
28
+ try {
29
+ const value = this.getDataValue('query')
30
+ const dataValue =
31
+ typeof value === 'object' ? value || {} : JSON.parse(value)
32
+ return dataValue
33
+ } catch {
34
+ return {}
35
+ }
36
+ },
37
+ extra: {
38
+ type: 'json-editor',
39
+ },
19
40
  }
20
41
 
21
42
  exports.post = {
@@ -25,6 +46,27 @@ exports.post = {
25
46
  is_mock: false,
26
47
  defaultValue: {},
27
48
  sortOrder: 3,
49
+ set: function (value) {
50
+ try {
51
+ const dataValue = typeof value === 'object' ? value : JSON.parse(value)
52
+ this.setDataValue('post', dataValue)
53
+ } catch {
54
+ throw new Error('post值不合法')
55
+ }
56
+ },
57
+ get: function () {
58
+ try {
59
+ const value = this.getDataValue('post')
60
+ const dataValue =
61
+ typeof value === 'object' ? value || {} : JSON.parse(value)
62
+ return dataValue
63
+ } catch {
64
+ return {}
65
+ }
66
+ },
67
+ extra: {
68
+ type: 'json-editor',
69
+ },
28
70
  }
29
71
 
30
72
  exports.is_diy_router = {
@@ -133,7 +133,6 @@ exports.extra = {
133
133
  try {
134
134
  const dataValue = typeof value === 'object' ? value : JSON.parse(value)
135
135
  this.setDataValue('extra', dataValue)
136
- console.log(dataValue)
137
136
  } catch {
138
137
  throw new Error('extra值不合法')
139
138
  }
@@ -552,8 +552,17 @@ exports.copyOther = async (ctx) => {
552
552
  for (let i = 0; i < list.length; i++) {
553
553
  const url = `${prefix}/${list[i]}/findAll`
554
554
 
555
- const result = await axios.post(url).then((res) => res.data)
556
- console.log(list[i])
555
+ const result = await axios
556
+ .post(
557
+ url,
558
+ {},
559
+ {
560
+ headers: {
561
+ 'Client-Type': 0,
562
+ },
563
+ }
564
+ )
565
+ .then((res) => res.data)
557
566
  if (result.code === 200) {
558
567
  await app.model[list[i]].sync({
559
568
  force: true,
@@ -267,13 +267,12 @@ exports.checkLogin = async (ctx) => {
267
267
  const { config: _config } = ctx.request.body
268
268
  const config = _config || 'weixin_mp'
269
269
  const appConfig = getConfig(app)
270
- const { app_id } = await appConfig.getObject(config)
271
270
  if (ctx.request[`${appName}-user`] && ctx.request[`${appName}-user`].id) {
272
271
  const h5_user_include = config.includes('h5')
273
272
  ? {
274
273
  model: app.model.h5_user,
275
274
  where: {
276
- appid: app_id,
275
+ appid: (await appConfig.getObject(config)).app_id,
277
276
  },
278
277
  attributes: {
279
278
  exclude: ['created_at', 'updated_at', 'createdid'],
@@ -286,7 +285,7 @@ exports.checkLogin = async (ctx) => {
286
285
  ? {
287
286
  model: app.model.mp_user,
288
287
  where: {
289
- appid: app_id,
288
+ appid: (await appConfig.getObject(config)).app_id,
290
289
  },
291
290
  }
292
291
  : {
@@ -297,8 +296,8 @@ exports.checkLogin = async (ctx) => {
297
296
  {
298
297
  model: app.model.github_user,
299
298
  },
300
- h5_user_include,
301
- mp_user_include,
299
+ config === 'weixin_h5' ? h5_user_include : {},
300
+ config === 'weixin_mp' ? mp_user_include : {},
302
301
  {
303
302
  model: app.model.toutiao_user,
304
303
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "10.6.5",
3
+ "version": "10.6.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- name: '后台导航',
3
- belongs: 'auth',
4
- multiple: false,
5
- availableSort: true,
6
- order: [],
7
- select: [],
8
- excludes: [],
9
- limit: 40,
10
- defaultOrder: [{ sort: 'ascending', type: 'sortOrder' }],
11
- comment: {},
12
- sortOrder: 1,
13
- reference: [],
14
- excludeAuth: [],
15
- initList: [],
16
- personal: [{ key: 'init_routes', name: '初始化', width: 200, common: true }],
17
- }