q-koa 12.7.4 → 12.8.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.
@@ -4,6 +4,7 @@ const md5 = require('js-md5')
4
4
  const superAdmin = {
5
5
  name: 'admin',
6
6
  password: 'admin123',
7
+ is_dev: true,
7
8
  }
8
9
 
9
10
  exports.login = async (ctx) => {
@@ -338,11 +338,14 @@ exports.mp_login = async (ctx) => {
338
338
 
339
339
  let uid
340
340
  if (openIdUser) {
341
- await app.model.mp_user.update(post, {
342
- where: {
343
- openid: post.openid,
344
- },
345
- })
341
+ await app.model.mp_user.update(
342
+ lodash.omit(post, openIdUser.user_id ? ['user_id'] : []),
343
+ {
344
+ where: {
345
+ openid: post.openid,
346
+ },
347
+ }
348
+ )
346
349
  if (app.attributes.user.mp_openid) {
347
350
  app.model.user.update(
348
351
  {
@@ -1218,12 +1221,13 @@ exports.url_link = async (ctx) => {
1218
1221
  exports.short_link = async (ctx) => {
1219
1222
  const { app } = getAppByCtx(ctx)
1220
1223
 
1221
- const { page, scene, config = 'weixin_mp' } = ctx.request.body
1224
+ const { page, scene, title, config = 'weixin_mp' } = ctx.request.body
1222
1225
  if (!app.service.weixin) throw new Error(`weixin可能没有service.js`)
1223
1226
  const result = await app.service.weixin.short_link({
1224
1227
  app,
1225
1228
  page,
1226
1229
  scene,
1230
+ title,
1227
1231
  config,
1228
1232
  })
1229
1233
  ctx.SUCCESS(result)
@@ -450,7 +450,13 @@ exports.url_link = async ({ app, page, scene, config = 'weixin_mp' }) => {
450
450
  return result
451
451
  }
452
452
 
453
- exports.short_link = async ({ app, page, scene, config = 'weixin_mp' }) => {
453
+ exports.short_link = async ({
454
+ app,
455
+ page,
456
+ scene,
457
+ title,
458
+ config = 'weixin_mp',
459
+ }) => {
454
460
  const appConfig = getConfig(app)
455
461
  const { app_id, app_secrect } = await appConfig.getObject(config)
456
462
  const weixinMp = new WeixinMp({
@@ -461,6 +467,7 @@ exports.short_link = async ({ app, page, scene, config = 'weixin_mp' }) => {
461
467
  const result = await weixinMp.createShortLink({
462
468
  page,
463
469
  scene,
470
+ title,
464
471
  })
465
472
  return result
466
473
  }
@@ -370,7 +370,7 @@ module.exports = class Singleton {
370
370
  }
371
371
 
372
372
  async createShortLink(options) {
373
- const { page, scene, ...rest } = options
373
+ const { page, scene, title, ...rest } = options
374
374
  const access_token = await this.getAccessToken()
375
375
  const url = util.format(createShortLinkUrl, access_token)
376
376
  const query = options.scene
@@ -381,7 +381,7 @@ module.exports = class Singleton {
381
381
  const payLoad = {
382
382
  ...rest,
383
383
  page_url: options.page + (query ? '?' + query : ''),
384
- page_title: options.page_title,
384
+ page_title: title,
385
385
  is_permanent: true,
386
386
  }
387
387
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "12.7.4",
3
+ "version": "12.8.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {