q-koa 12.8.4 → 12.8.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.
@@ -3,8 +3,13 @@ module.exports = {
3
3
  belongs: 'page',
4
4
  multiple: false,
5
5
  availableSort: false,
6
- order: ['created_at'],
7
- select: [{ key: 'user_id' }, { key: 'nick_name' }],
6
+ order: ['created_at', 'unionid'],
7
+ select: [
8
+ { key: 'user_id' },
9
+ { key: 'openid' },
10
+ { key: 'appid' },
11
+ { key: 'unionid' },
12
+ ],
8
13
  excludes: [],
9
14
  limit: 20,
10
15
  defaultOrder: [{ sort: 'descending', type: 'id' }],
@@ -19,5 +24,6 @@ module.exports = {
19
24
  fields: ['openid'],
20
25
  },
21
26
  { fields: ['user_id'] },
27
+ { fields: ['unionid', 'appid'] },
22
28
  ],
23
29
  }
@@ -57,3 +57,13 @@ exports.unionid = {
57
57
  sortOrder: 11,
58
58
  mock: () => Random.ctitle(),
59
59
  }
60
+
61
+ exports.is_subscribe = {
62
+ type: Sequelize.BOOLEAN,
63
+ comment: '是否关注',
64
+ allowNull: false,
65
+ is_mock: true,
66
+ defaultValue: true,
67
+ sortOrder: 12,
68
+ mock: () => Random.boolean(),
69
+ }
@@ -1705,13 +1705,22 @@ exports.messagePush = async (ctx) => {
1705
1705
  if (ctx.request.method === 'GET') {
1706
1706
  ctx.body = echostr
1707
1707
  } else {
1708
- const result = ctx.request.body
1708
+ const result =
1709
+ ctx.request.xmlBody && ctx.request.xmlBody.xml
1710
+ ? ctx.request.xmlBody.xml
1711
+ : ctx.request.body
1709
1712
  if (!lodash.isEmpty(result)) {
1710
1713
  const event = result.Event
1711
1714
  if (!app.service.weixin) throw new Error(`weixin可能没有service.js`)
1712
1715
  if (event) {
1713
1716
  if (app.service.weixin[event]) {
1714
1717
  await app.service.weixin[event]({ ctx, app, result })
1718
+ } else {
1719
+ app.service.log.push({
1720
+ app,
1721
+ url: 'weixin/messagePush',
1722
+ message: `没有${event}方法 ${JSON.stringify(result)}`,
1723
+ })
1715
1724
  }
1716
1725
  } else {
1717
1726
  await app.service.weixin.handleUserMessage({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "12.8.4",
3
+ "version": "12.8.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {