* 获取信息 *
(timeout = 2 * 1000)
| 138 | * |
| 139 | */ |
| 140 | async function getuser (timeout = 2 * 1000) { |
| 141 | return new Promise((resolve) => { |
| 142 | let url = { |
| 143 | url: `https://zm.t7a.cn/api/getusercenter.php?safe=${zmnlxq}`, |
| 144 | headers: { |
| 145 | 'Host': 'zm.t7a.cn', |
| 146 | 'user-agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3235 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram/wx532ecb3bdaaf92f9' |
| 147 | }, |
| 148 | // body: '', |
| 149 | |
| 150 | } |
| 151 | $.get(url, async (error, response, data) => { |
| 152 | try { |
| 153 | result = JSON.parse(data) |
| 154 | if (result.status == 1) { |
| 155 | ok = 1; |
| 156 | console.log(`用户:${result.nickname}` + `当前能量:${result.nowscore} `); |
| 157 | if (result.isgzhkl == 0) { |
| 158 | console.log('公众号口令任务:未完成' + '\n' + '开始完成任务') |
| 159 | await gzhkl(); |
| 160 | } |
| 161 | if (result.isinfo == 0) { |
| 162 | console.log('完善个人资料:未完成' + '\n' + '开始完成任务') |
| 163 | let tel = await getTel(); |
| 164 | if (tel) { |
| 165 | await saveuserinfo(result.headimgurl, result.nickname, Math.random().toFixed(0), new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(), tel); |
| 166 | } else { |
| 167 | console.log('未授权手机号,无法完善个人资料') |
| 168 | } |
| 169 | } |
| 170 | } else { |
| 171 | |
| 172 | console.log(`信息获取失败请检查`) |
| 173 | |
| 174 | } |
| 175 | |
| 176 | } catch (e) { |
| 177 | console.log(e) |
| 178 | } finally { |
| 179 | resolve(); |
| 180 | } |
| 181 | }, timeout) |
| 182 | }) |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * 获取手机号 |