1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
var CryptoJS = require("crypto-js");
// select channel_app_id,sign_secret from mmp_brand_channel_app;
var channelIdToAppSecret = {
"11111111":"11111111111111111111111111111111",
"300000001":"300000001300000001300000001300000001",
"300000002":"300000002300000002300000002300000002",
"300000003":"300000003300000003300000003300000003",
"300000004":"300000004300000004300000004300000004"
}
var body = JSON.parse(request.data)
var appId = body.appId
var appSecret = channelIdToAppSecret[appId]
var timestamp = Date.parse(new Date()) / 1000
var data = JSON.stringify(body.data)
var sign = CryptoJS.MD5(appId + appSecret + timestamp + data).toString().toUpperCase()
console.log(appId)
console.log(appSecret)
console.log(timestamp)
console.log(sign)
console.log(data)
postman.setEnvironmentVariable('timestamp', timestamp);
postman.setEnvironmentVariable('sign', sign);
|