- 实现签到主页面,包含签到按钮、连续天数、今日状态展示 - 实现签到记录页面,包含日历视图和签到历史列表 - 实现个人中心页面,包含用户信息和签到统计 - 后端实现签到、查询状态、查询历史三个接口 - 使用 Supabase 存储签到记录数据 - 采用星空主题设计,深蓝紫渐变背景 + 金色星光强调色 - 完成所有接口测试和前后端匹配验证 - 通过 ESLint 检查和编译验证
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { Controller, Post, Get, Query } from '@nestjs/common';
|
||
import { SignInService } from './signin.service';
|
||
|
||
@Controller('signin')
|
||
export class SignInController {
|
||
constructor(private readonly signInService: SignInService) {}
|
||
|
||
/**
|
||
* 用户签到
|
||
* POST /api/signin
|
||
*/
|
||
@Post()
|
||
async signIn() {
|
||
// 临时使用固定用户ID,实际应从 token 中获取
|
||
const userId = 'default_user';
|
||
return await this.signInService.signIn(userId);
|
||
}
|
||
|
||
/**
|
||
* 获取签到状态
|
||
* GET /api/signin/status
|
||
*/
|
||
@Get('status')
|
||
async getStatus() {
|
||
// 临时使用固定用户ID,实际应从 token 中获取
|
||
const userId = 'default_user';
|
||
return await this.signInService.getSignInStatus(userId);
|
||
}
|
||
|
||
/**
|
||
* 获取签到历史记录
|
||
* GET /api/signin/history
|
||
*/
|
||
@Get('history')
|
||
async getHistory(@Query('limit') limit?: string) {
|
||
// 临时使用固定用户ID,实际应从 token 中获取
|
||
const userId = 'default_user';
|
||
const limitNum = limit ? parseInt(limit, 10) : 30;
|
||
return await this.signInService.getSignInHistory(userId, limitNum);
|
||
}
|
||
}
|