4.6.7 first pr (#726)

This commit is contained in:
Archer
2024-01-10 23:35:04 +08:00
committed by GitHub
parent 414b693303
commit 006ad17c6a
186 changed files with 2996 additions and 1838 deletions

View File

@@ -1,18 +1,22 @@
import { MongoOpenApi } from './schema';
export async function updateApiKeyUsedTime(id: string) {
await MongoOpenApi.findByIdAndUpdate(id, {
export function updateApiKeyUsedTime(id: string) {
MongoOpenApi.findByIdAndUpdate(id, {
lastUsedTime: new Date()
}).catch((err) => {
console.log('update apiKey used time error', err);
});
}
export async function updateApiKeyUsage({ apikey, usage }: { apikey: string; usage: number }) {
await MongoOpenApi.findOneAndUpdate(
export function updateApiKeyUsage({ apikey, usage }: { apikey: string; usage: number }) {
MongoOpenApi.findOneAndUpdate(
{ apiKey: apikey },
{
$inc: {
usage
}
}
);
).catch((err) => {
console.log('update apiKey usage error', err);
});
}