platform-assistant/apps/api/src/lead/lead.controller.ts
Sisyphus ae72966766 feat: 线索池品类筛选改为按标题关键词匹配
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-26 16:24:43 +08:00

92 lines
2.5 KiB
TypeScript

import { Controller, Get, Post, Put, Delete, Body, Param, Query } from '@nestjs/common'
import { LeadService } from './lead.service'
@Controller('api/leads')
export class LeadController {
constructor(private readonly leadService: LeadService) {}
@Get()
findAll(
@Query('status') status?: string,
@Query('level') level?: string,
@Query('search') search?: string,
@Query('star') star?: string,
@Query('source') source?: string,
@Query('category') category?: string,
@Query('assignedTo') assignedTo?: string,
@Query('timeRange') timeRange?: string,
) {
return this.leadService.findAll({ status, level, search, star, source, category, assignedTo, timeRange })
}
@Get('stats')
getStats() {
return this.leadService.getStats()
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.leadService.findOne(id)
}
@Post()
create(@Body() body: any) {
return this.leadService.create(body)
}
@Put(':id')
update(@Param('id') id: string, @Body() body: any) {
return this.leadService.update(id, body)
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.leadService.remove(id)
}
@Post(':id/to-rfq')
toRFQ(@Param('id') id: string, @Body('assignee') assignee: string, @Body('note') note: string) {
return this.leadService.toRFQ(id, assignee, note || '')
}
@Post(':id/to-collab')
toCollab(@Param('id') id: string, @Body('assignee') assignee: string, @Body('note') note: string) {
return this.leadService.toCollab(id, assignee, note || '')
}
@Post(':id/publish')
publish(@Param('id') id: string) {
return this.leadService.publishToDirev(id)
}
@Post('batch-publish')
batchPublish(@Body('ids') ids: string[]) {
return this.leadService.batchPublish(ids)
}
@Post(':id/follow-up')
addFollowUp(@Param('id') id: string, @Body('content') content: string, @Body('action') action: string) {
return this.leadService.addFollowUp(id, content, 'admin', action)
}
@Post(':id/follow-up/:index/delete')
deleteFollowUp(@Param('id') id: string, @Param('index') index: string) {
return this.leadService.deleteFollowUp(id, parseInt(index, 10))
}
@Post(':id/level')
updateLevel(@Param('id') id: string, @Body('level') level: string) {
return this.leadService.updateLevel(id, level)
}
@Post(':id/follow-intent')
followIntent(@Param('id') id: string) {
return this.leadService.followIntent(id)
}
@Post('calculate-score')
calculateScore(@Body() body: any) {
return { score: this.leadService.calculateAIScore(body) }
}
}