forked from develop202/kgcheckin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsent.js
More file actions
34 lines (28 loc) · 719 Bytes
/
sent.js
File metadata and controls
34 lines (28 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { close_api, delay, send, startService } from "./utils/utils.js";
async function login() {
const phone = process.env.PHONE
if (!phone) {
throw new Error("参数错误!请检查")
}
// 启动服务
const api = startService()
await delay(2000)
console.log("开始发送验证码")
try {
// 验证码请求
const result = await send(`/captcha/sent?mobile=${phone}`, "GET", {})
if (result.status === 1) {
console.log("发送成功")
} else {
console.log("响应内容")
console.dir(result, { depth: null })
throw new Error("发送失败!请检查")
}
} finally {
close_api(api)
}
if (api.killed) {
process.exit(0)
}
}
login()