diff --git a/src/app.ts b/src/core/app.ts similarity index 94% rename from src/app.ts rename to src/core/app.ts index f3ce149..1740a41 100644 --- a/src/app.ts +++ b/src/core/app.ts @@ -2,11 +2,11 @@ import express from 'express'; import compression from 'compression'; import fs from 'fs'; import path from 'path'; -import logger from './utils/core/logger'; -import paths from './utils/core/path'; -import config from './utils/core/config'; +import logger from './utils/system/logger'; +import paths from './utils/system/path'; +import config from './utils/system/config'; import './services/ws/wsServer'; -import System from './utils/core/system'; +import System from './utils/system/system'; const apps = { async createApp() { diff --git a/src/services/redis/redis.ts b/src/core/services/redis/redis.ts similarity index 97% rename from src/services/redis/redis.ts rename to src/core/services/redis/redis.ts index a46026e..f83dc7f 100644 --- a/src/services/redis/redis.ts +++ b/src/core/services/redis/redis.ts @@ -1,7 +1,7 @@ import Redis from 'ioredis'; -import logger from '../../utils/core/logger'; -import tools from '../../utils/core/tool'; -import config from '../../utils/core/config'; +import logger from '../../utils/system/logger'; +import tools from '../../utils/system/tool'; +import config from '../../utils/system/config'; import redisTools from '../../utils/redis/redisTools'; import Persistence from '../../utils/redis/persistence'; import IUser from '../../types/user'; diff --git a/src/services/redis/redisStorage.ts b/src/core/services/redis/redisStorage.ts similarity index 100% rename from src/services/redis/redisStorage.ts rename to src/core/services/redis/redisStorage.ts diff --git a/src/services/ws/handler.ts b/src/core/services/ws/handler.ts similarity index 97% rename from src/services/ws/handler.ts rename to src/core/services/ws/handler.ts index 8d37352..2b92642 100644 --- a/src/services/ws/handler.ts +++ b/src/core/services/ws/handler.ts @@ -1,7 +1,7 @@ import { AuthenticatedSocket } from '../../types/ws'; import wsTools from '../../utils/ws/wsTools'; import { WebSocket } from 'ws'; -import logger from '../../utils/core/logger'; +import logger from '../../utils/system/logger'; import redisService from '../redis/redis'; import wsClientManager from './wsClientManager'; diff --git a/src/services/ws/wsClientManager.ts b/src/core/services/ws/wsClientManager.ts similarity index 100% rename from src/services/ws/wsClientManager.ts rename to src/core/services/ws/wsClientManager.ts diff --git a/src/services/ws/wsServer.ts b/src/core/services/ws/wsServer.ts similarity index 97% rename from src/services/ws/wsServer.ts rename to src/core/services/ws/wsServer.ts index 965bb10..5130ae4 100644 --- a/src/services/ws/wsServer.ts +++ b/src/core/services/ws/wsServer.ts @@ -1,6 +1,6 @@ import WebSocket, { WebSocketServer } from 'ws'; -import config from '../../utils/core/config'; -import logger from '../../utils/core/logger'; +import config from '../../utils/system/config'; +import logger from '../../utils/system/logger'; import { AuthenticatedSocket, AuthMessage, WSMessage } from '../../types/ws'; import WsTools from '../../utils/ws/wsTools'; import wsHandler from './handler'; diff --git a/src/types/qq/groupInfo.ts b/src/core/types/qq/groupInfo.ts similarity index 100% rename from src/types/qq/groupInfo.ts rename to src/core/types/qq/groupInfo.ts diff --git a/src/types/qq/userInfo.ts b/src/core/types/qq/userInfo.ts similarity index 100% rename from src/types/qq/userInfo.ts rename to src/core/types/qq/userInfo.ts diff --git a/src/types/retry.ts b/src/core/types/retry.ts similarity index 100% rename from src/types/retry.ts rename to src/core/types/retry.ts diff --git a/src/types/user.ts b/src/core/types/user.ts similarity index 100% rename from src/types/user.ts rename to src/core/types/user.ts diff --git a/src/types/ws.ts b/src/core/types/ws.ts similarity index 100% rename from src/types/ws.ts rename to src/core/types/ws.ts diff --git a/src/utils/modules/tools.ts b/src/core/utils/modules/tools.ts similarity index 87% rename from src/utils/modules/tools.ts rename to src/core/utils/modules/tools.ts index 7975e06..035e337 100644 --- a/src/utils/modules/tools.ts +++ b/src/core/utils/modules/tools.ts @@ -1,6 +1,6 @@ import express from 'express'; -import response from '../core/response'; -import Config from '../core/config'; +import response from '../system/response'; +import Config from '../system/config'; let tools = { /** diff --git a/src/utils/redis/persistence.ts b/src/core/utils/redis/persistence.ts similarity index 93% rename from src/utils/redis/persistence.ts rename to src/core/utils/redis/persistence.ts index 7f3d392..eacaede 100644 --- a/src/utils/redis/persistence.ts +++ b/src/core/utils/redis/persistence.ts @@ -1,7 +1,7 @@ import path from 'path'; -import paths from '../core/path'; -import fc from '../core/file'; -import logger from '../core/logger'; +import paths from '../system/path'; +import fc from '../system/file'; +import logger from '../system/logger'; import fs from 'fs/promises'; class Persistence { diff --git a/src/utils/redis/redisTools.ts b/src/core/utils/redis/redisTools.ts similarity index 95% rename from src/utils/redis/redisTools.ts rename to src/core/utils/redis/redisTools.ts index befd57e..d774d93 100644 --- a/src/utils/redis/redisTools.ts +++ b/src/core/utils/redis/redisTools.ts @@ -1,4 +1,4 @@ -import logger from '../core/logger'; +import logger from '../system/logger'; class redisTools { public static serialize(data: T): string { diff --git a/src/utils/core/autoUpdater.ts b/src/core/utils/system/autoUpdater.ts similarity index 100% rename from src/utils/core/autoUpdater.ts rename to src/core/utils/system/autoUpdater.ts diff --git a/src/utils/core/config.ts b/src/core/utils/system/config.ts similarity index 100% rename from src/utils/core/config.ts rename to src/core/utils/system/config.ts diff --git a/src/utils/core/date.ts b/src/core/utils/system/date.ts similarity index 100% rename from src/utils/core/date.ts rename to src/core/utils/system/date.ts diff --git a/src/utils/core/file.ts b/src/core/utils/system/file.ts similarity index 100% rename from src/utils/core/file.ts rename to src/core/utils/system/file.ts diff --git a/src/utils/core/logger.ts b/src/core/utils/system/logger.ts similarity index 100% rename from src/utils/core/logger.ts rename to src/core/utils/system/logger.ts diff --git a/src/utils/core/path.ts b/src/core/utils/system/path.ts similarity index 100% rename from src/utils/core/path.ts rename to src/core/utils/system/path.ts diff --git a/src/utils/core/response.ts b/src/core/utils/system/response.ts similarity index 100% rename from src/utils/core/response.ts rename to src/core/utils/system/response.ts diff --git a/src/utils/core/system.ts b/src/core/utils/system/system.ts similarity index 100% rename from src/utils/core/system.ts rename to src/core/utils/system/system.ts diff --git a/src/utils/core/tool.ts b/src/core/utils/system/tool.ts similarity index 100% rename from src/utils/core/tool.ts rename to src/core/utils/system/tool.ts diff --git a/src/utils/ws/wsTools.ts b/src/core/utils/ws/wsTools.ts similarity index 96% rename from src/utils/ws/wsTools.ts rename to src/core/utils/ws/wsTools.ts index 67995b9..4bffdc5 100644 --- a/src/utils/ws/wsTools.ts +++ b/src/core/utils/ws/wsTools.ts @@ -1,5 +1,5 @@ import WebSocket from 'ws'; -import logger from '../core/logger'; +import logger from '../system/logger'; import { setInterval } from 'node:timers'; class WsTools { diff --git a/src/main.ts b/src/main.ts index 77a06ea..532a61c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,9 @@ -import apps from './app'; -import logger from './utils/core/logger'; -import config from './utils/core/config'; -import redis from './services/redis/redis'; -import autoUpdater from './utils/core/autoUpdater'; -import System from './utils/core/system'; +import apps from './core/app'; +import logger from './core/utils/system/logger'; +import config from './core/utils/system/config'; +import redis from './core/services/redis/redis'; +import autoUpdater from './core/utils/system/autoUpdater'; +import System from './core/utils/system/system'; config.check(['PORT', 'DEBUG', 'RD_PORT', 'RD_ADD', 'WS_SECRET', 'WS_PORT']); const PORT = config.get('PORT') || 3000; diff --git a/src/modules/bot/bot.controller.ts b/src/modules/bot/bot.controller.ts index bc5f901..2ba9686 100644 --- a/src/modules/bot/bot.controller.ts +++ b/src/modules/bot/bot.controller.ts @@ -1,9 +1,9 @@ import express from 'express'; -import response from '../../utils/core/response'; +import response from '../../core/utils/system/response'; import BotService from './bot.service'; -import tools from '../../utils/modules/tools'; -import logger from '../../utils/core/logger'; -import wsClientManager from '../../services/ws/wsClientManager'; +import tools from '../../core/utils/modules/tools'; +import logger from '../../core/utils/system/logger'; +import wsClientManager from '../../core/services/ws/wsClientManager'; class BotController { private readonly router: express.Router; diff --git a/src/modules/bot/bot.service.ts b/src/modules/bot/bot.service.ts index 2eab80e..4c51fc9 100644 --- a/src/modules/bot/bot.service.ts +++ b/src/modules/bot/bot.service.ts @@ -1,10 +1,10 @@ -import logger from '../../utils/core/logger'; -import paths from '../../utils/core/path'; +import logger from '../../core/utils/system/logger'; +import paths from '../../core/utils/system/path'; import fs from 'fs/promises'; import path from 'path'; -import redisService from '../../services/redis/redis'; -import wsClientManager from '../../services/ws/wsClientManager'; -import tools from '../../utils/core/tool'; +import redisService from '../../core/services/redis/redis'; +import wsClientManager from '../../core/services/ws/wsClientManager'; +import tools from '../../core/utils/system/tool'; class BotService { /** diff --git a/src/modules/public/file.controller.ts b/src/modules/public/file.controller.ts index 244fa65..5c2c3bc 100644 --- a/src/modules/public/file.controller.ts +++ b/src/modules/public/file.controller.ts @@ -1,10 +1,10 @@ import express from 'express'; import FileService from './file.service'; -import logger from '../../utils/core/logger'; -import response from '../../utils/core/response'; -import paths from '../../utils/core/path'; +import logger from '../../core/utils/system/logger'; +import response from '../../core/utils/system/response'; +import paths from '../../core/utils/system/path'; import multer from 'multer'; -import tools from '../../utils/modules/tools'; +import tools from '../../core/utils/modules/tools'; const uploadDir = paths.get('uploads'); const upload = multer({ diff --git a/src/modules/public/file.service.ts b/src/modules/public/file.service.ts index e78bfc8..e9683d8 100644 --- a/src/modules/public/file.service.ts +++ b/src/modules/public/file.service.ts @@ -1,7 +1,7 @@ import path from 'path'; import fs from 'fs/promises'; -import paths from '../../utils/core/path'; -import logger from '../../utils/core/logger'; +import paths from '../../core/utils/system/path'; +import logger from '../../core/utils/system/logger'; import { existsSync } from 'fs'; class FileService { diff --git a/src/modules/sample/sample.controller.ts b/src/modules/sample/sample.controller.ts index 79c8103..f9a58c4 100644 --- a/src/modules/sample/sample.controller.ts +++ b/src/modules/sample/sample.controller.ts @@ -1,6 +1,6 @@ import express from 'express'; import sampleService from './sample.service'; -import response from '../../utils/core/response'; +import response from '../../core/utils/system/response'; class SampleController { private readonly router: express.Router; diff --git a/src/modules/sample/sample.service.ts b/src/modules/sample/sample.service.ts index 8c376f7..da6ced7 100644 --- a/src/modules/sample/sample.service.ts +++ b/src/modules/sample/sample.service.ts @@ -1,4 +1,4 @@ -import logger from '../../utils/core/logger'; +import logger from '../../core/utils/system/logger'; class SampleService { public async getHello() { diff --git a/src/modules/system/system.controller.ts b/src/modules/system/system.controller.ts index 6ff0850..b135aa7 100644 --- a/src/modules/system/system.controller.ts +++ b/src/modules/system/system.controller.ts @@ -1,6 +1,6 @@ import express from 'express'; -import tools from '../../utils/modules/tools'; -import response from '../../utils/core/response'; +import tools from '../../core/utils/modules/tools'; +import response from '../../core/utils/system/response'; import SystemService from './system.service'; class SystemController { diff --git a/src/modules/system/system.service.ts b/src/modules/system/system.service.ts index a17ba1a..fad0865 100644 --- a/src/modules/system/system.service.ts +++ b/src/modules/system/system.service.ts @@ -1,8 +1,8 @@ -import System from '../../utils/core/system'; +import System from '../../core/utils/system/system'; import fs from 'fs/promises'; -import logger from '../../utils/core/logger'; +import logger from '../../core/utils/system/logger'; import path from 'path'; -import paths from '../../utils/core/path'; +import paths from '../../core/utils/system/path'; class SystemService { public async systemRestart() { diff --git a/src/modules/test/test.controller.ts b/src/modules/test/test.controller.ts index 7ad9fc0..9f1f24b 100644 --- a/src/modules/test/test.controller.ts +++ b/src/modules/test/test.controller.ts @@ -1,7 +1,7 @@ import express from 'express'; import TestService from './test.service'; -import response from '../../utils/core/response'; -import logger from '../../utils/core/logger'; +import response from '../../core/utils/system/response'; +import logger from '../../core/utils/system/logger'; class TestController { private readonly router: express.Router; diff --git a/src/modules/test/test.service.ts b/src/modules/test/test.service.ts index a48e805..6b03dea 100644 --- a/src/modules/test/test.service.ts +++ b/src/modules/test/test.service.ts @@ -1,5 +1,5 @@ -import wsClientManager from '../../services/ws/wsClientManager'; -import logger from '../../utils/core/logger'; +import wsClientManager from '../../core/services/ws/wsClientManager'; +import logger from '../../core/utils/system/logger'; class TestService { public async test() { diff --git a/src/modules/words/words.controller.ts b/src/modules/words/words.controller.ts index 30852b9..cf90bbf 100644 --- a/src/modules/words/words.controller.ts +++ b/src/modules/words/words.controller.ts @@ -1,7 +1,7 @@ import express from 'express'; import WordsService from './words.service'; -import response from '../../utils/core/response'; -import tools from '../../utils/modules/tools'; +import response from '../../core/utils/system/response'; +import tools from '../../core/utils/modules/tools'; class WordsController { private readonly router: express.Router; diff --git a/src/modules/words/words.service.ts b/src/modules/words/words.service.ts index a2cfee1..1afa83b 100644 --- a/src/modules/words/words.service.ts +++ b/src/modules/words/words.service.ts @@ -1,7 +1,7 @@ import path from 'path'; -import paths from '../../utils/core/path'; +import paths from '../../core/utils/system/path'; import fs from 'fs/promises'; -import logger from '../../utils/core/logger'; +import logger from '../../core/utils/system/logger'; class WordsService { private wordCache: Record = {}; //缓存 diff --git a/src/utils/index.ts b/src/plugins/keep similarity index 100% rename from src/utils/index.ts rename to src/plugins/keep diff --git a/src/test/wsTestClient.ts b/src/test/wsTestClient.ts index e7c6158..5a9955c 100644 --- a/src/test/wsTestClient.ts +++ b/src/test/wsTestClient.ts @@ -1,6 +1,6 @@ import WebSocket from 'ws'; import axios from 'axios'; -import logger from '../utils/core/logger'; +import logger from '../core/utils/system/logger'; const WS_URL = 'ws://127.0.0.1:4001'; const WS_SECRET = '114514';