feat: 添加项目置顶功能

在仪表盘中添加置顶项目功能,包括:
- 新增置顶项目展示区域
- 为AI推荐项目添加置顶/取消置顶操作
- 后端接口支持置顶状态管理
This commit is contained in:
dmy
2026-01-13 20:56:21 +08:00
parent 4f4355c1cd
commit 50bc930663
4 changed files with 173 additions and 5 deletions

View File

@@ -73,6 +73,14 @@ export class BidsService {
.getMany();
}
async getPinnedBids() {
return this.bidRepository
.createQueryBuilder('bid')
.where('bid.pin = :pin', { pin: true })
.orderBy('bid.publishDate', 'DESC')
.getMany();
}
async getBidsByDateRange(startDate?: string, endDate?: string, keywords?: string[]) {
const qb = this.bidRepository.createQueryBuilder('bid');
@@ -101,6 +109,15 @@ export class BidsService {
return qb.orderBy('bid.publishDate', 'DESC').getMany();
}
async updatePin(title: string, pin: boolean) {
const item = await this.bidRepository.findOne({ where: { title } });
if (!item) {
throw new Error('Bid not found');
}
item.pin = pin;
return this.bidRepository.save(item);
}
async getCrawlInfoAddStats() {
// 获取每个来源的最新一次爬虫记录(按 createdAt 降序)
const query = `