|
|
@@ -115,7 +115,7 @@ async function all() {
|
|
|
continue;
|
|
|
}
|
|
|
await checkSignIn(loginInfoObj, signInActObj);//签到
|
|
|
- // await lk.wait(1000 * 3);
|
|
|
+ // await lk.wait(3000);
|
|
|
}
|
|
|
lk.msg('');
|
|
|
lk.done();
|
|
|
@@ -127,15 +127,13 @@ async function checkSignIn(loginInfo, signActInfo){
|
|
|
const MBCUserAgent = loginInfo['MBCUserAgent'];
|
|
|
const Body = loginInfo['Body'];
|
|
|
const token = await refreshLogin(loginInfo); // 刷新 session
|
|
|
- lk.log("#####refreshLogin#####");
|
|
|
- lk.log('token='+token)
|
|
|
if(!token){
|
|
|
return;
|
|
|
}
|
|
|
const couponList = await checkSinginReward(signActInfo, token);
|
|
|
if(couponList && couponList.length > 0){
|
|
|
- // const result = await getSignInReward(signActInfo, couponList[0]);
|
|
|
- // return result;
|
|
|
+ const result = await getSignInReward(signActInfo, couponList[0]);
|
|
|
+ return result;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
@@ -158,6 +156,7 @@ async function refreshLogin(loginInfo) {
|
|
|
},
|
|
|
body: Body
|
|
|
};
|
|
|
+ lk.log("#####refreshLogin#####");
|
|
|
return new Promise(resolve => {
|
|
|
lk.post(options, async (error, response, data) => {
|
|
|
let token = null;
|
|
|
@@ -180,6 +179,7 @@ async function refreshLogin(loginInfo) {
|
|
|
let new_cookie = obj.match(/SESSION=([a-f0-9-]+);/);
|
|
|
if (new_cookie) {
|
|
|
token = new_cookie[0];
|
|
|
+ lk.log('token='+token)
|
|
|
lk.log(`✅ 刷新 session 成功!`);
|
|
|
} else {
|
|
|
lk.log(`⛔️ 刷新 session 失败,请重新获取Cookie。`);
|
|
|
@@ -208,16 +208,17 @@ async function checkSinginReward(signActInfo,token) {
|
|
|
},
|
|
|
body: `{"ACT_ID":"${signActInfo.ACT_ID}","REGION_CODE":"${signActInfo.REGION_CODE}","chnlType":"${signActInfo.chnlType}","regionCode":"${signActInfo.regionCode}"}`
|
|
|
};
|
|
|
+ lk.log("#####checkSinginReward#####");
|
|
|
return new Promise(resolve => {
|
|
|
lk.post(options, async (err, resp, data) => {
|
|
|
let couponList = [];
|
|
|
try {
|
|
|
err && lk.log(err);
|
|
|
if (data) {
|
|
|
- data = JSON.parse(data);
|
|
|
- if (data.errCode == 0) {
|
|
|
- if (data?.data?.IS_AWARD == 1) {
|
|
|
- const GIFT_BAG = data?.data?.GIFT_BAG;
|
|
|
+ let ret = JSON.parse(data);
|
|
|
+ if (ret.errCode == 0) {
|
|
|
+ if (ret?.data?.IS_AWARD == 1) {
|
|
|
+ const GIFT_BAG = ret?.data?.GIFT_BAG;
|
|
|
let otherList = [];
|
|
|
GIFT_BAG.forEach(item => {
|
|
|
let body = { "couponId": item.couponId, "nodeDay": item.nodeDay, "couponType": item.couponType, "dccpBscInfSn": item.dccpBscInfSn };
|
|
|
@@ -232,13 +233,13 @@ async function checkSinginReward(signActInfo,token) {
|
|
|
}
|
|
|
})
|
|
|
couponList = [...couponList, ...otherList];
|
|
|
- } else if (data?.data?.NEST_AWARD_DAY >= 1) {
|
|
|
- lk.appendNotifyInfo(`继续签到${data.data.NEST_AWARD_DAY}天可领取${couponNameDict[couponSelectIndex]}券`);
|
|
|
+ } else if (ret?.data?.NEST_AWARD_DAY >= 1) {
|
|
|
+ lk.appendNotifyInfo(`继续签到${ret.data.NEST_AWARD_DAY}天可领取${couponNameDict[couponSelectIndex]}券`);
|
|
|
} else {
|
|
|
lk.log(`暂无可领取的奖励`);
|
|
|
}
|
|
|
} else {
|
|
|
- lk.log(JSON.stringify(data));
|
|
|
+ lk.log(data);
|
|
|
}
|
|
|
} else {
|
|
|
lk.log("服务器返回了空数据");
|
|
|
@@ -266,6 +267,7 @@ async function getSignInReward(signActInfo, couponItemInfo) {
|
|
|
},
|
|
|
body: `{"mebId":"${signActInfo.MEB_ID}","actId":"${signActInfo.ACT_ID}","nodeDay":${couponItemInfo.nodeDay},"couponType":${couponItemInfo.couponType},"nodeCouponId":"${couponItemInfo.couponId}","dccpBscInfSn":"${couponItemInfo.dccpBscInfSn}","chnlType":"${signActInfo.chnlType}","regionCode":"${signActInfo.regionCode}"}`
|
|
|
};
|
|
|
+ lk.log("#####getSignInReward#####");
|
|
|
return new Promise(resolve => {
|
|
|
lk.post(options, async (err, resp, data) => {
|
|
|
let ret = null;
|
|
|
@@ -274,9 +276,9 @@ async function getSignInReward(signActInfo, couponItemInfo) {
|
|
|
if (data) {
|
|
|
ret = JSON.parse(data);
|
|
|
if (ret.errCode == 0) {
|
|
|
- const getGiftMsg = `获得签到奖励:${ret?.data?.title}(${ret?.data?.subTitle})\n`;
|
|
|
- lk.log(getGiftMsg);
|
|
|
- lk.appendNotifyInfo(getGiftMsg);
|
|
|
+ const giftMsg = `获得签到奖励:${ret?.data?.title}(${ret?.data?.subTitle})`;
|
|
|
+ lk.log(giftMsg);
|
|
|
+ lk.appendNotifyInfo(giftMsg);
|
|
|
} else {
|
|
|
lk.log(data);
|
|
|
}
|