mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
patch eslint rules
This commit is contained in:
15 files changed
+24
-19
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import moment from 'moment-timezone';
|
||||
import { Context } from '../context';
|
||||
import db from '../service/db';
|
||||
import { ArgMethod } from '../utils';
|
||||
import { ArgMethod, Time } from '../utils';
|
||||
|
||||
let coll = db.collection('blacklist');
|
||||
|
||||
@@ -12,7 +12,7 @@ class BlackListModel {
|
||||
if (expire === 0) expireAt = moment().add(1000, 'months').toDate();
|
||||
else if (typeof expire === 'number') expireAt = moment().add(expire, 'months').toDate();
|
||||
else if (expire instanceof Date) expireAt = expire;
|
||||
else expireAt = new Date(new Date().getTime() + 365 * 24 * 60 * 60 * 1000);
|
||||
else expireAt = new Date(Date.now() + 365 * Time.day);
|
||||
return await coll.findOneAndUpdate(
|
||||
{ _id: id },
|
||||
{ $set: { expireAt } },
|
||||
|
||||
@@ -78,7 +78,7 @@ export function isLocked(tdoc: Tdoc, time = new Date()) {
|
||||
}
|
||||
|
||||
export function isExtended(tdoc: Tdoc) {
|
||||
const now = new Date().getTime();
|
||||
const now = Date.now();
|
||||
return tdoc.penaltySince.getTime() <= now && now < tdoc.endAt.getTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import db from '../service/db';
|
||||
const coll = db.collection('opcount');
|
||||
|
||||
export async function inc(op: string, ident: string, periodSecs: number, maxOperations: number) {
|
||||
const now = new Date().getTime();
|
||||
const now = Date.now();
|
||||
const expireAt = new Date(now - (now % (periodSecs * 1000)) + periodSecs * 1000);
|
||||
try {
|
||||
const res = await coll.findOneAndUpdate({
|
||||
|
||||
Reference in new issue
Block a user