var request = require('request'); var cryptoJS = require("crypto-js"); var logHelper = require("./LjLogHelper"); /** * The helper of http */ class LjHttpHelper { static request(optinons,callback) { //签名 const signStr = 'path='+optinons.url+'&uid='+optinons.uid+'&eid='+optinons.eid+'&'+optinons.token; const sign = cryptoJS.MD5(signStr).toString(); logHelper.info(optinons); let headers = { 'Content-Type':'application/json', 'eid':optinons.eid, 'uid':optinons.uid, 'sign':sign, 'terminal':"web", 'merchant':"angelbell", 'requestId':"11111111111111", }; let optionsObj = {}; optionsObj.url = optinons.url; optionsObj.headers = headers; logHelper.info(optionsObj); request(optionsObj, callback); } } module.exports = LjHttpHelper;