task-svr/docs/bitget.md
2024-08-21 16:30:49 +08:00

101 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 0. 说明
测试环境https://oauth-svr.cebggame.com/task
正式环境https://taskapi.cebggame.com
### 1. 钱包登录
#### Request
- URL`/api/bigget/login`
- 方法:`POST`
- 头部:
- Content-type: application/json
- Body:
```json
{
"code": String,
"message": SiweMessage
}
```
SiweMessage说明: https://docs.login.xyz/sign-in-with-ethereum/quickstart-guide/creating-siwe-messages
#### Response
```json
{
"token": String,
}
```
### 2.\* 发送邮件验证码
#### Request
- URL`/api/bigget/send_code`
- 方法POST
- 头部:
- Authorization: Bearer JWT_token
body:
```js
{
"email": "email"
}
```
> 验证email的正则
```js
export const isEmail = (email) => {
const reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/
return reg.test(email)
}
```
#### Response
```js
{
}
```
### 3.\* 验证邮件地址
#### Request
- URL`/api/bigget/verify_email`
- 方法POST
- 头部:
- Authorization: Bearer JWT_token
body:
```js
{
"email": "email",
"code": "123221"
}
```
> 验证code的正则
```js
export const isValiedCode = (code) => {
return /^\d{6}$/.test(code)
}
```
#### Response
```js
{
"token": String,
}
```