shawenguan 1 tahun lalu
induk
melakukan
7afe8cae25
1 mengubah file dengan 124 tambahan dan 109 penghapusan
  1. 124 109
      Scripts/imoutai/imoutaiHelper.js

+ 124 - 109
Scripts/imoutai/imoutaiHelper.js

@@ -122,6 +122,10 @@ async function main() {
             });
         }
     }
+    let retAward = await getUserEnergyAward();
+    if(retAward){
+        msgItems.push(retAward);
+    }
     lk.log("#############4");
     let msg = '';
     for(let i=0; i < msgItems.length; i++){
@@ -333,21 +337,20 @@ async function mtAdd(sessionId, itemId, shopId, userId, token, deviceId) {
         "MT-Token": token,
         "MT-User-Tag": "0",
         "MT-R": G_MT_R,
-        "mt-lat": iMT_Location.lat,
-        "mt-lng": iMT_Location.lng,
-        "mt-k": mtK,
-        "content-length": "257",
-        "mt-info": "028e7f96f6369cafe1d105579c5b9377",
-        "mt-team-id": "",
-        "mt-app-version": G_MT_VERSION,
-        "mt-request-id": getMTRequestId(),
+        "MT-Info": "028e7f96f6369cafe1d105579c5b9377",
+        "MT-Team-ID": "",
+        "MT-APP-Version": G_MT_VERSION,
+        "MT-Request-ID": getMTRequestId(),
         "Accept-Language": "zh-Hans-CN;q=1",
         "MT-Device-ID": deviceId,
-        "accept": "*/*",
-        "content-type": "application/json",
-        "accept-encoding": "gzip, deflate, br",
+        "Accept": "*/*",
+        "Content-Type": "application/json",
+        "Accept-Encoding": "gzip, deflate, br",
         "MT-Bundle-ID": "com.moutai.mall",
-        "mt-v": mtV,
+        "MT-K": mtK,
+        "MT-V": mtV,
+        "MT-Lng": iMT_Location.lng,
+        "MT-Lat": iMT_Location.lat,
     };
 
     const d = {
@@ -404,19 +407,19 @@ async function getSessionId(deviceId, token, zeroTimeStamp) {
             const headers = {
                 "MT-Device-ID": deviceId,
                 "MT-User-Tag": "0",
-                "mt-lat": "23.122443",
-                "accept": "*/*",
+                "Accept": "*/*",
                 "MT-Network-Type": "WIFI",
                 "MT-Token": token,
-                "mt-team-id": "",
+                "MT-Team-ID": "",
                 "MT-Bundle-ID": "com.moutai.mall",
                 "Accept-Language": "zh-Hans-CN;q=1",
-                "mt-app-version": G_MT_VERSION,
+                "MT-APP-Version": G_MT_VERSION,
                 "User-Agent": G_USER_AGENT,
-                "mt-request-id": getMTRequestId(),
+                "MT-Request-ID": getMTRequestId(),
                 "MT-R": G_MT_R,
-                "mt-lng": "113.380126",
-                "accept-encoding": "gzip, deflate, br"
+                "Accept-Encoding": "gzip, deflate, br",
+                "MT-Lat": "23.122443",
+                "MT-Lng": "113.380126",
             };
             const body = '';
             const url = `https://static.moutai519.com.cn/mt-backend/xhr/front/mall/index/session/get/${zeroTimeStamp}`;
@@ -463,19 +466,19 @@ async function getShopItem(sessionId, itemId, token, deviceId, province, city, z
             const headers = {
                 "MT-Device-ID": deviceId,
                 "MT-User-Tag": "0",
-                "accept": "*/*",
+                "Accept": "*/*",
                 "MT-Network-Type": "WIFI",
                 "MT-Token": token,
-                "mt-team-id": "",
+                "MT-Team-ID": "",
                 "MT-Bundle-ID": "com.moutai.mall",
                 "Accept-Language": "zh-Hans-CN;q=1",
-                "mt-app-version": G_MT_VERSION,
+                "MT-APP-Version": G_MT_VERSION,
                 "User-Agent": G_USER_AGENT,
-                "mt-request-id": getMTRequestId(),
+                "MT-Request-ID": getMTRequestId(),
                 "MT-R": G_MT_R,
-                "mt-lng": iMT_Location.lng,
-                "mt-lat": iMT_Location.lat,
-                "accept-encoding": "gzip, deflate, br"
+                "Accept-Encoding": "gzip, deflate, br",
+                "MT-Lng": iMT_Location.lng,
+                "MT-Lat": iMT_Location.lat,
             };
             const body = '';
             const url = `https://static.moutai519.com.cn/mt-backend/xhr/front/mall/shop/list/slim/v3/${sessionId}/${encodeURIComponent(province)}/${itemId}/${zeroTimeStamp}`;
@@ -527,17 +530,17 @@ async function getUserId(token, deviceId) {
             const headers = {
                 "MT-Device-ID": deviceId,
                 "MT-User-Tag": "0",
-                "accept": "*/*",
+                "Accept": "*/*",
                 "MT-Network-Type": "WIFI",
                 "MT-Token": token,
-                "mt-team-id": "",
+                "MT-Team-ID": "",
                 "MT-Bundle-ID": "com.moutai.mall",
                 "Accept-Language": "zh-Hans-CN;q=1",
-                "mt-app-version": G_MT_VERSION,
+                "MT-APP-Version": G_MT_VERSION,
                 "User-Agent": G_USER_AGENT,
                 "MT-R": G_MT_R,
-                "mt-request-id": getMTRequestId(),
-                "accept-encoding": "gzip, deflate, br"
+                "MT-Request-ID": getMTRequestId(),
+                "Accept-Encoding": "gzip, deflate, br"
             };
             const body = '';
             const url = `https://app.moutai519.com.cn/xhr/front/user/info`;
@@ -571,66 +574,6 @@ async function getUserId(token, deviceId) {
     });
 }
 
-
-async function getUserEnergyAward(deviceId, token) {
-    return new Promise((resolve, _reject) => {
-        try {
-            const cookies = {
-                'MT-Device-ID-Wap': deviceId,
-                'MT-Token-Wap': token,
-                'YX_SUPPORT_WEBP': '1',
-            };
-            const headers = {
-                'X-Requested-With': 'XMLHttpRequest',
-                'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X)',
-                'Client-User-Agent': 'iOS;15.0.1;Apple;iPhone 12 ProMax',
-                'MT-Device-id': deviceId,
-                'MT-User-Tag': '0',
-                'Accept': 'application/json, text/javascript, */*; q=0.01',
-                'MT-Network-Type': 'WIFI',
-                'MT-Bundle-ID': 'com.moutai.mall',
-                'Accept-Language': 'zh-Hans-CN;q=1',
-                'MT-Request-ID': `${new Date().getTime()}`,
-                'MT-APP-Version': G_MT_VERSION,
-                'User-Agent': 'iPhone 14',
-                'MT-R': G_MT_R,
-                'mt-lng': iMT_Location.lng,
-                'mt-lat': iMT_Location.lat,
-                'Cookie': lk.serializeCookies(cookies),
-                'Origin': 'https://h5.moutai519.com.cn',
-                'Referer': 'https://h5.moutai519.com.cn/gux/game/main?appConfig=2_1_2',
-            };
-            const body = '';
-            const url = `https://h5.moutai519.com.cn/game/isolationPage/getUserEnergyAward`;
-            let options = {
-                url: url,
-                headers: headers,
-                body: body
-            };
-            lk.get(options, async (error, _response, data) => {
-                let ret;
-                try {
-                    if (error) {
-                        lk.execFail();
-                    } else {
-                        const jsonRetObj = JSON.parse(data);
-                        const rspData = jsonRetObj.data || {};
-                        ret = rspData;
-                    }
-                } catch (e) {
-                    lk.logErr(e);
-                    lk.execFail();
-                } finally {
-                    resolve(ret);
-                }
-            });
-        } catch (e) {
-            lk.logErr(e);
-            resolve();
-        }
-    });
-}
-
 function getRandomNumber(min, max) {
     return Math.floor(Math.random() * (max - min + 1)) + min;
 }
@@ -643,7 +586,7 @@ async function getProvinceCityMapUrl() {
                 'X-Requested-With': 'XMLHttpRequest',
                 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0_1 like Mac OS X)',
                 'Referer': 'https://h5.moutai519.com.cn/gux/game/main?appConfig=2_1_2',
-                'Client-User-Agent': 'iOS;16.0.1;Apple;iPhone 14 ProMax',
+                'Client-User-Agent': 'iOS;16.6.1;Apple;iPhone 14 Pro',
                 'MT-R': G_MT_R,
                 'Origin': 'https://h5.moutai519.com.cn',
                 'MT-APP-Version': G_MT_VERSION,
@@ -651,8 +594,8 @@ async function getProvinceCityMapUrl() {
                 'Accept-Language': 'zh-CN,zh-Hans;q=1',
                 'MT-Device-id': `${mSecondsStr}${getRandomNumber(1111111, 999999999)}${mSecondsStr}`,
                 'Accept': 'application/json, text/javascript, */*; q=0.01',
-                'mt-lng': iMT_Location.lng,
-                'mt-lat': iMT_Location.lat
+                'MT-Lng': iMT_Location.lng,
+                'MT-Lat': iMT_Location.lat
             };
             const body = '';
             const url = `https://static.moutai519.com.cn/mt-backend/xhr/front/mall/resource/get`;
@@ -734,24 +677,96 @@ async function getProvinceCityMapData() {
     });
 }
 
+async function getUserEnergyAward(deviceId, token) {
+    return new Promise((resolve, _reject) => {
+        try {
+            const cookies = {
+                'MT-Device-ID-Wap': deviceId,
+                'MT-Token-Wap': token,
+                'YX_SUPPORT_WEBP': '1',
+            };
+            const headers = {
+                'X-Requested-With': 'XMLHttpRequest',
+                'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X)',
+                'Client-User-Agent': 'iOS;15.0.1;Apple;iPhone 12 ProMax',
+                'MT-Device-id': deviceId,
+                'MT-User-Tag': '0',
+                'Accept': 'application/json, text/javascript, */*; q=0.01',
+                'MT-Network-Type': 'WIFI',
+                'MT-Bundle-ID': 'com.moutai.mall',
+                'Accept-Language': 'zh-Hans-CN;q=1',
+                'MT-Request-ID': `${new Date().getTime()}`,
+                'MT-APP-Version': G_MT_VERSION,
+                'MT-R': G_MT_R,
+                'Cookie': lk.serializeCookies(cookies),
+                'Origin': 'https://h5.moutai519.com.cn',
+                'Referer': 'https://h5.moutai519.com.cn/gux/game/main?appConfig=2_1_2',
+                'MT-Lng': iMT_Location.lng,
+                'MT-Lat': iMT_Location.lat,
+            };
+            const body = '';
+            const url = `https://h5.moutai519.com.cn/game/isolationPage/getUserEnergyAward`;
+            let options = {
+                url: url,
+                headers: headers,
+                body: body
+            };
+            lk.get(options, async (error, _response, data) => {
+                let ret;
+                try {
+                    if (error) {
+                        lk.execFail();
+                    } else {
+                        const jsonRetObj = JSON.parse(data);
+                        if(jsonRetObj.code == 200){
+                            const rspData = jsonRetObj.data || {};
+                            ret = {
+                                name: "耐力",
+                                value: `✅领取耐力成功`,
+                            };
+                            const awardRule = rspData.awardRule;
+                            if(awardRule){
+                                ret.value = `✅领取${awardRule[0].goodName}+${awardRule[0].count}`;
+                            }
+                        }else{
+                            ret = {
+                                name: "耐力",
+                                value: jsonRetObj.message,
+                            };
+                        }
+                    }
+                } catch (e) {
+                    lk.logErr(e);
+                    lk.execFail();
+                } finally {
+                    resolve(ret);
+                }
+            });
+        } catch (e) {
+            lk.logErr(e);
+            resolve();
+        }
+    });
+}
+
 async function login(phone, vCode, deviceId) {
     const mtK = `${new Date().getTime()}`;
     const mtV = await getMtv(deviceId, G_MT_VERSION);
     const headers = {
         'MT-Device-ID': deviceId,
         'MT-User-Tag': '0',
-        'accept': '*/*',
+        'Accept': '*/*',
         'MT-Network-Type': 'WIFI',
         'MT-Token': '',
-        "mt-team-id": "",
-        'mt-k': mtK,
+        "MT-Team-ID": "",
         'MT-Bundle-ID': 'com.moutai.mall',
-        'mt-v': mtV,
-        'User-Agent': 'iOS;16.0.1;Apple;iPhone 14 ProMax',
+        'User-Agent': 'iOS;16.6.1;Apple;iPhone 14 Pro',
         'Accept-Language': 'zh-Hans-CN;q=1',
-        'mt-request-id': `${new Date().getTime()}18342`,
+        'MT-Request-ID': `${new Date().getTime()}18342`,
         'MT-R': G_MT_R,
-        'mt-app-version': G_MT_VERSION,
+        'MT-APP-Version': G_MT_VERSION,
+        'MT-K': mtK,
+        'MT-V': mtV,
     };
     return new Promise((resolve, _reject) => {
         try {
@@ -793,21 +808,21 @@ async function login(phone, vCode, deviceId) {
 
 async function getLoginVCode(mobile, deviceId) {
     const headers = {
-        "content-type": "application/json",
+        "Content-Type": "application/json",
         "MT-Device-ID": deviceId,
         "MT-User-Tag": "0",
-        "accept": "*/*",
+        "Accept": "*/*",
         "MT-Network-Type": "WIFI",
         "MT-Token": "",
-        "mt-team-id": "",
+        "MT-Team-ID": "",
         "Accept-Language": "zh-Hans-CN;q=1",
-        "bs-dvid": "2Sm2hFjywxztKDX9gqT1T5dL3COGJA-L2cWr5_E8aLjndr7-Sy0gx8JuiwLa6uPC-RPQY1azn6-c8vVloGoZ57g",
-        "mt-request-id": `${new Date().getTime()}40625`,
-        "mt-app-version": "1.5.9",
-        "User-Agent": "iOS;16.6.1;Apple;?unrecognized?",
+        "BS-DVID": "2Sm2hFjywxztKDX9gqT1T5dL3COGJA-L2cWr5_E8aLjkoTAq_Upmlb8-Qq-MaHzAMS1VdAcV7rXmopcbiJtvDpw",
+        "MT-Request-ID": `${new Date().getTime()}40625`,
+        "MT-APP-Version": G_MT_VERSION,
+        "User-Agent": 'iOS;16.6.1;Apple;iPhone 14 Pro',
         "MT-R": G_MT_R,
         "MT-Bundle-ID": "com.moutai.mall",
-        "accept-encoding": "gzip, deflate, br"
+        "Accept-Encoding": "gzip, deflate, br"
     };
     return new Promise((resolve, _reject) => {
         try {