欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

post

程序员文章站 2022-07-13 08:54:05
...
var token;
var loginBody = {};
loginBody.method = "com.yuyuka.billiards.api.openid.login";
loginBody.channelCode = "h5_api_get";
loginBody.timestamp = "12123";
loginBody.bizContent = "{\"openId\":\"obuTr5ptkCU6tCVJ7iDKQehSwqpo\"}";
var signStr = loginBody.channelCode + loginBody.bizContent+"EqlgPZWo";
var sign = CryptoJS.MD5(signStr);
loginBody.sign = sign.toString();
const loginUser = {
  url: 'http://127.0.0.1:8081/api/gateway',
  method: 'POST',
  header: ['Content-Type: application/json'],
  body: JSON.stringify(loginBody)
};

console.log("请求登录 :" + JSON.stringify(loginBody));
pm.sendRequest(loginUser, function (err, res) {
    var bizContent = JSON.parse(res.json().bizContent);
    var body = JSON.parse(pm.request.body.raw);
    var signStr = body.channelCode + body.bizContent+"EqlgPZWo";
    var sign = CryptoJS.MD5(signStr);
    console.log("sign " + sign);
    console.log("token : " + bizContent.token);
    pm.environment.set("sign", sign.toString());
    pm.environment.set("userToken", bizContent.token);
});
{
	"method":"com.yuyuka.billiards.api.authorized.vip.consume.log.list",
	"channelCode":"h5_api_get",
	"timestamp":"123123",
	"bizContent":"{}",
	"deviceInfo":"deviceInfo",
	"sign":"{{sign}}",
	"token":"{{userToken}}"
}
相关标签: 技术总结