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

Function QueryAllTuan

jd_dreamFactory.js:1122–1166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1120}
1121//查询所有的团情况(自己开团以及参加别人的团)
1122function QueryAllTuan() {
1123 return new Promise((resolve) => {
1124 const body = `activeId=${escape(tuanActiveId)}&pageNo=1&pageSize=10`;
1125 const options = taskTuanUrl(`QueryAllTuan`, body, '_time,activeId,pageNo,pageSize')
1126 $.get(options, async (err, resp, data) => {
1127 try {
1128 if (err) {
1129 console.log(`${JSON.stringify(err)}`)
1130 console.log(`${$.name} API请求失败,请检查网路重试`);
1131 } else {
1132 if (safeGet(data)) {
1133 data = JSON.parse(data);
1134 if (data['ret'] === 0) {
1135 const { tuanInfo } = data;
1136 for (let item of tuanInfo) {
1137 if (item.tuanNum === item.realTuanNum) {
1138 // console.log(`参加团主【${item.tuanLeader}】已成功`)
1139 const { userInfo } = item;
1140 for (let item2 of userInfo) {
1141 if (item2.encryptPin === $.encryptPin) {
1142 if (item2.receiveElectric && item2.receiveElectric > 0) {
1143 console.log(`${new Date(item2.joinTime * 1000).toLocaleString()}参加团主【${item2.nickName}】的奖励已经领取成功`)
1144 } else {
1145 console.log(`开始领取${new Date(item2.joinTime * 1000).toLocaleString()}参加团主【${item2.nickName}】的奖励`)
1146 await tuanAward(item.tuanActiveId, item.tuanId, item.tuanLeader === $.encryptPin);//isTuanLeader
1147 }
1148 }
1149 }
1150 } else {
1151 console.log(`${new Date(item.beginTime * 1000).toLocaleString()}参加团主【${item.tuanLeader}】失败`)
1152 }
1153 }
1154 } else {
1155 console.log(`QueryAllTuan异常:${JSON.stringify(data)}`);
1156 }
1157 }
1158 }
1159 } catch (e) {
1160 $.logErr(e, resp)
1161 } finally {
1162 resolve(data);
1163 }
1164 })
1165 })
1166}
1167//开团人的领取奖励API
1168function tuanAward(activeId, tuanId, isTuanLeader = true) {
1169 return new Promise((resolve) => {

Callers 1

jdDreamFactoryFunction · 0.85

Calls 6

tuanAwardFunction · 0.85
taskTuanUrlFunction · 0.70
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected