MCPcopy Create free account
hub / github.com/Semporia/Scripts / tuanActivity

Function tuanActivity

jd_dreamFactory.js:938–981  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

936 })
937}
938async 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}
982async 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');

Callers 1

jdDreamFactoryFunction · 0.85

Calls 5

QueryActiveConfigFunction · 0.85
CreateTuanFunction · 0.85
QueryTuanFunction · 0.85
tuanAwardFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected