MCPcopy Create free account
hub / github.com/chavyleung/scripts / answerquestion

Function answerquestion

wps/wps.js:133–149  ·  view source on GitHub ↗
(optIdx)

Source from the content-addressed store, hash-verified

131
132// 回答问题
133function answerquestion(optIdx) {
134 return new Promise((resove) => {
135 const body = `answer=${optIdx}`
136 const url = { url: 'https://zt.wps.cn/2018/clock_in/api/answer?member=wps', body, headers: { sid: $.sid } }
137 $.post(url, (error, response, data) => {
138 try {
139 if (error) throw new Error(error)
140 const _data = JSON.parse(data)
141 $.answer = { _raw: _data, right: _data.result === 'ok' }
142 } catch (e) {
143 $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
144 } finally {
145 resove()
146 }
147 })
148 })
149}
150
151function signwx() {
152 return new Promise((resove) => {

Callers 1

answerwxFunction · 0.85

Calls 2

postMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected