mirror of https://github.com/fantasticit/think.git
server: refactor code
This commit is contained in:
parent
1dbbe990d3
commit
6550d7cb14
|
@ -8,7 +8,7 @@ import { UserEntity } from '@entities/user.entity';
|
||||||
import { ViewEntity } from '@entities/view.entity';
|
import { ViewEntity } from '@entities/view.entity';
|
||||||
import { WikiEntity } from '@entities/wiki.entity';
|
import { WikiEntity } from '@entities/wiki.entity';
|
||||||
import { WikiUserEntity } from '@entities/wiki-user.entity';
|
import { WikiUserEntity } from '@entities/wiki-user.entity';
|
||||||
import { getLogFileName } from '@helpers/log.helper';
|
import { getLogFileName, ONE_DAY } from '@helpers/log.helper';
|
||||||
import { CollectorModule } from '@modules/collector.module';
|
import { CollectorModule } from '@modules/collector.module';
|
||||||
import { CommentModule } from '@modules/comment.module';
|
import { CommentModule } from '@modules/comment.module';
|
||||||
import { DocumentModule } from '@modules/document.module';
|
import { DocumentModule } from '@modules/document.module';
|
||||||
|
@ -53,8 +53,6 @@ const MODULES = [
|
||||||
ViewModule,
|
ViewModule,
|
||||||
];
|
];
|
||||||
|
|
||||||
const ONE_DAY = 24 * 60 * 60 * 1000;
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { dateFormat } from './date.helper';
|
import { dateFormat } from './date.helper';
|
||||||
|
|
||||||
const ONE_DAY = 24 * 60 * 60 * 1000;
|
export const ONE_DAY = 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
export function getLogFileName(date: Date | number, offsetDay = 0) {
|
export function getLogFileName(date: Date | number, offsetDay = 0) {
|
||||||
return dateFormat(new Date(new Date(date).valueOf() - offsetDay * ONE_DAY), 'yyyy-MM-dd') + '.log';
|
return dateFormat(new Date(new Date(date).valueOf() - offsetDay * ONE_DAY), 'yyyy-MM-dd') + '.log';
|
||||||
|
|
Loading…
Reference in New Issue