Authored by 王水玲

分享参数可配置

... ... @@ -4,14 +4,28 @@
*/
'use strict';
const wechatModel = require('../models/wechat');
const conf = {
'community': { //此处是社区分享
appId: 'wx96121aa89f31c5ea',
secret: '7669da1a8842ed1df4c5e1b53868f3ca'
},
'default': { //此处使用的是 女生志 的appId
appId: 'wxb52ec6a352f0b090',
secret: '9fe6bedb0b7f30986a168c7fc44f34c0'
}
};
exports.wechatShare = (req, res, next) => {
let params = {
appId: req.query.appId || 'wxb52ec6a352f0b090', //此处使用的是 女生志 的appId
secret: req.query.secret || '9fe6bedb0b7f30986a168c7fc44f34c0',
url: req.query.url || 'http://www.yohobuy.com/'
};
if (req.query.confType) {
params = Object.assign(conf[req.query.confType], params);
} else {
params = Object.assign(conf.default, params);
}
wechatModel.calcSignature(params).then((result) => {
res.jsonp(result);
}).catch(next);
... ...