()
| 936 | }) |
| 937 | } |
| 938 | async function tuanActivity() { |
| 939 | const tuanConfig = await QueryActiveConfig(); |
| 940 | if (tuanConfig && tuanConfig.ret === 0) { |
| 941 | const { activeId, surplusOpenTuanNum, tuanId } = tuanConfig['data']['userTuanInfo']; |
| 942 | console.log(`今日剩余开团次数:${surplusOpenTuanNum}次`); |
| 943 | $.surplusOpenTuanNum = surplusOpenTuanNum; |
| 944 | if (!tuanId && surplusOpenTuanNum > 0) { |
| 945 | //开团 |
| 946 | $.log(`准备开团`) |
| 947 | await CreateTuan(); |
| 948 | } else if (tuanId) { |
| 949 | //查询词团信息 |
| 950 | const QueryTuanRes = await QueryTuan(activeId, tuanId); |
| 951 | if (QueryTuanRes && QueryTuanRes.ret === 0) { |
| 952 | const { tuanInfo } = QueryTuanRes.data; |
| 953 | if ((tuanInfo && tuanInfo[0]['endTime']) <= QueryTuanRes['nowTime'] && surplusOpenTuanNum > 0) { |
| 954 | $.log(`之前的团已过期,准备重新开团\n`) |
| 955 | await CreateTuan(); |
| 956 | } |
| 957 | for (let item of tuanInfo) { |
| 958 | const { realTuanNum, tuanNum, userInfo } = item; |
| 959 | $.tuanNum = tuanNum || 0; |
| 960 | $.log(`\n开团情况:${realTuanNum}/${tuanNum}\n`); |
| 961 | if (realTuanNum === tuanNum) { |
| 962 | for (let user of userInfo) { |
| 963 | if (user.encryptPin === $.encryptPin) { |
| 964 | if (user.receiveElectric && user.receiveElectric > 0) { |
| 965 | console.log(`您在${new Date(user.joinTime * 1000).toLocaleString()}开团奖励已经领取成功\n`) |
| 966 | if ($.surplusOpenTuanNum > 0) await CreateTuan(); |
| 967 | } else { |
| 968 | $.log(`开始领取开团奖励`); |
| 969 | await tuanAward(item.tuanActiveId, item.tuanId);//isTuanLeader |
| 970 | } |
| 971 | } |
| 972 | } |
| 973 | } else { |
| 974 | $.tuanIds.push(tuanId); |
| 975 | $.log(`\n此团未达领取团奖励人数:${tuanNum}人\n`) |
| 976 | } |
| 977 | } |
| 978 | } |
| 979 | } |
| 980 | } |
| 981 | } |
| 982 | async function joinLeaderTuan() { |
| 983 | let res = await updateTuanIdsCDN(), res2 = await updateTuanIdsCDN("https://raw.githubusercontent.com/JDHelloWorld/jd_scripts/main/tools/empty.json") |
| 984 | if (!res) res = await updateTuanIdsCDN('https://raw.githubusercontent.com/JDHelloWorld/jd_scripts/main/tools/empty.json'); |
no test coverage detected