q-koa 13.3.4 → 13.3.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.
@@ -23,6 +23,20 @@ exports.clear = async (ctx) => {
23
23
  const key =
24
24
  ctx.request.method === 'POST' ? ctx.request.body.key : ctx.query.key
25
25
 
26
+ if (!key) return ctx.ERROR('缺key')
27
+ app.cache.set(key, '')
28
+ app.service.cache.init({ app, appName, model: key })
29
+ const url = `${app.appConfig.ip}:${app.appConfig.port}`
30
+ app.service.log.push({ app, message: `${url}缓存${key}清除` })
31
+
32
+ ctx.SUCCESS('ok')
33
+ }
34
+
35
+ exports.init = async (ctx) => {
36
+ const { app, appName } = getAppByCtx(ctx)
37
+ const key =
38
+ ctx.request.method === 'POST' ? ctx.request.body.key : ctx.query.key
39
+
26
40
  if (!key) return ctx.ERROR('缺key')
27
41
  app.cache.set(key, '')
28
42
 
@@ -1,4 +1,10 @@
1
+ const axios = require('axios')
2
+
1
3
  exports.init = async ({ app, appName, model = '' }) => {
4
+ const hasCache = app.cache.get(model) || ''
5
+ if (!hasCache) {
6
+ console.log('hear clear cache', model)
7
+ }
2
8
  const cacheModel = app.appConfig.cacheModel.filter((m) =>
3
9
  model ? m === model : true
4
10
  )
@@ -15,4 +21,28 @@ exports.init = async ({ app, appName, model = '' }) => {
15
21
  return promiseFn(model)
16
22
  })
17
23
  )
24
+
25
+ if (model && app.appConfig.appName && app.appConfig.productionHost) {
26
+ const ipHost = (
27
+ Array.isArray(app.appConfig.productionHost)
28
+ ? app.appConfig.productionHost
29
+ : [app.appConfig.productionHost]
30
+ )
31
+ .filter((url) => {
32
+ return url.match(
33
+ /^(http:\/\/|https:\/\/)?(\d{1,3}\.){3}\d{1,3}:\d{1,5}/
34
+ )
35
+ })
36
+ .filter((host) =>
37
+ app.appConfig.ip ? !host.includes(app.appConfig.ip) : false
38
+ )
39
+
40
+ Promise.all(
41
+ ipHost.map((host) => {
42
+ return axios
43
+ .get(`${host}/${app.appConfig.appName}/cache/init?key=${model}`)
44
+ .then((res) => res.data)
45
+ })
46
+ )
47
+ }
18
48
  }
@@ -1117,6 +1117,12 @@ exports.mp_pay = async (ctx) => {
1117
1117
  return ctx.SUCCESS('ok')
1118
1118
  }
1119
1119
  if (payResult.return_msg) {
1120
+ consoleconsole.log({
1121
+ mchId,
1122
+ key,
1123
+ pay_key: _pay_key,
1124
+ partner_key,
1125
+ })
1120
1126
  throw new Error(
1121
1127
  payResult.return_msg === '签名错误,请检查后再试'
1122
1128
  ? payResult.return_msg + '(商户号/APIv2/关联)'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.3.4",
3
+ "version": "13.3.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {