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

Function upgradeUserLevel

jd_factory_component.js:220–251  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

218}
219
220function upgradeUserLevel() {
221 return new Promise(async resolve => {
222 if (!$.autoUpgrade) {
223 resolve();
224 return;
225 }
226 $.get(taskStroyUrl('userinfo/UpgradeUserLevelDraw'), async (err, resp, data) => {
227 try {
228 const { msg, data: { discount, quota, currentUserLevel, consumeMoneyNum, active } = {}, ret } = JSON.parse(data);
229 let str = '';
230 if (discount && quota) {
231 str = `,获得满${quota}减${discount}红包`;
232 }
233 if (ret === 0) {
234 if (active) {
235 $.time++;
236 }
237 $.log(`\n投入钞票:${msg},消耗钞票${consumeMoneyNum},当前等级 ${currentUserLevel}${str ? str : ''}\n${$.showLog ? data : ''}`);
238 await upgradeUserLevel();
239 } else {
240 currentUserLevel && $.result.push(
241 `厂长从${currentUserLevel-$.time}级升到${currentUserLevel}`,
242 );
243 }
244 } catch (e) {
245 $.logErr(e, resp);
246 } finally {
247 resolve();
248 }
249 });
250 });
251}
252
253function clickManage() {
254 return new Promise(resolve => {

Callers

nothing calls this directly

Calls 4

taskStroyUrlFunction · 0.85
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected