Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

Commit

Permalink
🐛 修复物价接口
Browse files Browse the repository at this point in the history
  • Loading branch information
JustUndertaker committed Nov 9, 2022
1 parent 46480fe commit 0124cdf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
9 changes: 9 additions & 0 deletions src/internal/jx3api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ class JX3API:
说明:
废牛物品价格统计
参数:
* `name`:物品名称,查询指定物品的价格信息。
"""
...
async def data_trade_xiaohei(self, *, name: str) -> Response:
"""
说明:
小黑物品价格统计
参数:
* `name`:物品名称,查询指定物品的价格信息。
"""
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/jx3_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ async def _(event: GroupMessageEvent, server: str = get_server()) -> NoReturn:
await saohua_query.finish(msg)

data = response.data
url=data.get("url")
url = data.get("url")
await sand_query.finish(MessageSegment.image(url))


Expand All @@ -583,7 +583,7 @@ async def _(event: GroupMessageEvent, name: str = get_value()) -> NoReturn:
if api.config.api_token:
response = await api.data_trade_search(name=name)
else:
response = await api.data_trade_feiniu(name=name)
response = await api.data_trade_xiaohei(name=name)
if response.code != 200:
msg = f"查询失败,{response.msg}"
await price_query.finish(msg)
Expand All @@ -592,7 +592,10 @@ async def _(event: GroupMessageEvent, name: str = get_value()) -> NoReturn:
pagename = "物品价格.html"
item_name = data.get("name")
item_info = data.get("info")
item_img = data.get("url")
if api.config.api_token:
item_img = data.get("url")
else:
item_img=data.get("upload")
item_data = source.handle_data_price(data.get("data"))
img = await browser.template_to_image(
pagename=pagename,
Expand Down
28 changes: 24 additions & 4 deletions template/物品价格.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@
<p class="text-center fs-2">{{ name }}</p>
</div>
<div class="card-body">
{% if image is defined %}
<div class="row">
<img src="{{ image }}">
</div>
{% endif %}
{% if info is defined %}
<div class="row">
<div class="alert alert-secondary text-center">
<p class="fs-2">{{ info }}</p>
</div>
</div>
{% endif %}
<table class="table table-bordered">
<tr>
<td>
Expand All @@ -42,7 +38,11 @@
<td class='text-center'>{{ one.server }}</td>
<td class='text-center text-primary'>¥{{ one.value }}</td>
<td class='text-center'>
{% if one.sale %}
{{ one.sale }}
{% else %}
{{ one.sales }}
{% endif %}
</td>
</tr>
{% endfor %}
Expand All @@ -61,7 +61,11 @@
<td class='text-center'>{{ one.server }}</td>
<td class='text-center text-primary'>¥{{ one.value }}</td>
<td class='text-center'>
{% if one.sale %}
{{ one.sale }}
{% else %}
{{ one.sales }}
{% endif %}
</td>
</tr>
{% endfor %}
Expand All @@ -82,7 +86,11 @@
<td class='text-center'>{{ one.server }}</td>
<td class='text-center text-primary'>¥{{ one.value }}</td>
<td class='text-center'>
{% if one.sale %}
{{ one.sale }}
{% else %}
{{ one.sales }}
{% endif %}
</td>
</tr>
{% endfor %}
Expand All @@ -101,7 +109,11 @@
<td class='text-center'>{{ one.server }}</td>
<td class='text-center text-primary'>¥{{ one.value }}</td>
<td class='text-center'>
{% if one.sale %}
{{ one.sale }}
{% else %}
{{ one.sales }}
{% endif %}
</td>
</tr>
{% endfor %}
Expand All @@ -122,7 +134,11 @@
<td class='text-center'>{{ one.server }}</td>
<td class='text-center text-primary'>¥{{ one.value }}</td>
<td class='text-center'>
{% if one.sale %}
{{ one.sale }}
{% else %}
{{ one.sales }}
{% endif %}
</td>
</tr>
{% endfor %}
Expand All @@ -141,7 +157,11 @@
<td class='text-center'>{{ one.server }}</td>
<td class='text-center text-primary'>¥{{ one.value }}</td>
<td class='text-center'>
{% if one.sale %}
{{ one.sale }}
{% else %}
{{ one.sales }}
{% endif %}
</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 0124cdf

Please sign in to comment.