q-koa 10.1.4 → 10.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.
@@ -1,4 +1,4 @@
1
- const { getAppByCtx, getConfig, lodash } = require('q-koa')
1
+ const { getAppByCtx, getAppConfig, getConfig, lodash } = require('q-koa')
2
2
  const { Pay } = require('@sigodenjs/wechatpay')
3
3
  const path = require('path')
4
4
  const fsPromise = require('fs/promises')
@@ -174,9 +174,10 @@ exports.cash = async ({
174
174
  if (!user) throw new Error('找不到该用户')
175
175
  if (!user.mp_user.openid) throw new Error('找不到该用户openid')
176
176
 
177
- const { mchId, key, appId, partner_key } = await appConfig.getObject(
178
- user.mp_user.appid || pay_config
179
- )
177
+ const { mchId, key, appId, partner_key } = await getAppConfig({
178
+ app,
179
+ app_id: user.mp_user.appid,
180
+ })
180
181
 
181
182
  const { is_dev } = await appConfig.getObject('base')
182
183
 
@@ -160,12 +160,12 @@ exports.getImageType = (fileBuffer) => {
160
160
  return ''
161
161
  }
162
162
 
163
- exports.getAppConfig = async ({ app, config, key }) => {
164
- if (!(app && (config || key))) return null
163
+ exports.getAppConfig = async ({ app, config, key, app_id }) => {
164
+ if (!(app && (config || key || app_id))) return null
165
165
  const application =
166
166
  app.cache.get('application') || (await app.model.application.findAll())
167
167
 
168
- const target = application.find(findConfig(config || key))
168
+ const target = application.find(findConfig(config || key || app_id))
169
169
 
170
170
  return target || null
171
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "10.1.4",
3
+ "version": "10.1.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {