增加用户签到列表接口
This commit is contained in:
parent
171749b486
commit
27e08d7d40
23
docs/api.md
23
docs/api.md
@ -331,3 +331,26 @@ body:
|
|||||||
"boostExpire": 0, // 计算得分时, 如果boost过期, 即使boost大于1, 也不计算boost
|
"boostExpire": 0, // 计算得分时, 如果boost过期, 即使boost大于1, 也不计算boost
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 12.\* 签到列表
|
||||||
|
|
||||||
|
#### Request
|
||||||
|
|
||||||
|
- URL:`/api/user/state/checkin_list`
|
||||||
|
- 方法:`GET`
|
||||||
|
- 头部:
|
||||||
|
- Authorization: Bearer JWT_token
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"address": "钱包地址",
|
||||||
|
"day": "20240105", // 格式化后签到日期, 时区按SG(UTC+8)
|
||||||
|
"time": 1704436745 // 具体的签到时间
|
||||||
|
},
|
||||||
|
]
|
||||||
|
```
|
@ -6,6 +6,7 @@ import { ActivityUser } from 'models/ActivityUser'
|
|||||||
import {DEFAULT_EXPIRED, NonceRecord} from 'models/NonceRecord'
|
import {DEFAULT_EXPIRED, NonceRecord} from 'models/NonceRecord'
|
||||||
import { LoginRecordQueue } from 'queue/loginrecord.queue'
|
import { LoginRecordQueue } from 'queue/loginrecord.queue'
|
||||||
import { RedisClient } from 'redis/RedisClient'
|
import { RedisClient } from 'redis/RedisClient'
|
||||||
|
import { queryCheckInList } from 'services/chain.svr'
|
||||||
import { rankKey } from 'services/rank.svr'
|
import { rankKey } from 'services/rank.svr'
|
||||||
import {SiweMessage} from 'siwe'
|
import {SiweMessage} from 'siwe'
|
||||||
import { nextday, yesterday } from 'utils/date.util'
|
import { nextday, yesterday } from 'utils/date.util'
|
||||||
@ -121,6 +122,13 @@ class SignController extends BaseController {
|
|||||||
return { boost: user.boost, boostExpire: user.boostExpire };
|
return { boost: user.boost, boostExpire: user.boostExpire };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@router('get /api/user/state/checkin_list')
|
||||||
|
async checkInList(req){
|
||||||
|
const user = req.user;
|
||||||
|
const res = await queryCheckInList(user.address, '1month', 0)
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* regist user by token from wallet-svr
|
* regist user by token from wallet-svr
|
||||||
* TODO::
|
* TODO::
|
||||||
|
@ -3,6 +3,7 @@ export const queryCheckInList = async (address: string, days: string | number |
|
|||||||
const url = process.env.CHAIN_SVR + '/task/check_in'
|
const url = process.env.CHAIN_SVR + '/task/check_in'
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {"Content-Type": "application/json"},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
address,
|
address,
|
||||||
days,
|
days,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user