Refactor the backend

This commit is contained in:
jiangrui
2025-03-11 00:06:10 +08:00
parent a78ea7e5bd
commit 615149c83f
22 changed files with 338 additions and 84 deletions

View File

@@ -5,7 +5,7 @@ import { injectable } from "inversify";
import { Request } from "express";
import UserSetting from "../models/UserSetting";
import { ICloudService } from "../types/services";
import { logger } from "@/utils/logger";
import { logger } from "../utils/logger";
interface Cloud115ListItem {
cid: string;

View File

@@ -24,7 +24,7 @@ interface sourceItem {
@injectable()
export class Searcher {
private static instance: Searcher;
private api: AxiosInstance;
private api: AxiosInstance | null = null;
constructor() {
this.initAxiosInstance();

View File

@@ -5,7 +5,7 @@ import { Searcher } from "./Searcher";
@injectable()
export class SettingService {
async getSettings(userId: number | undefined, role: number | undefined) {
async getSettings(userId: string | undefined, role: number | undefined) {
if (!userId) {
throw new Error("用户ID无效");
}
@@ -28,7 +28,7 @@ export class SettingService {
};
}
async saveSettings(userId: number | undefined, role: number | undefined, settings: any) {
async saveSettings(userId: string | undefined, role: number | undefined, settings: any) {
if (!userId) {
throw new Error("用户ID无效");
}

View File

@@ -19,7 +19,6 @@ export class UserService {
globalSetting?.dataValues.CommonUserCode,
globalSetting?.dataValues.AdminUserCode,
];
if (!registerCode || !registerCodeList.includes(Number(registerCode))) {
throw new Error("注册码错误");
}