初始化:职引项目 v1.0

This commit is contained in:
yuzhiran
2026-06-08 16:28:00 +08:00
commit 511f60d0db
111 changed files with 27295 additions and 0 deletions
@@ -0,0 +1,56 @@
import { Controller, Post, Get, Put, Body, Req } from '@nestjs/common'
import { UserService } from './user.service'
import { Public } from '../../common/decorators/public.decorator'
import { CurrentUser } from '../../common/decorators/current-user.decorator'
@Controller('user')
export class UserController {
constructor(private userService: UserService) {}
@Public()
@Post('send-code')
async sendCode(@Body('phone') phone: string) {
return this.userService.sendCode(phone)
}
@Public()
@Post('login')
async login(@Body('phone') phone: string, @Body('code') code: string) {
return this.userService.loginByPhone(phone, code)
}
// 📧 邮箱验证码登录(H5 用)
@Public()
@Post('send-email-code')
async sendEmailCode(@Body('email') email: string) {
return this.userService.sendEmailCode(email)
}
@Public()
@Post('email-login')
async emailLogin(@Body('email') email: string, @Body('code') code: string) {
return this.userService.loginByEmail(email, code)
}
// 微信静默登录
@Public()
@Post('wx-login')
async wxLogin(@Body('code') code: string) {
return this.userService.loginByWx(code)
}
@Get('info')
async getInfo(@CurrentUser('userId') userId: string) {
return this.userService.getInfo(userId)
}
@Put('update')
async update(@CurrentUser('userId') userId: string, @Body() data: { nickname?: string; avatar?: string }) {
return this.userService.update(userId, data)
}
@Get('usage')
async getUsage(@CurrentUser('userId') userId: string) {
return this.userService.getUsage(userId)
}
}