diff --git a/58tc.js b/58tc.js index e16fa2b..b095e44 100644 --- a/58tc.js +++ b/58tc.js @@ -246,6 +246,20 @@ class UserInfo { //打扫房间 async houseClean () { + let furnitureId = await this.houseGetCleanId(); + while (furnitureId != '0') { + url = `https://lovely-house.58.com/housework/clean` + body = `furnitureId=${index}` + urlObject = populateUrlObject(url, this.cookie, body) + await httpRequest('post', urlObject) + result = httpResult; + //if(result.code == 0) + //break; + furnitureId = await houseGetCleanId(); + } + } + + async houseGetCleanId () { let url = `https://lovely-house.58.com/housework/get` let body = `` let urlObject = populateUrlObject(url, this.cookie, body) @@ -255,19 +269,11 @@ class UserInfo { //console.log(result) if (result.code == 0) { if (!result.result || !result.result.houseworkTaskVOList || result.result.houseworkTaskVOList.length == 0) - return; - for (let index = 1; index < 10; index++) { - url = `https://lovely-house.58.com/housework/clean` - body = `furnitureId=${index}` - urlObject = populateUrlObject(url, this.cookie, body) - await httpRequest('post', urlObject) - result = httpResult; - //if(result.code == 0) - //break; - } - } else { - console.log(`账号[${this.index}]查询打扫房间状态失败: ${result.message}`) + return '0'; + console.log(`账号[${this.index}] 清理房间 ${result.result.houseworkTaskVOList[0].tip}`); + return result.result.houseworkTaskVOList[0].furnitureId; } + return '0'; } async houseWithdrawPage () { @@ -647,7 +653,7 @@ class UserInfo { if (!(await checkEnv())) return console.log('====================\n') console.log(`如果要自定义UA,请把UA填到wbtcUA里,现在使用的UA是:\n${userUA}`) - + console.log('\n================== 现金签到 ==================') for (let user of userList) { await user.cashSigninlist();