shawenguan 1 год назад
Родитель
Сommit
9677ecb44b
1 измененных файлов с 17 добавлено и 8 удалено
  1. 17 8
      Scripts/imoutai/imoutaiHelper.js

+ 17 - 8
Scripts/imoutai/imoutaiHelper.js

@@ -6,8 +6,9 @@
 
 [rewrite_local]
 
-^http[s]?:\/\/app.moutai519.com.cn url script-request-body https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/imoutai/imoutaiHelper.js
-^http[s]?:\/\/app.moutai519.com.cn url script-response-body https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/imoutai/imoutaiHelper.js
+^http[s]?:\/\/app\.moutai519\.com\.cn\/xhr\/front\/mall\/message\/unRead\/query url script-request-header https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/imoutai/imoutaiHelper.js
+^http[s]?:\/\/app\.moutai519\.com\.cn url script-request-body https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/imoutai/imoutaiHelper.js
+^http[s]?:\/\/app\.moutai519\.com\.cn url script-response-body https://git.jojo21.top/shawenguan/Quantumult-X/raw/master/Scripts/imoutai/imoutaiHelper.js
 
 [MITM]
 
@@ -78,7 +79,9 @@ async function main() {
     let sourceData = mapDataRet[1];
 
     lk.log("#############0");
-    let sessionId = await getSessionId(userData.userId, userData.token, Date.now());
+    let nowDate = parseInt((new Date().getTime() / 1000).toString());  // 当前时间戳
+    let zeroTimeStamp = (nowDate - (nowDate % 86400) - 3600 * 8) * 1000;  // 今日零点时间戳
+    let sessionId = await getSessionId(userData.userId, userData.token, zeroTimeStamp);
     let itemCodes = iMT_BuyItemCodes;
     let province = iMT_Location.province;
     let city = iMT_Location.city;
@@ -96,7 +99,7 @@ async function main() {
     for(let i=0; i < itemCodes.length;i++){
         const itemId = itemCodes[i];
         lk.log("#############2");
-        let maxShopId = await getShopItem(sessionId,itemId,userData.token,userData.deviceId,province,city,Date.now());
+        let maxShopId = await getShopItem(sessionId,itemId,userData.token,userData.deviceId,province,city,zeroTimeStamp);
         if(maxShopId == '0'){
             continue;
         }
@@ -133,6 +136,8 @@ function checkHandleRequest() {
             handleLogin();
         } else if (path.match(/\/xhr\/front\/user\/info/)) {
             handleUserInfo();
+        } else if (path.match(/\/xhr\/front\/mall\/message\/unRead\/query/)) {
+            handleMessageUnRead();
         }
     }
 }
@@ -224,6 +229,10 @@ function handleUserInfo() {
     }
 }
 
+function handleMessageUnRead(){
+
+}
+
 function getUserData() {
     let data = {
         userId: lk.getVal('lkMTUserId'),
@@ -381,7 +390,7 @@ async function mtAdd(sessionId, itemId, shopId, userId, token, deviceId) {
 }
 
 
-async function getSessionId(deviceId, token, timeKeys) {
+async function getSessionId(deviceId, token, zeroTimeStamp) {
     return new Promise((resolve, _reject) => {
         try {
             const headers = {
@@ -402,7 +411,7 @@ async function getSessionId(deviceId, token, timeKeys) {
                 "accept-encoding": "gzip, deflate, br"
             };
             const body = '';
-            const url = `https://static.moutai519.com.cn/mt-backend/xhr/front/mall/index/session/get/${timeKeys}`;
+            const url = `https://static.moutai519.com.cn/mt-backend/xhr/front/mall/index/session/get/${zeroTimeStamp}`;
             let options = {
                 url: url,
                 headers: headers,
@@ -441,7 +450,7 @@ function getMTRequestId() {
     return `${new Date().getTime()}${getRandomNumber(11111, 99999)}`;
 }
 
-async function getShopItem(sessionId, itemId, token, deviceId, province, city, timeKeys) {
+async function getShopItem(sessionId, itemId, token, deviceId, province, city, zeroTimeStamp) {
     return new Promise((resolve, _reject) => {
         try {
             const headers = {
@@ -462,7 +471,7 @@ async function getShopItem(sessionId, itemId, token, deviceId, province, city, t
                 "accept-encoding": "gzip, deflate, br"
             };
             const body = '';
-            const url = `https://static.moutai519.com.cn/mt-backend/xhr/front/mall/shop/list/slim/v3/${sessionId}/${province}/${city}/${timeKeys}`;
+            const url = `https://static.moutai519.com.cn/mt-backend/xhr/front/mall/shop/list/slim/v3/${sessionId}/${province}/${city}/${zeroTimeStamp}`;
             let options = {
                 url: url,
                 headers: headers,