Authored by 邱骏

修改appsecret

... ... @@ -140,7 +140,7 @@ const excelLoader = {
res.json(ret).catch(next);
});
},
/**
* 直接读取并插入Y100数据
* @param req
... ...
... ... @@ -32,7 +32,9 @@ let getAccessToken = function(appId, secret, prefix) { // 获取access_token
},
json: true
}).then(res => {
// console.log('getAccessToken=' + JSON.stringify(res));
return res;
});
};
... ... @@ -46,11 +48,12 @@ let getTicket = function(accessToken, appId, secret, prefix) { // 获取ticket
},
json: true
}).then(res => {
// console.log('getTicket=' + JSON.stringify(res));
return res;
});
};
let calcSigature = function(ticket_res) { // 计算signature
let calcSigature = function (ticket_res) { // 计算signature
let appID = ticket_res.appID;
let ticket = ticket_res.access_ticket;
let nonceStr = Math.random().toString(36).substr(2, 15);
... ... @@ -59,6 +62,7 @@ let calcSigature = function(ticket_res) { // 计算signature
let str = `jsapi_ticket=${ticket}&noncestr=${nonceStr}&timestamp=${timestamp}&url=${url}`;
let signature = sha1(str);
// console.log({appID, ticket, nonceStr, timestamp, url, str, signature});
return {
appId: appID,
nonceStr,
... ... @@ -66,6 +70,8 @@ let calcSigature = function(ticket_res) { // 计算signature
url,
signature
};
};
let getResult = function(wechat_res) { // 向微信接口获取access_token及ticket并计算signature
... ... @@ -80,6 +86,7 @@ let getResult = function(wechat_res) { // 向微信接口获取access_token及ti
return getTicket(access_token, appID, appSecret, mpPrefix)
.then(ticket_res => { // 通过accessToken获取ticket
// console.log('getResult=' + JSON.stringify(Object.assign({access_token: access_token, appID: appID}, ticket_res)));
return Object.assign({
access_token: access_token,
appID: appID
... ... @@ -130,8 +137,7 @@ const wechatShare = {
let expired_time = moment().add(expired, 'seconds').format('YYYY-MM-DD HH:mm:ss') || '';
// 获取到ticket信息之后把相关字段保存到数据库中
return req.ctx(WechatModel).
saveAccessKeys(access_token, access_ticket, create_time, expired_time, keys_res.type)
return req.ctx(WechatModel).saveAccessKeys(access_token, access_ticket, create_time, expired_time, keys_res.type)
.then(() => {
return {
appID: appId,
... ...
... ... @@ -85,7 +85,7 @@ module.exports = {
yohoSecret: '3bd815162342d9733f06ab6811082c64',
wechat: {
appID: 'wx1fe49f08f41b6c26',
appSecret: '5670f62abcebcd8d321615b46bd19ef4',
appSecret: '1360c4a89275e1a4a4bbc8f6c5e44587',
token: 'weixin',
prefix: 'https://api.weixin.qq.com/cgi-bin/',
mpPrefix: 'https://api.weixin.qq.com/cgi-bin/'
... ...
No preview for this file type