q-koa 9.6.1 → 9.7.1
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 +30 -1
- package/core/config.js +1 -0
- package/core/file/plugins/dashboard_list/config.js +25 -0
- package/core/file/plugins/dashboard_list/model.js +69 -0
- package/core/file/plugins/routes/config.js +1 -0
- package/core/file/plugins/weixin/service.js +12 -12
- package/core/file/utils/index.js +2 -1
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -1011,7 +1011,36 @@ class APP {
|
|
|
1011
1011
|
let _where
|
|
1012
1012
|
|
|
1013
1013
|
if (where) {
|
|
1014
|
-
|
|
1014
|
+
if (fn === 'findAndCountAll') {
|
|
1015
|
+
const formatWhere = _.mapValues(where, (item) => {
|
|
1016
|
+
if (_.isObject(item)) {
|
|
1017
|
+
if (
|
|
1018
|
+
item.hasOwnProperty('$notIn') &&
|
|
1019
|
+
typeof item.$notIn === 'string'
|
|
1020
|
+
) {
|
|
1021
|
+
return {
|
|
1022
|
+
$notIn: [Sequelize.literal(item.$notIn)],
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
if (
|
|
1027
|
+
item.hasOwnProperty('$in') &&
|
|
1028
|
+
typeof item.$in === 'string'
|
|
1029
|
+
) {
|
|
1030
|
+
return {
|
|
1031
|
+
$in: [Sequelize.literal(item.$in)],
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
return item
|
|
1035
|
+
} else {
|
|
1036
|
+
return item
|
|
1037
|
+
}
|
|
1038
|
+
})
|
|
1039
|
+
_where = _.cloneDeep(formatWhere)
|
|
1040
|
+
} else {
|
|
1041
|
+
_where = _.cloneDeep(where)
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1015
1044
|
// if (util.isObject(where)) {
|
|
1016
1045
|
// _where = _.cloneDeep(where);
|
|
1017
1046
|
// } else if (util.isString(where)) {
|
package/core/config.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: '首页数据看板',
|
|
3
|
+
belongs: 'page',
|
|
4
|
+
multiple: false,
|
|
5
|
+
availableSort: true,
|
|
6
|
+
order: [],
|
|
7
|
+
referenceSelect: [],
|
|
8
|
+
select: [{"key":"name"}],
|
|
9
|
+
excludes: [],
|
|
10
|
+
limit: 20,
|
|
11
|
+
defaultOrder: [{"sort":"ascending","type":"sortOrder"}],
|
|
12
|
+
comment: {},
|
|
13
|
+
sortOrder: 1,
|
|
14
|
+
reference: [],
|
|
15
|
+
excludeAuth: [],
|
|
16
|
+
initList: [],
|
|
17
|
+
editInline: {},
|
|
18
|
+
autoData: {},
|
|
19
|
+
is_split: false,
|
|
20
|
+
is_split_count: false,
|
|
21
|
+
show_virtual: false,
|
|
22
|
+
modelQuery: {},
|
|
23
|
+
deleteCheckList: [],
|
|
24
|
+
bulkCreateList: [],
|
|
25
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const { Sequelize, Random } = require('q-koa');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
exports.name = {
|
|
5
|
+
type: Sequelize.STRING,
|
|
6
|
+
comment: '名字',
|
|
7
|
+
allowNull: false,
|
|
8
|
+
is_mock: true,
|
|
9
|
+
defaultValue: '',
|
|
10
|
+
sortOrder: 1,
|
|
11
|
+
mock: () => Random.ctitle(),
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.data_list = {
|
|
15
|
+
type: Sequelize.JSON,
|
|
16
|
+
comment: '依赖',
|
|
17
|
+
allowNull: false,
|
|
18
|
+
is_mock: false,
|
|
19
|
+
defaultValue: [],
|
|
20
|
+
sortOrder: 2,
|
|
21
|
+
get: function () {
|
|
22
|
+
return this.getDataValue('data_list') || []
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.desc = {
|
|
27
|
+
type: Sequelize.TEXT,
|
|
28
|
+
comment: '介绍',
|
|
29
|
+
allowNull: false,
|
|
30
|
+
is_mock: true,
|
|
31
|
+
defaultValue: '',
|
|
32
|
+
sortOrder: 3,
|
|
33
|
+
mock: () => Random.csentence(),
|
|
34
|
+
extra: {"type":"markdown"},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.role_id = {
|
|
38
|
+
type: Sequelize.JSON,
|
|
39
|
+
comment: '角色',
|
|
40
|
+
allowNull: false,
|
|
41
|
+
is_mock: true,
|
|
42
|
+
defaultValue: [],
|
|
43
|
+
sortOrder: 4,
|
|
44
|
+
mock: () => Random.range(2).map((item, index) => Random.integer(1, 5)),
|
|
45
|
+
get: function () {
|
|
46
|
+
return this.getDataValue('role_id') || []
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.sortOrder = {
|
|
51
|
+
type: Sequelize.MEDIUMINT.UNSIGNED,
|
|
52
|
+
comment: '排序',
|
|
53
|
+
allowNull: false,
|
|
54
|
+
is_mock: false,
|
|
55
|
+
defaultValue: 0,
|
|
56
|
+
sortOrder: 5,
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
exports.is_on = {
|
|
61
|
+
type: Sequelize.BOOLEAN,
|
|
62
|
+
comment: '是否',
|
|
63
|
+
allowNull: false,
|
|
64
|
+
is_mock: true,
|
|
65
|
+
defaultValue: true,
|
|
66
|
+
sortOrder: 6,
|
|
67
|
+
mock: () => Random.boolean(),
|
|
68
|
+
extra: {"controlInline":true},
|
|
69
|
+
}
|
|
@@ -153,8 +153,19 @@ exports.cash = async ({
|
|
|
153
153
|
}) => {
|
|
154
154
|
const { app, appName } = getAppByCtx(ctx)
|
|
155
155
|
const appConfig = getConfig(app)
|
|
156
|
+
|
|
157
|
+
const user = await app.model.user.findOne({
|
|
158
|
+
where: {
|
|
159
|
+
id: user_id,
|
|
160
|
+
},
|
|
161
|
+
include: app.model.mp_user,
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
if (!user) throw new Error('找不到该用户')
|
|
165
|
+
if (!user.mp_user.openid) throw new Error('找不到该用户openid')
|
|
166
|
+
|
|
156
167
|
const { mchId, key, appId, partner_key } = await appConfig.getObject(
|
|
157
|
-
pay_config
|
|
168
|
+
user.mp_user.appid || pay_config
|
|
158
169
|
)
|
|
159
170
|
|
|
160
171
|
const { is_dev } = await appConfig.getObject('base')
|
|
@@ -170,17 +181,6 @@ exports.cash = async ({
|
|
|
170
181
|
)
|
|
171
182
|
), // 微信商户平台证书
|
|
172
183
|
})
|
|
173
|
-
|
|
174
|
-
const user = await app.model.user.findOne({
|
|
175
|
-
where: {
|
|
176
|
-
id: user_id,
|
|
177
|
-
},
|
|
178
|
-
include: app.model.mp_user,
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
if (!user) throw new Error('找不到该用户')
|
|
182
|
-
if (!user.mp_user.openid) throw new Error('找不到该用户openid')
|
|
183
|
-
|
|
184
184
|
const amount = Number((Math.abs(number) * 100).toFixed(0))
|
|
185
185
|
|
|
186
186
|
const result = await payObj.transfers({
|
package/core/file/utils/index.js
CHANGED
|
@@ -38,7 +38,8 @@ exports.getObject = (config, app) => async (type) => {
|
|
|
38
38
|
item.key === type ||
|
|
39
39
|
item.config === type ||
|
|
40
40
|
item.pay_config === type ||
|
|
41
|
-
(item.ToUserName && item.ToUserName === type)
|
|
41
|
+
(item.ToUserName && item.ToUserName === type) ||
|
|
42
|
+
(item.appId && item.appId === type)
|
|
42
43
|
if (app) {
|
|
43
44
|
const applicationList = app.cache.get('application')
|
|
44
45
|
if (applicationList && applicationList.find(findConfig)) {
|