q-koa 11.6.0 → 11.7.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
@@ -1826,6 +1826,7 @@ class APP {
1826
1826
  }
1827
1827
  }
1828
1828
 
1829
+ let createTarget = null
1829
1830
  if (fn === 'upsert' || fn === 'create') {
1830
1831
  if (_.isEmpty(ctx.request.body)) {
1831
1832
  throw new Error('新增不能为空')
@@ -1863,6 +1864,9 @@ class APP {
1863
1864
  : 0,
1864
1865
  ...newData,
1865
1866
  })
1867
+ if (fn === 'create') {
1868
+ createTarget = flag.toJSON ? flag.toJSON() : flag
1869
+ }
1866
1870
  ctx.SUCCESS(flag)
1867
1871
 
1868
1872
  if (cacheModel.includes(controller)) {
@@ -1910,7 +1914,7 @@ class APP {
1910
1914
  }
1911
1915
 
1912
1916
  if (_.get(app, `${appName}.afterExecute.${controller}.${fn}`)) {
1913
- app[appName].afterExecute[controller][fn](ctx)
1917
+ app[appName].afterExecute[controller][fn](ctx, createTarget)
1914
1918
  .then((res) => {
1915
1919
  if (is_dev) {
1916
1920
  console.log('afterUpdate', res)
@@ -52,6 +52,6 @@ exports.login = async (ctx) => {
52
52
  token,
53
53
  user: app.appConfig.loginData
54
54
  ? lodash.omit(result.toJSON(), app.appConfig.loginData.omit)
55
- : result,
55
+ : result.toJSON(),
56
56
  })
57
57
  }
@@ -47,7 +47,7 @@ exports.login = async (ctx) => {
47
47
  token,
48
48
  user: app.appConfig.loginData
49
49
  ? lodash.omit(result.toJSON(), app.appConfig.loginData.omit)
50
- : result,
50
+ : result.toJSON(),
51
51
  })
52
52
  }
53
53
  if (
@@ -212,7 +212,7 @@ exports.login = async (ctx) => {
212
212
  token,
213
213
  user: app.appConfig.loginData
214
214
  ? lodash.omit(result.toJSON(), app.appConfig.loginData.omit)
215
- : result,
215
+ : result.toJSON(),
216
216
  })
217
217
  }
218
218
 
@@ -432,7 +432,7 @@ exports.checkLogin = async (ctx) => {
432
432
  token,
433
433
  user: app.appConfig.loginData
434
434
  ? lodash.omit(result.toJSON(), app.appConfig.loginData.omit)
435
- : result,
435
+ : result.toJSON(),
436
436
  })
437
437
  }
438
438
 
@@ -498,7 +498,7 @@ exports.mp_login = async (ctx) => {
498
498
  token,
499
499
  user: app.appConfig.loginData
500
500
  ? lodash.omit(result.toJSON(), app.appConfig.loginData.omit)
501
- : result,
501
+ : result.toJSON(),
502
502
  })
503
503
  }
504
504
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "11.6.0",
3
+ "version": "11.7.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {