diff --git a/core/cless_jx3.py b/core/cless_jx3.py
index daf9563..2c4dfbb 100644
--- a/core/cless_jx3.py
+++ b/core/cless_jx3.py
@@ -435,7 +435,18 @@ class JX3Function:
item["LowestPrice"] = gold_to_string(item["LowestPrice"])
item["AvgPrice"] = gold_to_string(item["AvgPrice"])
item["IconID"] = f"https://icon.jx3box.com/icon/{item['IconID']}.png"
-
- return_data["data"]=resultjyh
+ # 准备模板渲染数据
+ return_data["data"] = {
+ "items": resultjyh,
+ "server": server,
+ "update_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ }
+ # 加载模板
+ try:
+ return_data["temp"] = load_template("jiaoyihang.html")
+ except FileNotFoundError as e:
+ logger.error(f"加载模板失败: {e}")
+ return_data["msg"] = "系统错误:模板文件不存在"
+ return return_data
return_data["code"] = 200
return return_data
diff --git a/core/function_basic.py b/core/function_basic.py
index 8f70861..47bf287 100644
--- a/core/function_basic.py
+++ b/core/function_basic.py
@@ -96,11 +96,21 @@ def gold_to_string(gold_amount):
Returns:
str: 格式化后的金钱字符串,例如 "1金2银3铜"
"""
- bricks = gold_amount // 100000000 if gold_amount else 0
- gold = (gold_amount % 100000000) // 10000 if gold_amount else 0
- silver = (gold_amount % 10000) // 100 if gold_amount else 0
- copper = gold_amount % 100 if gold_amount else 0
-
- gold_str = f"{bricks}砖{gold}金{silver}银{copper}铜" if gold_amount else "无价格"
+ if not gold_amount:
+ return "无价格"
- return gold_str
\ No newline at end of file
+ parts = []
+ started = False # 标记是否已经遇到第一个非零位
+
+ bricks = gold_amount // 100000000
+ gold = (gold_amount % 100000000) // 10000
+ silver = (gold_amount % 10000) // 100
+ copper = gold_amount % 100
+
+ for value, unit in [(bricks, "砖"), (gold, "金"), (silver, "银"), (copper, "铜")]:
+ if value != 0:
+ started = True
+ if started:
+ parts.append(f"{value}{unit}")
+
+ return "".join(parts)
\ No newline at end of file
diff --git a/main.py b/main.py
index 599f119..7e85461 100644
--- a/main.py
+++ b/main.py
@@ -166,14 +166,14 @@ class Jx3ApiPlugin(Star):
@jx3.command("交易行")
- async def jx3_jiaoyihang(self, event: AstrMessageEvent,Name: str = "守缺式",server: str = "眉间雪"):
+ async def jx3_jiaoyihang(self, event: AstrMessageEvent,Name: str = "守缺式",server: str = "梦江南"):
"""剑三 外观名称"""
try:
data=await self.jx3fun.jiaoyihang(Name,server)
if data["code"] == 200:
- #url = await self.html_render(data["temp"], data["data"], options={})
- #yield event.image_result(url)
- yield event.plain_result(f"{data['data']}")
+ url = await self.html_render(data["temp"], data["data"], options={})
+ yield event.image_result(url)
+
else:
yield event.plain_result(data["msg"])
return
diff --git a/templates/jiaoyihang.html b/templates/jiaoyihang.html
index 590d7ce..a0378b0 100644
--- a/templates/jiaoyihang.html
+++ b/templates/jiaoyihang.html
@@ -55,6 +55,13 @@
font-weight: 600;
color: #4a90e2;
}
+ .item-icon {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ vertical-align: middle;
+ border-radius: 4px; /* 图标圆角,看起来更舒服 */
+ }
.update-time {
color: #6c757d;
font-size: 14px;
@@ -62,6 +69,7 @@
.table-container {
padding: 0 30px 30px 30px;
overflow-x: auto;
+ text-align: center;
}
table {
width: 100%;
@@ -77,7 +85,7 @@
padding: 16px 20px;
text-align: left;
font-weight: 500;
- font-size: 16px;
+ font-size: 20px;
position: sticky;
top: 0;
}
@@ -90,7 +98,7 @@
td {
padding: 14px 20px;
border-bottom: 1px solid #e9ecef;
- font-size: 15px;
+ font-size: 18px;
color: #495057;
}
tr:nth-child(even) {
@@ -145,24 +153,29 @@
共找到 {{ items|length }} 件物品
-
数据更新时间: {{ update_time }}
+
数据查询时间: {{ update_time }}
- | 物品名称 |
- 最低价 |
- 数量 |
+ 物品名称 |
+ 最低价 |
+ 总数量 |
+ 数据更新时间 |
{% for item in items %}
- | {{ item.name }} |
- {{ item.price }} |
- {{ item.sample_size }} |
+
+
+ {{ item.Name }}
+ |
+ {{ item.AvgPrice }} |
+ {{ item.SampleSize }} |
+ {{ item.Date }} |
{% endfor %}
diff --git a/templates/jinjia.html b/templates/jinjia.html
index 2e31e29..4e89622 100644
--- a/templates/jinjia.html
+++ b/templates/jinjia.html
@@ -78,7 +78,7 @@
padding: 16px 20px;
text-align: left;
font-weight: 500;
- font-size: 16px;
+ font-size: 20px;
position: sticky;
top: 0;
}
@@ -91,7 +91,7 @@
td {
padding: 14px 20px;
border-bottom: 1px solid #e9ecef;
- font-size: 15px;
+ font-size: 18px;
color: #495057;
}
tr:nth-child(even) {
diff --git a/templates/qiyuliebiao.html b/templates/qiyuliebiao.html
index 5048d91..34bc156 100644
--- a/templates/qiyuliebiao.html
+++ b/templates/qiyuliebiao.html
@@ -78,7 +78,7 @@
padding: 16px 20px;
text-align: left;
font-weight: 500;
- font-size: 16px;
+ font-size: 20px;
position: sticky;
top: 0;
}
@@ -91,7 +91,7 @@
td {
padding: 14px 20px;
border-bottom: 1px solid #e9ecef;
- font-size: 15px;
+ font-size: 18px;
color: #495057;
}
tr:nth-child(even) {
diff --git a/templates/simple_test.html b/templates/simple_test.html
deleted file mode 100644
index 9d45217..0000000
--- a/templates/simple_test.html
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
- 剑网3交易行价格查询
-
-
-
-
-
-
-
-
共找到 {{ items|length }} 件物品
-
数据更新时间: {{ update_time }}
-
-
-
-
-
-
- | 物品名称 |
- 最低价 |
- 数量 |
-
-
-
- {% for item in items %}
-
- | {{ item.name }} |
- {{ item.price }} |
- {{ item.sample_size }} |
-
- {% endfor %}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/templates/temp_test.html b/templates/temp_test.html
new file mode 100644
index 0000000..e69de29
diff --git a/templates/wujiatest.html b/templates/wujiatest.html
deleted file mode 100644
index e0cee0f..0000000
--- a/templates/wujiatest.html
+++ /dev/null
@@ -1,220 +0,0 @@
-
-
-
-
-
- {{ data.showName }} - 剑网3万宝楼
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
{{ data.showName }}({{data.goodsAlias}})
-
{{ data.goodsDesc }}
-
-
-
- 发布时间: {{ data.publishTime.split('T')[0] if data.publishTime else '未知' }}
-
-
- 参考价格: {{ data.priceNum }} 元
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | 上架时间 |
- 服务器 |
- 价格 |
- 折扣率 |
-
-
-
- {% for item in data.wblgs %}
-
- | {{ item.replyTime }} |
- {{ item.belongQf2 }} |
- {{ item.priceNum }}元 |
-
-
- {{ item.discountRate }}%
-
- |
-
- {% endfor %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | 上架时间 |
- 服务器 |
- 价格 |
- 折扣率 |
-
-
-
- {% for item in data.wblzs %}
-
- | {{ item.replyTime }} |
- {{ item.belongQf2 }} |
- {{ item.priceNum }}元 |
-
-
- {{ item.discountRate }}%
-
- |
-
- {% endfor %}
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file