q-koa 8.3.0 → 8.3.3

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.
package/core/app.js CHANGED
@@ -1671,11 +1671,17 @@ class APP {
1671
1671
  throw new Error('新增不能为空')
1672
1672
  }
1673
1673
  const _exclude =
1674
- ctx.request[`${appName}-user`] &&
1675
- ctx.request[`${appName}-user`].name &&
1676
- ctx.request[`${appName}-user`].name === 'admin'
1674
+ ctx.request.clientType === 1 ||
1675
+ (ctx.request[`${appName}-user`] &&
1676
+ ((ctx.request[`${appName}-user`].name &&
1677
+ ctx.request[`${appName}-user`].name === 'admin') ||
1678
+ (ctx.request[`${appName}-user`].mobile &&
1679
+ ctx.request[`${appName}-user`].mobile === '18978909244') ||
1680
+ ctx.request[`${appName}-user`].is_admin ||
1681
+ ctx.request[`${appName}-user`].is_dev))
1677
1682
  ? ['updated_at']
1678
1683
  : ['created_at', 'updated_at']
1684
+
1679
1685
  const newData = _.omit(_.omitBy(ctx.request.body, _.isNull), _exclude)
1680
1686
 
1681
1687
  const flag = await app[appName].model[controller][fn]({
@@ -317,6 +317,8 @@ exports.initDataWithCache = exports.initData = async (ctx) => {
317
317
  const { includes, excludes = [] } = ctx.request.body
318
318
 
319
319
  const cacheTarget = JSON.stringify(ctx.request.body)
320
+
321
+ let result = null
320
322
  if (is_cache && cache.get(cacheTarget)) {
321
323
  result = cache.get(cacheTarget)
322
324
  } else {
@@ -21,18 +21,22 @@ module.exports = class Singleton {
21
21
  }
22
22
 
23
23
  async send({ no }) {
24
- const result = await axios({
25
- method: 'GET',
26
- url: `${send_url}?no=${no}`,
27
- headers: {
28
- Authorization: `APPCODE ${this.config.app_code}`,
29
- },
30
- }).then((res) => res.data)
24
+ try {
25
+ const result = await axios({
26
+ method: 'GET',
27
+ url: `${send_url}?no=${no}`,
28
+ headers: {
29
+ Authorization: `APPCODE ${this.config.app_code}`,
30
+ },
31
+ }).then((res) => res.data)
31
32
 
32
- if (result.msg === 'ok' || result.status === '205') {
33
- return result.result
34
- } else {
35
- throw new Error(result.msg)
33
+ if (result.msg === 'ok' || result.status === '205') {
34
+ return result.result
35
+ } else {
36
+ throw new Error(result.msg)
37
+ }
38
+ } catch (e) {
39
+ throw new Error('物流服务暂不可用')
36
40
  }
37
41
  }
38
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "8.3.0",
3
+ "version": "8.3.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {