mirror of
https://github.com/certd/certd.git
synced 2026-05-18 14:27:36 +08:00
feat: 首页全新改版
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||
import { In, Repository } from 'typeorm';
|
||||
import { In, MoreThan, Repository } from 'typeorm';
|
||||
import { BaseService, PageReq } from '@certd/lib-server';
|
||||
import { HistoryEntity } from '../entity/history.js';
|
||||
import { PipelineEntity } from '../entity/pipeline.js';
|
||||
@@ -9,7 +9,7 @@ import { HistoryLogService } from './history-log-service.js';
|
||||
import { FileItem, Pipeline, RunnableCollection } from '@certd/pipeline';
|
||||
import { FileStore } from '@certd/pipeline';
|
||||
import { logger } from '@certd/pipeline';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
/**
|
||||
* 证书申请
|
||||
*/
|
||||
@@ -174,4 +174,21 @@ export class HistoryService extends BaseService<HistoryEntity> {
|
||||
logger.error('删除文件失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
async dayCount(param: { days: number; userId: any }) {
|
||||
const todayEnd = dayjs().endOf('day');
|
||||
const result = await this.getRepository()
|
||||
.createQueryBuilder('main')
|
||||
.select('date(main.createTime) AS date') // 将UNIX时间戳转换为日期
|
||||
.addSelect('COUNT(*) AS count')
|
||||
.where({
|
||||
// 0点
|
||||
userId: param.userId,
|
||||
createTime: MoreThan(todayEnd.add(-param.days, 'day').toDate()),
|
||||
})
|
||||
.groupBy('date')
|
||||
.getRawMany();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user