diff --git a/docs/api.md b/docs/api.md index 363b664..f5184c4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -330,4 +330,27 @@ body: "boost": 1, // 正常值为1 "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 // 具体的签到时间 + }, +] ``` \ No newline at end of file diff --git a/src/controllers/sign.controller.ts b/src/controllers/sign.controller.ts index 7bf2320..72ec2e3 100644 --- a/src/controllers/sign.controller.ts +++ b/src/controllers/sign.controller.ts @@ -6,6 +6,7 @@ import { ActivityUser } from 'models/ActivityUser' import {DEFAULT_EXPIRED, NonceRecord} from 'models/NonceRecord' import { LoginRecordQueue } from 'queue/loginrecord.queue' import { RedisClient } from 'redis/RedisClient' +import { queryCheckInList } from 'services/chain.svr' import { rankKey } from 'services/rank.svr' import {SiweMessage} from 'siwe' import { nextday, yesterday } from 'utils/date.util' @@ -121,6 +122,13 @@ class SignController extends BaseController { 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 * TODO:: diff --git a/src/services/chain.svr.ts b/src/services/chain.svr.ts index 10049e7..f36163d 100644 --- a/src/services/chain.svr.ts +++ b/src/services/chain.svr.ts @@ -3,6 +3,7 @@ export const queryCheckInList = async (address: string, days: string | number | const url = process.env.CHAIN_SVR + '/task/check_in' return fetch(url, { method: 'POST', + headers: {"Content-Type": "application/json"}, body: JSON.stringify({ address, days,