|
|
@@ -163,7 +163,7 @@ function getLastToken(token) {
|
|
|
}
|
|
|
|
|
|
async function trySecKill() {
|
|
|
- let execCount = 1;
|
|
|
+ let execCount = 10;
|
|
|
let tipsText = '';
|
|
|
for (let i = 0; i < execCount; i++) {
|
|
|
let result = await doSecKill();
|
|
|
@@ -177,6 +177,47 @@ async function trySecKill() {
|
|
|
magicJS.notification.appendNotifyInfo(tipsText);
|
|
|
}
|
|
|
|
|
|
+async function getSecKillData() {
|
|
|
+ // 获取 msTaskId 来自 https://b.pingan.com.cn/creditcard/mk8point8/8point8.76984f16.js?76984f16092162948723
|
|
|
+ let token = getSessionToken();
|
|
|
+ let lastToken = getLastToken(token);
|
|
|
+ let webTagInfoArr = [
|
|
|
+ 'module=8point8',
|
|
|
+ `token=${token}`,
|
|
|
+ `lastToken=${lastToken}`,
|
|
|
+ ];
|
|
|
+ let reqData = {
|
|
|
+ serviceVersion: '1.0',
|
|
|
+ osType: '1',
|
|
|
+ channel: '1',
|
|
|
+ version: '1.5.0',
|
|
|
+ random: Math.random(),
|
|
|
+ webTagInfo: encodeURIComponent(webTagInfoArr.join(',')),
|
|
|
+ 'addWebTagInfoList[]': encodeURIComponent('module=8point8'),
|
|
|
+ }
|
|
|
+ let url = `https://rmb.pingan.com.cn/credit/core/cust/ma/online/pabank/ma/pm/others/seckill/doKill`;
|
|
|
+ let headers = gCommonHeaders;
|
|
|
+ let options = {
|
|
|
+ url: url,
|
|
|
+ headers: headers,
|
|
|
+ body: `${magicJS.objToQueryStr(reqData)}`,
|
|
|
+ };
|
|
|
+ let result = await magicJS.http.post(options).then(response => {
|
|
|
+ try {
|
|
|
+ let rspData = response.body;
|
|
|
+ magicJS.logger.info(`response=${JSON.stringify(response)}`);
|
|
|
+ magicJS.logger.info(`rspData=${JSON.stringify(rspData)}`);
|
|
|
+ return rspData;
|
|
|
+ } catch (e) {
|
|
|
+ magicJS.logger.error(e);
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ const msg = `请求商品秒杀异常\n${JSON.stringify(err)}`;
|
|
|
+ magicJS.logger.error(msg);
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
async function doSecKill() {
|
|
|
let token = getSessionToken();
|
|
|
let lastToken = getLastToken(token);
|