feat: 添加项目置顶功能
在仪表盘中添加置顶项目功能,包括: - 新增置顶项目展示区域 - 为AI推荐项目添加置顶/取消置顶操作 - 后端接口支持置顶状态管理
This commit is contained in:
@@ -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 = `
|
||||
|
||||
Reference in New Issue
Block a user