q-koa 8.1.4 → 8.1.5

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.
@@ -1015,6 +1015,8 @@ exports.qr_code = async (ctx) => {
1015
1015
  accessKeySecret,
1016
1016
  bucket,
1017
1017
  region,
1018
+ cdn_host,
1019
+ oss_host,
1018
1020
  } = await appConfig.getObject('oss')
1019
1021
  if (!(accessKeyId && accessKeySecret && bucket && region)) {
1020
1022
  throw new Error('没有配置oss设置')
@@ -1036,8 +1038,13 @@ exports.qr_code = async (ctx) => {
1036
1038
  }.png`
1037
1039
  const result = await client.put(fileName, buffer)
1038
1040
  if (result.res && result.res.status === 200) {
1039
- const url = result.url
1040
- return ctx.SUCCESS(url)
1041
+ if (oss_host && cdn_host) {
1042
+ const url = result.url.replace(oss_host, cdn_host)
1043
+ return ctx.SUCCESS(url)
1044
+ } else {
1045
+ const url = result.url
1046
+ return ctx.SUCCESS(url)
1047
+ }
1041
1048
  } else {
1042
1049
  throw new Error(result.res.statusMessage)
1043
1050
  }
@@ -1221,7 +1228,6 @@ exports.checkPay = async (ctx) => {
1221
1228
  const payResult = await checkOrder({
1222
1229
  out_trade_no,
1223
1230
  })
1224
-
1225
1231
  if (payResult.trade_state_desc === '支付成功') {
1226
1232
  const order_price = Number(payResult.total_fee) / 100
1227
1233
  await app.service[orderModel].notify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "8.1.4",
3
+ "version": "8.1.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {