Authored by ccbikai

api 支持签名

... ... @@ -12,6 +12,7 @@ const _ = require('lodash');
const log = require('./logger');
const cache = require('./cache');
const Timer = require('./timer');
const sign = require('./sign');
const config = require('../config/common');
const api = config.domains.api;
const serviceApi = config.domains.service;
... ... @@ -131,7 +132,7 @@ class Http {
get(url, data, cacheOption) {
const options = {
url: `${this.ApiUrl}${url}`,
qs: data,
qs: data.client_secret ? data : sign.apiSign(data),
json: true,
timeout: 3000
};
... ... @@ -152,7 +153,7 @@ class Http {
post(url, data) {
const options = {
url: `${this.ApiUrl}${url}`,
form: data,
form: data.client_secret ? data : sign.apiSign(data),
method: 'post',
json: true,
timeout: 3000
... ...