q-koa 13.8.7 → 13.8.9

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.
@@ -450,6 +450,7 @@ const expressFn = async ({ app, express_number: _express_number, mobile }) => {
450
450
  const { app_code, express_mobile: default_express_mobile } =
451
451
  await appConfig.getObject('express')
452
452
 
453
+ if (!_express_number) throw new Error('快递单号不能为空')
453
454
  const express_number = _express_number.replace(/\t/, '').trim()
454
455
 
455
456
  const express_mobile = mobile || default_express_mobile
@@ -466,7 +467,7 @@ const expressFn = async ({ app, express_number: _express_number, mobile }) => {
466
467
  express_number,
467
468
  },
468
469
  })
469
- if (history) {
470
+ if (history && history.result && history.result.updateTime) {
470
471
  const diffNoLong = moment().diff(moment(history.updated_at), 'hours') < 1
471
472
  const isTooLong =
472
473
  moment().diff(moment(history.result.updateTime), 'days') > 30
@@ -518,6 +519,7 @@ exports.express = async (ctx) => {
518
519
  return expressFn({
519
520
  app,
520
521
  express_number: item,
522
+ mobile,
521
523
  })
522
524
  })
523
525
  )
@@ -41,15 +41,15 @@ exports.loadModel = async ({ app, appName }) => {
41
41
  ? require(configPath)
42
42
  : require(defaultConfigPath)
43
43
 
44
- const modelFile =
45
- defaultModelExist || modelExist
46
- ? (await fsPromise.readFile(filePath, 'utf-8'))
47
- ? await fsPromise.readFile(filePath, 'utf-8')
48
- : await fsPromise.readFile(defaultFilePath, 'utf-8')
49
- : null
44
+ let modelFile = null
45
+ if (modelExist) {
46
+ modelFile = await fsPromise.readFile(filePath, 'utf-8')
47
+ } else if (defaultModelExist) {
48
+ modelFile = await fsPromise.readFile(defaultFilePath, 'utf-8')
49
+ }
50
50
 
51
51
  const model = modelFile
52
- ? (await fsPromise.readFile(filePath, 'utf-8'))
52
+ ? modelExist
53
53
  ? require(filePath)
54
54
  : require(defaultFilePath)
55
55
  : {}
@@ -235,11 +235,11 @@ exports.loadModel = async ({ app, appName }) => {
235
235
  const promise2 = app.model.model_attributes.bulkCreate(
236
236
  dataList
237
237
  .filter((item) => item.list.every((t) => t.type))
238
- .reduce((a, b) => [...a, ...b.list], [])
238
+ .flatMap((b) => b.list)
239
239
  )
240
240
 
241
241
  await Promise.all([promise1, promise2])
242
- console.log('lodaModel success!')
242
+ console.log('loadModel success!')
243
243
  if (currentDisabledFindAllList.length > 0) {
244
244
  console.warn(`当前disabledFindAllList不为空,查看需清空`)
245
245
  } else {
@@ -30,9 +30,6 @@ exports.copyOther = async (ctx) => {
30
30
 
31
31
  const findType = list.find((item) => item.code === type)
32
32
  if (findType && findType.parent_id) {
33
- if (!findType) {
34
- throw new Error(`当前找不到${type}`)
35
- }
36
33
  await app.model.setting.upsert({
37
34
  id: findType.id,
38
35
  value: copyType.value,
@@ -261,13 +261,7 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
261
261
  })
262
262
  )
263
263
 
264
- const obj = result.reduce(
265
- (a, b) => ({
266
- ...a,
267
- ...b,
268
- }),
269
- {}
270
- )
264
+ const obj = Object.assign({}, ...result)
271
265
  if (obj.setting && apiVersion && !cacheVersion) {
272
266
  console.log(`version没有后端缓存`)
273
267
  }
@@ -413,7 +413,7 @@ exports.cash = async ({
413
413
  })
414
414
 
415
415
  if (!user) throw new Error('找不到该用户')
416
- if (!user.mp_user.openid) throw new Error('找不到该用户openid')
416
+ if (!user.mp_user || !user.mp_user.openid) throw new Error('找不到该用户openid')
417
417
 
418
418
  const { mchId, key, appId, partner_key } = await getAppConfig({
419
419
  app,
@@ -103,7 +103,7 @@ class AllinPay {
103
103
 
104
104
  async request(url, params) {
105
105
  const _params = new URLSearchParams()
106
- Object.keys(params).forEach((key, value) => {
106
+ Object.keys(params).forEach((key) => {
107
107
  _params.append(key, params[key])
108
108
  })
109
109
  try {
@@ -33,6 +33,6 @@ module.exports = class Config {
33
33
  }
34
34
 
35
35
  update() {
36
- this.app.cache.set('configList', null)
36
+ this.app.cache && this.app.cache.set('configList', null)
37
37
  }
38
38
  }
@@ -20,8 +20,6 @@ WXBizDataCrypt.prototype.decryptData = function (encryptedData, iv) {
20
20
  decoded += decipher.final('utf8')
21
21
 
22
22
  decoded = JSON.parse(decoded)
23
-
24
- return decoded
25
23
  } catch (err) {
26
24
  throw new Error('系统开小差了,请重试')
27
25
  }
@@ -29,6 +27,8 @@ WXBizDataCrypt.prototype.decryptData = function (encryptedData, iv) {
29
27
  if (decoded.watermark.appid !== this.appId) {
30
28
  throw new Error('Illegal Buffer')
31
29
  }
30
+
31
+ return decoded
32
32
  }
33
33
 
34
34
  module.exports = WXBizDataCrypt
@@ -350,6 +350,7 @@ module.exports = class Singleton {
350
350
  subAnchorWechat,
351
351
  anchorWechat,
352
352
  anchorName,
353
+ closeReplay,
353
354
  })
354
355
  }
355
356
  throw new Error(`${result.errcode};${result.errmsg}`)
@@ -614,7 +615,7 @@ module.exports = class Singleton {
614
615
  if (result.errcode) {
615
616
  if (result.errcode === 40001) {
616
617
  cache.clear()
617
- return await this.handleTyping(options)
618
+ return await this.handleTyping({ touser, is_typing })
618
619
  }
619
620
  throw new Error(`${result.errcode};${result.errmsg}`)
620
621
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.8.7",
3
+ "version": "13.8.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {