diff --git a/docs/index.md b/docs/index.md index c862ec8d..1a11398f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -29,8 +29,8 @@ corepack enable # 安装依赖 pnpm i -# 编译 解析库、工具库、前端模板 -pnpm run build +# 运行网页版 +pnpm run web:dev ``` ### 源码目录结构 diff --git a/packages/core/src/analyzer/RuleManager.ts b/packages/core/src/analyzer/RuleManager.ts index 6ce95674..8e92dc7f 100644 --- a/packages/core/src/analyzer/RuleManager.ts +++ b/packages/core/src/analyzer/RuleManager.ts @@ -28,13 +28,13 @@ export class RuleManager implements IParser { searchPage: 1 }); this.analyzerManager = analyzerManager; - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[init] rule:${rule.name}`); + this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[初始化规则] ${rule.id} ${rule.name}`); } private async request(params: any) { - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[request] params:${JSON.stringify(params || {})}`); + this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[网络请求] -> ${JSON.stringify(params || {})}`); const res = await fetch(params); - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[request] query:${String(res.body)}`); + this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[网络请求] <- ${String(res.body)}`); return res; } @@ -45,7 +45,7 @@ export class RuleManager implements IParser { async search(query: string, page = 1, pageSize = 20) { // const hasNextUrlRule = this.rule.searchNextUrl !== null && this.rule.searchNextUrl.length > 0; - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[search] query:${query}`); + this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[搜索] ${query}`); let searchRule = ''; let url = this.rule.searchUrl; @@ -82,11 +82,8 @@ export class RuleManager implements IParser { searchKey: query }); - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[search] searchRule:${searchRule}`); if (this.rule.searchUrl !== 'null') { const res = await this.request(parseRequest(await this.parseJsUrl(searchRule), query, '', this.rule, page, pageSize)); - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[search] params:${JSON.stringify(res.params || {})}`); - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[search] body:${String(res.body)}`); body = res.body; searchUrl = res.params.url as string; } @@ -95,9 +92,7 @@ export class RuleManager implements IParser { // next = await this.analyzerManager.getString(this.rule.searchNextUrl, body); // } - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[search] rule.searchList:${this.rule.searchList}`); const list = await this.getList(body, this.rule.searchList); - this.analyzerManager.logLevel >= LogLevel.Debug && this.analyzerManager.logger.debug(`[search] list:${JSON.stringify(list || [])}}`); const result = []; for (const item of list) { diff --git a/packages/shared/src/app.ts b/packages/shared/src/app.ts index 07b7b78d..eb4267da 100644 --- a/packages/shared/src/app.ts +++ b/packages/shared/src/app.ts @@ -79,12 +79,12 @@ async function runApp(app: App, register: any) { const callName = [route.method.toLowerCase(), route.route].join('@'); register(callName, async (...arg: any) => { const instance: any = new Controller(app); - app.analyzerManager.logLevel >= LogLevel.Debug && app.analyzerManager.logger.debug(`[api] ${callName} ${JSON.stringify(arg)}`); + app.analyzerManager.logLevel >= LogLevel.Debug && app.analyzerManager.logger.debug(`[call] ${callName} ${JSON.stringify(arg)}`); return await instance[route.methodName](...arg) .then((res: any) => result(res)) .catch((err: Error) => { - app.analyzerManager.logLevel >= LogLevel.Error && err.message && app.analyzerManager.logger.error(err.message); + app.analyzerManager.logLevel >= LogLevel.Error && err.message && app.analyzerManager.logger.error(`[错误] ${err.message}`); let message = err?.message || 'error'; if (err instanceof FetchException) message = '网络请求异常'; else if (err instanceof JsVmException) message = '执行脚本异常'; diff --git a/packages/web/src/pages/pc/category/index.vue b/packages/web/src/pages/pc/category/index.vue index 9e9a3786..1003d572 100644 --- a/packages/web/src/pages/pc/category/index.vue +++ b/packages/web/src/pages/pc/category/index.vue @@ -87,7 +87,7 @@ - + @@ -99,11 +99,14 @@ + + + +