q-koa 13.3.2 → 13.3.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.
@@ -224,6 +224,10 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
224
224
  [item]: list,
225
225
  }
226
226
  })
227
+ } else {
228
+ return Promise.resolve({
229
+ [item]: [],
230
+ })
227
231
  }
228
232
  } else {
229
233
  return Promise.resolve({
@@ -1012,7 +1012,6 @@ exports.mp_pay = async (ctx) => {
1012
1012
  pay_config = 'weixin_pay',
1013
1013
  profit_sharing = 'N',
1014
1014
  } = ctx.request.body
1015
-
1016
1015
  if (price === 0) throw new Error('价格不能为0')
1017
1016
 
1018
1017
  if (type === 'H5-WEIXIN') {
@@ -1030,8 +1029,14 @@ exports.mp_pay = async (ctx) => {
1030
1029
  }
1031
1030
  const appConfig = getConfig(app)
1032
1031
 
1033
- const { mchId, key, partner_key } = await appConfig.getObject(pay_config)
1032
+ const {
1033
+ mchId,
1034
+ key,
1035
+ pay_key: _pay_key,
1036
+ partner_key,
1037
+ } = await appConfig.getObject(pay_config)
1034
1038
 
1039
+ const pay_key = _pay_key || key || appName
1035
1040
  const { is_dev, site_host } = await appConfig.getObject('base')
1036
1041
  // 公众号支付用 服务号 appid,其他用小程序 appid
1037
1042
  const app_id =
@@ -1042,7 +1047,7 @@ exports.mp_pay = async (ctx) => {
1042
1047
  const wxpay = WXPay({
1043
1048
  appid: app_id,
1044
1049
  mch_id: mchId,
1045
- partner_key: key.length > 10 ? key : partner_key, // 微信商户平台API密钥
1050
+ partner_key, // 微信商户平台API密钥
1046
1051
  })
1047
1052
 
1048
1053
  const userDetail =
@@ -1053,13 +1058,12 @@ exports.mp_pay = async (ctx) => {
1053
1058
  const out_trade_no = _out_trade_no
1054
1059
  ? _out_trade_no
1055
1060
  : prefix
1056
- ? `${key.length > 10 ? appName : key}_${prefix}-${order_id}_${type}`
1057
- : `${key.length > 10 ? appName : key}_${order_id}_${type}`
1061
+ ? `${pay_key}_${prefix}-${order_id}_${type}`
1062
+ : `${pay_key}_${order_id}_${type}`
1058
1063
 
1059
1064
  const notify_url = `https://${
1060
1065
  site_host || 'api.kuashou.com'
1061
1066
  }/${appName}/weixin/notify`
1062
-
1063
1067
  const prePayResult = await wxpay.getBrandWCPayRequestParamsSync({
1064
1068
  openid: userDetail.openid,
1065
1069
  body: name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.3.2",
3
+ "version": "13.3.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {