shawenguan 1 년 전
부모
커밋
7c21a6c65f
1개의 변경된 파일47개의 추가작업 그리고 4개의 파일을 삭제
  1. 47 4
      Scripts/jhsh/jhshHelper.js

+ 47 - 4
Scripts/jhsh/jhshHelper.js

@@ -487,6 +487,20 @@ function checkAppendActInfo(mid, txcode, data){
     if(jsonStr){
         allInfo = JSON.parse(jsonStr);
     }
+    let rspBody = lk.getResponseBody();
+    if (rspBody) {
+        try{
+            const rspParams = JSON.parse(rspBody);
+            const rspData = rspParams.data;
+            if(rspData){
+                let nowString = lk.formatDate(new Date(), 'yyyyMMdd');
+                rspData.SIGN_DATE = nowString;
+            }
+            data.rspParams = rspParams;
+        }catch{
+
+        }
+    }
     allInfo[actId] = data;
 
     lk.setVal(jhshStoreKeyPrefix+'ActInfo-'+txcode, JSON.stringify(allInfo));
@@ -581,10 +595,39 @@ async function checkSignIn(loginInfo, signActInfo){
         return;
     }
     lk.log(`开始进行活动签到...`);
-    const couponList = await checkSinginReward(signActInfo, session, txcode);
-    if(couponList && couponList.length > 0){
-        const result = await getSignInReward(signActInfo, couponList[0], 'A3341C120');
-        return result;
+    let signActDetail;
+    let hasSignInToday = false;
+    if(signActInfo.rspParams){
+        signActDetail = signActInfo.rspParams.data;
+        if(signActDetail){
+            let nowString = lk.formatDate(new Date(), 'yyyyMMdd');
+            if(signActDetail.IS_SIGN == 1 && signActDetail.SIGN_DATE == nowString){
+                lk.log(`[${signActDetail.PAGE_TITLE}]活动已经签到第${signActDetail.SIGN_DAY}天`);
+                hasSignInToday = true;
+            }
+        }
+    }
+    if(hasSignInToday){
+        const couponList = await checkSinginReward(signActInfo, session, txcode);
+        if(couponList && couponList.length > 0){
+            const result = await getSignInReward(signActInfo, couponList[0], 'A3341C120');
+            return result;
+        }
+    }else if(signActDetail){
+        const REWORD_LIST = signActDetail.REWORD_LIST;
+        const REWARD_NODES = signActDetail.REWARD_NODES;
+        const couponList = REWARD_NODES[signActDetail.SIGN_DAY];
+        if(couponList){
+            let couponInfo;
+            for(let i=0; i < couponList.length; i++){
+                if(couponList[i].couponName.indexOf('信用卡')>-1){
+                    couponInfo = couponList[i];
+                    break;
+                }
+            }
+            const result = await getSignInReward(signActInfo, couponInfo, 'A3341C120');
+            return result;
+        }
     }
     return null;
 }