11
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
# 剑网三数据查询工具
|
||||
|
||||
<div align="center">
|
||||
|
||||

|
||||
|
||||
</div>
|
||||
|
||||
## 目录
|
||||
|
||||
- [剑网三数据查询工具](#-剑网三数据查询工具)
|
||||
@@ -14,6 +8,7 @@
|
||||
- [更新记录](#-更新记录)
|
||||
- [功能特点](#-功能特点)
|
||||
- [插件配置](#-插件配置)
|
||||
- [使用方式](#-使用方式)
|
||||
|
||||
## 简介
|
||||
|
||||
|
||||
+4
-6
@@ -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
|
||||
|
||||
+26
-4
@@ -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;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -123,7 +145,7 @@
|
||||
<div class="table-wrapper">
|
||||
|
||||
<!-- 1 万宝楼公示 -->
|
||||
<div class="table-card">
|
||||
<div class="table-card notice">
|
||||
<div class="table-title">万宝楼公示</div>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -140,7 +162,7 @@
|
||||
<td class="server-col">{{ item.date }}</td>
|
||||
<td class="server-col">{{ item.server }}</td>
|
||||
<td class="price-col">{{ item.value }}</td>
|
||||
<td class="server-col"> 公示 </td>
|
||||
<td class="server-col">公示</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -148,7 +170,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 2 万宝楼在售 -->
|
||||
<div class="table-card">
|
||||
<div class="table-card sale">
|
||||
<div class="table-title">万宝楼在售</div>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -165,7 +187,7 @@
|
||||
<td class="server-col">{{ item.date }}</td>
|
||||
<td class="server-col">{{ item.server }}</td>
|
||||
<td class="price-col">{{ item.value }}</td>
|
||||
<td class="server-col"> 在售 </td>
|
||||
<td class="server-col">在售</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user