|
@@ -4,14 +4,28 @@ |
|
@@ -4,14 +4,28 @@ |
4
|
*/
|
4
|
*/
|
5
|
'use strict';
|
5
|
'use strict';
|
6
|
const wechatModel = require('../models/wechat');
|
6
|
const wechatModel = require('../models/wechat');
|
|
|
7
|
+const conf = {
|
|
|
8
|
+ 'community': { //此处是社区分享
|
|
|
9
|
+ appId: 'wx96121aa89f31c5ea',
|
|
|
10
|
+ secret: '7669da1a8842ed1df4c5e1b53868f3ca'
|
|
|
11
|
+ },
|
|
|
12
|
+ 'default': { //此处使用的是 女生志 的appId
|
|
|
13
|
+ appId: 'wxb52ec6a352f0b090',
|
|
|
14
|
+ secret: '9fe6bedb0b7f30986a168c7fc44f34c0'
|
|
|
15
|
+ }
|
|
|
16
|
+};
|
7
|
|
17
|
|
8
|
exports.wechatShare = (req, res, next) => {
|
18
|
exports.wechatShare = (req, res, next) => {
|
9
|
let params = {
|
19
|
let params = {
|
10
|
- appId: req.query.appId || 'wxb52ec6a352f0b090', //此处使用的是 女生志 的appId
|
|
|
11
|
- secret: req.query.secret || '9fe6bedb0b7f30986a168c7fc44f34c0',
|
|
|
12
|
url: req.query.url || 'http://www.yohobuy.com/'
|
20
|
url: req.query.url || 'http://www.yohobuy.com/'
|
13
|
};
|
21
|
};
|
14
|
|
22
|
|
|
|
23
|
+ if (req.query.confType) {
|
|
|
24
|
+ params = Object.assign(conf[req.query.confType], params);
|
|
|
25
|
+ } else {
|
|
|
26
|
+ params = Object.assign(conf.default, params);
|
|
|
27
|
+ }
|
|
|
28
|
+
|
15
|
wechatModel.calcSignature(params).then((result) => {
|
29
|
wechatModel.calcSignature(params).then((result) => {
|
16
|
res.jsonp(result);
|
30
|
res.jsonp(result);
|
17
|
}).catch(next);
|
31
|
}).catch(next);
|