q-koa 8.3.1 → 8.4.0

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]({
@@ -70,7 +70,7 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
70
70
 
71
71
  if (app.controller[model] && app.controller[model][fn]) {
72
72
  return app.controller[model][fn](ctx, data).then((result) => {
73
- if (!result) {
73
+ if (!result && process.env.NODE_ENV !== 'production') {
74
74
  console.log(`需要在控制器${fn}中返回`)
75
75
  }
76
76
  return {
@@ -918,7 +918,7 @@ exports.notify = async (ctx) => {
918
918
  transactionid = result.xml.transaction_id
919
919
  } catch (e) {}
920
920
 
921
- console.log(order_id, '微信支付回调-----', model, order_price, transactionid)
921
+ // console.log(order_id, '微信支付回调-----', model, order_price, transactionid)
922
922
  if (app.service[model] && app.service[model].notify) {
923
923
  await app.service[model].notify({
924
924
  app,
@@ -1094,9 +1094,9 @@ exports.refund_notify = async (ctx) => {
1094
1094
  : Number(out_refund_no)
1095
1095
  const type = out_refund_no.includes('_') ? out_refund_no.split('_')[1] : ''
1096
1096
  const model = prefix ? `${prefix}_order` : 'order'
1097
- console.log(
1098
- `微信退款回调 prefix:${prefix}/model:${model}/order_id:${order_id}/type:${type}`
1099
- )
1097
+ // console.log(
1098
+ // `微信退款回调 prefix:${prefix}/model:${model}/order_id:${order_id}/type:${type}`
1099
+ // )
1100
1100
  if (app.service[model] && app.service[model].refund_notify) {
1101
1101
  await app.service[model].refund_notify({
1102
1102
  app,
@@ -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.1",
3
+ "version": "8.4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {