shawenguan преди 2 години
родител
ревизия
69a405b33e
променени са 1 файла, в които са добавени 28 реда и са изтрити 2 реда
  1. 28 2
      Scripts/jhsh/jhshHelper.js

+ 28 - 2
Scripts/jhsh/jhshHelper.js

@@ -84,6 +84,7 @@ function checkHandleRequest() {
         }
         lk.log('queryOptType='+queryOptType);
         lk.log('txcode='+String(txcode));
+        let notifyCount = checkTodayNotifyCount();
         if('clp_service' == queryOptType){
             switch(txcode){
                 case 'autoLogin':
@@ -101,7 +102,9 @@ function checkHandleRequest() {
                         }
                         lk.setVal(jhshStoreKeyPrefix+'LoginInfo', JSON.stringify(autoLoginInfo));
                         lk.log(' 建行生活登录数据写入成功');
-                        lk.appendNotifyInfo('🎉 建行生活自动登录数据获取成功');
+                        if(notifyCount < 2){
+                            lk.appendNotifyInfo('🎉 建行生活自动登录数据获取成功');
+                        }
                     }
                     break;
                 default:
@@ -115,7 +118,9 @@ function checkHandleRequest() {
             lk.log(`建行生活活动数据[${txcode}]获取成功`);
             switch(txcode){
                 case 'A3341A038':
-                    lk.appendNotifyInfo('🎉 建行生活签到数据获取成功');
+                    if(notifyCount < 2){
+                        lk.appendNotifyInfo('🎉 建行生活签到数据获取成功');
+                    }
                     break;
                 default:
                     break;
@@ -124,6 +129,27 @@ function checkHandleRequest() {
     }
 }
 
+function checkTodayNotifyCount(){
+    let notifyCntStr = lk.getVal(jhshStoreKeyPrefix+'NotifyCnt');
+    let td = lk.formatDate(new Date(), 'yyyyMMdd');
+    let n = 0;
+    if(notifyCntStr){
+        let [date, num] = notifyCntStr.split('_');
+        if (date == td && num) {
+            n = Number(num) + 1;
+            lk.setVal(jhshStoreKeyPrefix+'NotifyCnt', `${td}_${n}`);
+            return n;
+        } else {
+            n = n + 1;
+            lk.setVal(jhshStoreKeyPrefix+'NotifyCnt', `${td}_${n}`);
+            return n;
+        }
+    }else{
+        n = n + 1;
+        lk.setVal(jhshStoreKeyPrefix+'NotifyCnt', `${td}_${n}`);
+        return n;
+    }
+}
 
 function checkAppendActInfo(mid, txcode, data){
     data['MID'] = mid;