diff --git a/README.md b/README.md index 9964d53..4198acd 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,5 @@ # 剑网三数据查询工具 -
- -![Python Version](https://img.shields.io/badge/Python-3.10.14%2B-blue) - -
- ## 目录 - [剑网三数据查询工具](#-剑网三数据查询工具) @@ -14,6 +8,7 @@ - [更新记录](#-更新记录) - [功能特点](#-功能特点) - [插件配置](#-插件配置) + - [使用方式](#-使用方式) ## 简介 diff --git a/core/request.py b/core/request.py index 91830e7..e204057 100644 --- a/core/request.py +++ b/core/request.py @@ -1,6 +1,7 @@ # core/request.py import json import aiohttp +import asyncio from typing import Optional, Dict, Any, Union, List from aiohttp import ClientTimeout, ClientSession @@ -75,23 +76,20 @@ class APIClient: """处理响应:自动识别二进制或JSON""" try: logger.debug(f"响应状态: {response.status}") - response.raise_for_status() # 如果是 4xx/5xx 直接抛出异常 + response.raise_for_status() content_type = response.headers.get('Content-Type', '').lower() - # 处理二进制流 (图片、文件等) if 'image' in content_type or 'octet-stream' in content_type: return await response.read() - # 处理 JSON - # 优先尝试标准 json 解析 try: data = await response.json() except Exception: - # 容错:有些 API 返回 text/html 但内容是 JSON text = await response.text() try: - data = json.loads(text) + loop = asyncio.get_running_loop() + data = await loop.run_in_executor(None, json.loads, text) except json.JSONDecodeError: logger.error(f"无法解析响应为 JSON。原始内容: {text[:100]}...") return None diff --git a/templates/wujia.html b/templates/wujia.html index bcdbf19..6b4f295 100644 --- a/templates/wujia.html +++ b/templates/wujia.html @@ -102,6 +102,28 @@ color: #d93939; font-weight: 700; } + + /* ===== 万宝楼公示(蓝色) ===== */ + .table-card.notice .table-title { + color: #1e6bd6; + } + .table-card.notice .price-col { + color: #1e6bd6; + } + .table-card.notice thead { + background: #1e6bd6; + } + + /* ===== 万宝楼在售(绿色) ===== */ + .table-card.sale .table-title { + color: #2e8b57; + } + .table-card.sale .price-col { + color: #2e8b57; + } + .table-card.sale thead { + background: #2e8b57; + } @@ -123,7 +145,7 @@
-
+
万宝楼公示
@@ -140,7 +162,7 @@ - + {% endfor %} @@ -148,7 +170,7 @@ -
+
万宝楼在售
{{ item.date }} {{ item.server }} {{ item.value }} 公示 公示
@@ -165,7 +187,7 @@ - + {% endfor %}
{{ item.date }} {{ item.server }} {{ item.value }} 在售 在售