q-koa 7.7.8 → 7.8.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.
@@ -956,15 +956,19 @@ exports.refund_notify = async (ctx) => {
956
956
  const prefix =
957
957
  out_trade_no.split('_').length === 4 ? out_trade_no.split('_')[1] : ''
958
958
 
959
- const order_id = Number(out_refund_no)
959
+ const order_id = out_trade_no.includes('_')
960
+ ? Number(out_trade_no.split('_')[0])
961
+ : Number(out_trade_no)
962
+ const type = out_trade_no.includes('_') ? out_trade_no.split('_')[1] : ''
960
963
  const model = prefix ? `${prefix}_order` : 'order'
961
- console.log(out_refund_no, '微信支付回调-----', model)
964
+ console.log(out_refund_no, '微信支付回调-----', type, model)
962
965
  if (app.service[model] && app.service[model].refund_notify) {
963
966
  await app.service[model].refund_notify({
964
967
  app,
965
968
  order_id,
966
969
  order: model,
967
970
  refund_price,
971
+ type,
968
972
  })
969
973
  }
970
974
 
@@ -11,6 +11,7 @@ exports.refund = async ({
11
11
  total_fee,
12
12
  refund_fee,
13
13
  price,
14
+ type = '',
14
15
  ...rest
15
16
  }) => {
16
17
  const { app, appName } = getAppByCtx(ctx)
@@ -43,7 +44,7 @@ exports.refund = async ({
43
44
  const { result_code, err_code_des } = await payObj.refund({
44
45
  ...rest,
45
46
  out_trade_no,
46
- out_refund_no: id + '',
47
+ out_refund_no: id + '_' + type,
47
48
  total_fee: Math.round((total_fee || refund_fee || price) * 100),
48
49
  refund_fee: Math.round((refund_fee || price) * 100),
49
50
  notify_url: `https://${
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "7.7.8",
3
+ "version": "7.8.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {