()
| 218 | } |
| 219 | |
| 220 | function 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 | |
| 253 | function clickManage() { |
| 254 | return new Promise(resolve => { |
nothing calls this directly
no test coverage detected