shawenguan 2 anos atrás
pai
commit
053ffb747b

+ 2 - 2
BoxJsSub/release.json

@@ -175,7 +175,7 @@
                 "https://git.jojo21.cf/shawenguan/Quantumult-X/raw/master/Icons/jhsh.png",
                 "https://git.jojo21.cf/shawenguan/Quantumult-X/raw/master/Icons/jhsh.png"
             ],
-            "keys": ["lkJhshSignReward", "lkJhshSignActInfo", "lkJhshLoginInfo", "lkJhshAppVersion"],
+            "keys": ["lkJhshSignReward", "lkJhshActInfo-A3341A038", "lkJhshLoginInfo", "lkJhshAppVersion"],
             "settings": [
                 {
                     "id": "lkJhshSignReward",
@@ -199,7 +199,7 @@
                     ]
                 },
                 {
-                    "id": "lkJhshSignActInfo",
+                    "id": "lkJhshActInfo-A3341A038",
                     "name": "签到数据",
                     "val": "",
                     "type": "textarea",

+ 1 - 1
Scripts/jhsh/jhsh.rewrite.quanx.conf

@@ -1,3 +1,3 @@
 hostname = yunbusiness.ccb.com
 
-^https:\/\/yunbusiness\.ccb\.com\/(clp_coupon|clp_service)\/txCtrl\?txcode=(A3341A038|autoLogin) url script-request-body https://git.jojo21.cf/shawenguan/Quantumult-X/raw/master/Scripts/jhsh/jhshHelper.js
+^https:\/\/yunbusiness\.ccb\.com\/(clp_coupon|clp_service)\/txCtrl\?txcode=(*) url script-request-body https://git.jojo21.cf/shawenguan/Quantumult-X/raw/master/Scripts/jhsh/jhshHelper.js

+ 40 - 20
Scripts/jhsh/jhshHelper.js

@@ -72,28 +72,48 @@ function checkHandleRequest() {
     lk.log(JSON.stringify($request.headers));
     lk.log(`请求body=${body}`);
     if ($request && $request.method != 'OPTIONS') {
-        if (/A3341A038/.test(url)) {
+        let segments = path.split('/');
+        let queryOptType = segments[0];
+        let queryParams = lk.parseQueryStr(path);
+        let txcode = null;
+        if(queryParams['txcode']){
+            txcode = queryParams['txcode'];
+        }
+        if('clp_service' == optType){
+            switch(txcode){
+                case 'autoLogin':
+                    let DeviceId = $request.headers['DeviceId'] || $request.headers['Deviceid'] || $request.headers['deviceid'];
+                    let MBCUserAgent = $request.headers['MBC-User-Agent'] || $request.headers['Mbc-user-agent'] || $request.headers['mbc-user-agent'];
+                    if($request.headers['AppVersion']){
+                        AppVersion = $request.headers['AppVersion'];
+                        lk.setVal(jhshStoreKeyPrefix+'AppVersion', AppVersion); // 数据持久化
+                    }
+                    if(DeviceId && MBCUserAgent && body){
+                        let autoLoginInfo = {
+                            "DeviceId": DeviceId,
+                            "MBCUserAgent": MBCUserAgent,
+                            "Body": body,
+                        }
+                        lk.setVal(jhshStoreKeyPrefix+'LoginInfo', JSON.stringify(autoLoginInfo));
+                        lk.log(' 建行生活登录数据写入成功');
+                        lk.appendNotifyInfo('🎉 建行生活自动登录数据获取成功');
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }else if('clp_coupon' == optType){
             let MID = $request.headers['MID'] || $request.headers['Mid'] || $request.headers['mid'];
             let obj = JSON.parse(body);
             obj['MID'] = MID;
-            lk.setVal(jhshStoreKeyPrefix+'SignActInfo', JSON.stringify(obj));
-            lk.appendNotifyInfo('🎉 建行生活签到数据获取成功');
-        } else if (/autoLogin/.test(url)) {
-            let DeviceId = $request.headers['DeviceId'] || $request.headers['Deviceid'] || $request.headers['deviceid'];
-            let MBCUserAgent = $request.headers['MBC-User-Agent'] || $request.headers['Mbc-user-agent'] || $request.headers['mbc-user-agent'];
-            if($request.headers['AppVersion']){
-                AppVersion = $request.headers['AppVersion'];
-                lk.setVal(jhshStoreKeyPrefix+'AppVersion', AppVersion); // 数据持久化
-            }
-            if(DeviceId && MBCUserAgent && body){
-                let autoLoginInfo = {
-                    "DeviceId": DeviceId,
-                    "MBCUserAgent": MBCUserAgent,
-                    "Body": body,
-                }
-                lk.setVal(jhshStoreKeyPrefix+'LoginInfo', JSON.stringify(autoLoginInfo));
-                lk.log(' 建行生活登录数据写入成功');
-                lk.appendNotifyInfo('🎉 建行生活自动登录数据获取成功');
+            lk.setVal(jhshStoreKeyPrefix+'ActInfo-'+txcode, JSON.stringify(obj));
+            lk.log(`建行生活活动数据[${txcode}]获取成功`);
+            switch(txcode){
+                case 'A3341A038':
+                    lk.appendNotifyInfo('🎉 建行生活签到数据获取成功');
+                    break;
+                default:
+                    break;
             }
         }
     }
@@ -101,7 +121,7 @@ function checkHandleRequest() {
 
 async function all() {
     // await getLatestVersion(); // 获取版本信息
-    const signActInfoStr = lk.getVal(jhshStoreKeyPrefix+'SignActInfo');
+    const signActInfoStr = lk.getVal(jhshStoreKeyPrefix+'ActInfo-A3341A038');
     const signActInfoArr = signActInfoStr ? signActInfoStr.split('|') : [];
     const loginInfoStr = lk.getVal(jhshStoreKeyPrefix+'LoginInfo');
     const loginInfoArr = loginInfoStr ? loginInfoStr.split('|') : [];

+ 10 - 10
Scripts/jhsh/jhsh_checkIn.js

@@ -113,10 +113,10 @@ if (isGetCookie = typeof $request !== `undefined`) {
                     for (let j = 0; j < $.giftList.length; j++) {
                         if ($.isGetGift) break;
                         let item = $.giftList[j]
-                        $.couponId = item ? .couponId;
-                        $.nodeDay = item ? .nodeDay;
-                        $.couponType = item ? .couponType;
-                        $.dccpBscInfSn = item ? .dccpBscInfSn;
+                        $.couponId = item?.couponId;
+                        $.nodeDay = item?.nodeDay;
+                        $.couponType = item?.couponType;
+                        $.dccpBscInfSn = item?.dccpBscInfSn;
                         $.continue = false;
                         console.log(`尝试领取[${giftMap[giftType]}]券`);
                         for (let k = 1; k <= 3; k++) {
@@ -213,7 +213,7 @@ async function autoLogin() {
             try {
                 let result = $.toObj(data) || response.body;
                 // 如果数据未加密,则 session 未过期
-                if (result ? .errCode) {
+                if (result?.errCode) {
                     // {"newErrMsg":"未能处理您的请求。如有疑问,请咨询在线客服或致电95533","data":"","reqFlowNo":"","errCode":"0","errMsg":"session未失效,勿重复登录"}
                     // $.token = $.getdata('JHSH_TOKEN');
                     console.log(`${result?.errMsg}`);
@@ -269,12 +269,12 @@ async function main() {
                         text = `🎉 账号 [${$.info?.USR_TEL ? hideSensitiveData($.info?.USR_TEL, 3, 4) : $.index}] 签到成功`;
                         console.log(text);
                         message += text;
-                        if (data ? .data ? .IS_AWARD == 1) {
-                            $.GIFT_BAG = data ? .data ? .GIFT_BAG;
+                        if (data?.data?.IS_AWARD == 1) {
+                            $.GIFT_BAG = data?.data?.GIFT_BAG;
                             $.GIFT_BAG.forEach(item => {
                                 let body = { "couponId": item.couponId, "nodeDay": item.nodeDay, "couponType": item.couponType, "dccpBscInfSn": item.dccpBscInfSn };
-                                if (new RegExp(`${giftMap[giftType]}`).test(item ? .couponName)) {
-                                    if (/信用卡/.test(item ? .couponName)) {
+                                if (new RegExp(`${giftMap[giftType]}`).test(item?.couponName)) {
+                                    if (/信用卡/.test(item?.couponName)) {
                                         $.giftList.unshift(body);
                                     } else {
                                         $.giftList.push(body);
@@ -284,7 +284,7 @@ async function main() {
                                 }
                             })
                             $.giftList = [...$.giftList, ...$.giftList2];
-                        } else if (data ? .data ? .NEST_AWARD_DAY >= 1) {
+                        } else if (data?.data?.NEST_AWARD_DAY >= 1) {
                             text = `继续签到${data.data.NEST_AWARD_DAY}天可领取${giftMap[giftType]}券`;
                             message += `,${text}\n`;
                             console.log(text);