Authored by 王水玲

Merge branch 'develop' into feature/activity

... ... @@ -5,8 +5,7 @@
*/
'use strict';
const qs = require('querystring');
const _ = require('lodash');
const md5 = require('md5');
const privateKey = {
... ... @@ -39,15 +38,23 @@ const packageSort = argument => {
* @return {string} 生成的签名字符串
*/
const makeSign = argument => {
return md5(qs.stringify(argument)).toLowerCase();
let qs = [];
_.forEach(argument, function(value, key) {
qs.push(key + '=' + _.trim(value));
});
return md5(qs.join('&')).toLowerCase();
};
// 生成API签名,调用后端接口的时候有私钥校验
exports.apiSign = (params) => {
const clientType = params.client_type || 'web';
/* eslint-disable */
var sign = packageSort(Object.assign({
client_type: 'h5',
private_key: privateKey.h5,
let sign = packageSort(Object.assign({
client_type: clientType,
private_key: privateKey[clientType],
app_version: '3.8.2',
os_version: 'yohobuy:h5',
screen_size: '720x1280',
... ...