q-koa 7.8.1 → 7.8.4
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 +36 -17
- package/core/file/plugins/weixin/controller.js +3 -1
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -729,17 +729,31 @@ class APP {
|
|
|
729
729
|
}
|
|
730
730
|
|
|
731
731
|
if (model1 && this.app[appName].model[model1]) {
|
|
732
|
-
|
|
733
|
-
this.app[appName].model[model1]
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
732
|
+
const is_multiple =
|
|
733
|
+
(this.app[appName].attributes[model][model1 + '_id'].defaultValue &&
|
|
734
|
+
Array.isArray(
|
|
735
|
+
this.app[appName].attributes[model][model1 + '_id'].defaultValue
|
|
736
|
+
)) ||
|
|
737
|
+
(this.app[appName].attributes[model][model1 + '_id'].type &&
|
|
738
|
+
this.app[appName].attributes[model][model1 + '_id'].type ===
|
|
739
|
+
'JSON') ||
|
|
740
|
+
(this.app[appName].attributes[model][model1 + '_id'].type &&
|
|
741
|
+
this.app[appName].attributes[model][model1 + '_id'].type.key &&
|
|
742
|
+
this.app[appName].attributes[model][model1 + '_id'].type.key ===
|
|
743
|
+
'JSON')
|
|
744
|
+
if (!is_multiple) {
|
|
745
|
+
this.app[appName].model[model].hasOne(
|
|
746
|
+
this.app[appName].model[model1],
|
|
747
|
+
{
|
|
748
|
+
foreignKey: 'id',
|
|
749
|
+
sourceKey: `${model1}_id`,
|
|
750
|
+
constraints: false,
|
|
751
|
+
}
|
|
752
|
+
)
|
|
753
|
+
this.app[appName].include[model].push({
|
|
754
|
+
model: this.app[appName].model[model1],
|
|
755
|
+
})
|
|
756
|
+
}
|
|
743
757
|
if (
|
|
744
758
|
this.app[appName].attributes[model][`${model1}_id`].hasOne &&
|
|
745
759
|
this.app[appName].attributes[model][`${model1}_id`].hasOne === true
|
|
@@ -1472,11 +1486,15 @@ class APP {
|
|
|
1472
1486
|
if (omit.length === 0) {
|
|
1473
1487
|
ctx.SUCCESS(result)
|
|
1474
1488
|
} else {
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1489
|
+
if (['findAndCountAll', 'findAll'].includes(fn)) {
|
|
1490
|
+
ctx.SUCCESS(
|
|
1491
|
+
result.map((target) => {
|
|
1492
|
+
return _.omit(target.toJSON(), omit)
|
|
1493
|
+
})
|
|
1494
|
+
)
|
|
1495
|
+
} else {
|
|
1496
|
+
ctx.SUCCESS(_.omit(result.toJSON(), omit))
|
|
1497
|
+
}
|
|
1480
1498
|
}
|
|
1481
1499
|
} else {
|
|
1482
1500
|
const rows = await app[appName].model[controller][fn]({
|
|
@@ -1496,7 +1514,7 @@ class APP {
|
|
|
1496
1514
|
if (rows.length === 0) ctx.SUCCESS([])
|
|
1497
1515
|
let objList = {}
|
|
1498
1516
|
for (let j = 0; j < specialInclude.length; j++) {
|
|
1499
|
-
const model = specialInclude[j]
|
|
1517
|
+
const { model, ...rest } = specialInclude[j]
|
|
1500
1518
|
const modelName = model.getName()
|
|
1501
1519
|
const modelIdList = _.uniq(
|
|
1502
1520
|
rows
|
|
@@ -1513,6 +1531,7 @@ class APP {
|
|
|
1513
1531
|
where: {
|
|
1514
1532
|
id: modelIdList,
|
|
1515
1533
|
},
|
|
1534
|
+
...rest,
|
|
1516
1535
|
})
|
|
1517
1536
|
objList = {
|
|
1518
1537
|
...objList,
|
|
@@ -961,7 +961,9 @@ exports.refund_notify = async (ctx) => {
|
|
|
961
961
|
: Number(out_refund_no)
|
|
962
962
|
const type = out_refund_no.includes('_') ? out_refund_no.split('_')[1] : ''
|
|
963
963
|
const model = prefix ? `${prefix}_order` : 'order'
|
|
964
|
-
console.log(
|
|
964
|
+
console.log(
|
|
965
|
+
`微信退款回调 prefix:${prefix}/model:${model}/order_id:${order_id}/type:${type}`
|
|
966
|
+
)
|
|
965
967
|
if (app.service[model] && app.service[model].refund_notify) {
|
|
966
968
|
await app.service[model].refund_notify({
|
|
967
969
|
app,
|