q-koa 8.1.7 → 8.2.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 +5 -1
- package/core/file/plugins/model/model.js +7 -0
- package/core/file/plugins/model/service.js +1 -0
- package/core/file/plugins/system/controller.js +0 -2
- package/core/file/plugins/weixin/controller.js +10 -12
- package/core/file/plugins/weixin/service.js +23 -3
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -255,7 +255,11 @@ class APP {
|
|
|
255
255
|
starter.on('loadAll', async () => {
|
|
256
256
|
const appName = this.config.includes[0]
|
|
257
257
|
this.server = this.app.listen(this.port, () => {
|
|
258
|
-
console.log(
|
|
258
|
+
console.log(
|
|
259
|
+
`${moment().format(
|
|
260
|
+
'HH:mm:ss'
|
|
261
|
+
)} server is running at http://localhost:${this.port}`
|
|
262
|
+
)
|
|
259
263
|
console.log(
|
|
260
264
|
`first app is http://localhost:3001/${appName}/setting/findOne`
|
|
261
265
|
)
|
|
@@ -86,6 +86,7 @@ exports.loadModel = async ({ app, appName }) => {
|
|
|
86
86
|
modelQuery: config.modelQuery,
|
|
87
87
|
editInline: config.editInline,
|
|
88
88
|
deleteCheckList: config.deleteCheckList,
|
|
89
|
+
bulkCreateList: config.bulkCreateList,
|
|
89
90
|
list: attributes.map((attr, index) => {
|
|
90
91
|
const name = attr.match(/exports.(.*)=/)[1].trim()
|
|
91
92
|
let defaultValue = ''
|
|
@@ -166,8 +166,6 @@ exports.showTables = async (ctx) => {
|
|
|
166
166
|
autoData: lodash.get(target, 'autoData', null),
|
|
167
167
|
// 有些model需要前置查询其它model数据
|
|
168
168
|
initList: lodash.get(target, 'initList', []),
|
|
169
|
-
// 批量修改
|
|
170
|
-
bulkCreateList: lodash.get(target, 'bulkCreateList', []),
|
|
171
169
|
// 局部更新列表
|
|
172
170
|
editInline: lodash.get(target, 'editInline', {}),
|
|
173
171
|
// 有些model需要前置查询其它model数据
|
|
@@ -943,16 +943,11 @@ exports.url_link = async (ctx) => {
|
|
|
943
943
|
const { app } = getAppByCtx(ctx)
|
|
944
944
|
|
|
945
945
|
const { page, scene, config = 'weixin_mp' } = ctx.request.body
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
const weixinMp = new WeixinMp({
|
|
949
|
-
appid: app_id,
|
|
950
|
-
secrect: app_secrect,
|
|
951
|
-
})
|
|
952
|
-
weixinMp.init()
|
|
953
|
-
const result = await weixinMp.createUrlLink({
|
|
946
|
+
const result = await app.service.weixin.url_link({
|
|
947
|
+
app,
|
|
954
948
|
page,
|
|
955
949
|
scene,
|
|
950
|
+
config,
|
|
956
951
|
})
|
|
957
952
|
ctx.SUCCESS(result)
|
|
958
953
|
}
|
|
@@ -991,8 +986,8 @@ exports.qr_code = async (ctx) => {
|
|
|
991
986
|
page,
|
|
992
987
|
is_hyaline,
|
|
993
988
|
scene,
|
|
994
|
-
is_oss
|
|
995
|
-
config
|
|
989
|
+
is_oss,
|
|
990
|
+
config,
|
|
996
991
|
})
|
|
997
992
|
|
|
998
993
|
return ctx.SUCCESS(result)
|
|
@@ -1088,8 +1083,11 @@ exports.refund_notify = async (ctx) => {
|
|
|
1088
1083
|
|
|
1089
1084
|
const refund_price = Number(refund_fee) / 100
|
|
1090
1085
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1086
|
+
let prefix = ''
|
|
1087
|
+
if (out_trade_no.split('_')[1].includes('-')) {
|
|
1088
|
+
const arr = out_trade_no.split('_')[1].split('-')
|
|
1089
|
+
;[prefix] = arr
|
|
1090
|
+
}
|
|
1093
1091
|
|
|
1094
1092
|
const order_id = out_refund_no.includes('_')
|
|
1095
1093
|
? Number(out_refund_no.split('_')[0])
|
|
@@ -34,7 +34,7 @@ exports.refund = async ({
|
|
|
34
34
|
})
|
|
35
35
|
const orderModel = prefix ? `${prefix}_order` : 'order'
|
|
36
36
|
const out_trade_no = prefix
|
|
37
|
-
? `${appName}_${prefix}
|
|
37
|
+
? `${appName}_${prefix}-${id}_MP-WEIXIN`
|
|
38
38
|
: `${appName}_${id}_MP-WEIXIN`
|
|
39
39
|
const orderDetail = await app.model[orderModel].findOne({
|
|
40
40
|
where: {
|
|
@@ -63,9 +63,14 @@ exports.refund = async ({
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
exports.cash = async ({
|
|
66
|
+
exports.cash = async ({
|
|
67
|
+
ctx,
|
|
68
|
+
id,
|
|
69
|
+
user_id,
|
|
70
|
+
number,
|
|
71
|
+
pay_config = 'weixin_pay',
|
|
72
|
+
}) => {
|
|
67
73
|
const { app, appName } = getAppByCtx(ctx)
|
|
68
|
-
const { pay_config = 'weixin_pay' } = ctx.request.body
|
|
69
74
|
const appConfig = getConfig(app)
|
|
70
75
|
const { mchId, key, appId } = await appConfig.getObject(pay_config)
|
|
71
76
|
|
|
@@ -177,3 +182,18 @@ exports.qr_code = async ({
|
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
184
|
}
|
|
185
|
+
|
|
186
|
+
exports.url_link = async ({ app, page, scene, config = 'weixin_mp' }) => {
|
|
187
|
+
const appConfig = getConfig(app)
|
|
188
|
+
const { app_id, app_secrect } = await appConfig.getObject(config)
|
|
189
|
+
const weixinMp = new WeixinMp({
|
|
190
|
+
appid: app_id,
|
|
191
|
+
secrect: app_secrect,
|
|
192
|
+
})
|
|
193
|
+
weixinMp.init()
|
|
194
|
+
const result = await weixinMp.createUrlLink({
|
|
195
|
+
page,
|
|
196
|
+
scene,
|
|
197
|
+
})
|
|
198
|
+
return result
|
|
199
|
+
}
|