| 149 | } |
| 150 | |
| 151 | function signwx() { |
| 152 | return new Promise((resove) => { |
| 153 | const url = { url: 'https://zt.wps.cn/2018/clock_in/api/clock_in?award=wps', headers: { sid: $.sid } } |
| 154 | $.get(url, (error, response, data) => { |
| 155 | try { |
| 156 | if (error) throw new Error(error) |
| 157 | const _data = JSON.parse(data) |
| 158 | $.signwx = { |
| 159 | _raw: _data, |
| 160 | isSuc: _data.result === 'ok' || (_data.result === 'error' && '已打卡' === _data.msg), |
| 161 | isRepeat: _data.result === 'error' && _data.msg === '已打卡', |
| 162 | isSignupNeed: _data.result === 'error' && _data.msg === '前一天未报名', |
| 163 | msg: _data.msg |
| 164 | } |
| 165 | } catch (e) { |
| 166 | $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') |
| 167 | } finally { |
| 168 | resove() |
| 169 | } |
| 170 | }) |
| 171 | }) |
| 172 | } |
| 173 | |
| 174 | function signupwx() { |
| 175 | if (!$.signwx.isSignupNeed) return null |