This commit is contained in:
2025-12-01 16:54:40 +08:00
parent 603d08e948
commit d704b8386c
3 changed files with 98 additions and 204 deletions
+28
View File
@@ -160,3 +160,31 @@ class WZRYFunction:
return return_data
async def bilei_all(self):
"""
查询仇人列表
"""
return_data = {
"code": 0,
"msg": "功能函数未执行",
"data": {}
}
# 查询所有
try:
sql = "SELECT * FROM wzrybl"
sqlid = await self.__db.fetch_all(sql)
except Exception as e:
logger.error(f"处理数据时出错: {e}")
return_data["msg"] = "处理数据库信息时出错"
return return_data
# 加载模板
try:
return_data["temp"] = load_template("temp_test.html")
except FileNotFoundError as e:
logger.error(f"加载模板失败: {e}")
return_data["msg"] = "系统错误:模板文件不存在"
return return_data
return_data["data"]["lists"] = sqlid
return_data["code"] = 200
return return_data
+12 -7
View File
@@ -374,14 +374,19 @@ class Jx3ApiPlugin(Star):
logger.error(f"功能函数执行错误: {e}")
yield event.plain_result("猪脑过载,请稍后再试")
@wz.command("测试")
async def wz_test(self, event: AstrMessageEvent,name: str = "489048724"):
"""王者 战绩 营地ID 对局类型"""
@filter.command("仇人列表")
async def wz_bilei(self, event: AstrMessageEvent,):
"""仇人列表"""
try:
provider_id = await self.context.get_current_chat_provider_id(umo=event.unified_msg_origin)
llm_resp = await self.context.llm_generate(chat_provider_id=provider_id, prompt="Hello, world!",)
out = llm_resp.completion_text
yield event.plain_result(f"{out}")
data = await self.wzry.bilei_all()
if data["code"] == 200:
url = await self.html_render(data["temp"], data["data"], options={})
yield event.image_result(url)
else:
yield event.plain_result(data["msg"])
return
#logger.info(f"输出结果{event.get_sender_name()}\n{out}")
#yield event.plain_result(f"{out}")
except Exception as e:
logger.error(f"功能函数执行错误: {e}")
yield event.plain_result("猪脑过载,请稍后再试")
+58 -197
View File
@@ -2,7 +2,7 @@
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>王者荣耀 — 对局列表</title>
<title>王者荣耀 — 仇人列表</title>
<style>
body {
@@ -13,227 +13,88 @@
}
.container {
max-width: 900px;
max-width: 1000px;
margin: 0 auto;
text-align: center; /* ★ 让容器内标题更自然居中 */
}
h1 {
text-align: center;
font-size: 32px;
margin-bottom: 25px;
color: #222;
font-weight: 800;
text-align: center; /* ★ 强制居中 */
}
/* 卡片基础样式 */
.match-card {
display: flex;
border-radius: 18px;
padding: 16px;
margin-bottom: 18px;
position: relative;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
/* 背景色 */
.win { background: #e5f4ff; }
.lose { background: #ffe9e9; }
.draw { background: #f1f2f3; }
.hero-box img {
width: 76px;
height: 76px;
border-radius: 10px;
object-fit: cover;
}
.hero-desc {
text-align: center;
margin-top: 8px;
font-size: 18px;
font-weight: bold;
color: #333;
}
.content {
flex: 1;
padding-left: 15px;
font-size: 16px;
color: #333;
position: relative;
}
/* 右上角标签区域 */
.tag-area {
position: absolute;
right: 16px;
top: 16px;
display: flex;
gap: 8px;
}
/* 胜负标签 */
.result-tag {
padding: 6px 12px;
border-radius: 8px;
font-size: 14px;
font-weight: bold;
color: white;
}
.win-tag { background: #4a90e2; }
.lose-tag { background: #d93939; }
.draw-tag { background: #777; }
/* 对局时间 + 对局类型 */
.info-line-time {
font-size: 18px;
color: #000;
margin-bottom: 6px;
}
/* 段位 + 星星 */
.rank-stars {
font-size: 16px;
color: #2ecc71;
font-weight: bold;
margin-bottom: 6px;
}
/* KDA 信息 */
.kda-info {
font-size: 16px;
font-weight: bold;
color: #555;
margin-bottom: 6px;
}
/* 巅峰赛积分 */
.master-score {
font-size: 16px;
font-weight: bold;
color: #056a3a;
margin-bottom: 6px;
}
/* 评分显示 */
.score-badge {
position: absolute;
right: 16px;
bottom: 16px;
background: #ffd700;
color: #222;
font-size: 20px;
font-weight: 900;
padding: 6px 14px;
table {
width: 100%;
border-collapse: collapse;
background: white;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
overflow: hidden;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
margin-top: 10px;
text-align: left; /* 不影响表格内容 */
}
/* 新增成就标签 */
.achievement-tags {
margin-top: 8px;
display: flex;
flex-wrap: wrap;
gap: 6px;
thead {
background: #d93939;
color: white;
font-size: 18px;
}
.achievement-tags span {
background: rgba(0, 0, 0, 0.6);
color: #fff;
font-weight: bold;
padding: 6px 10px;
border-radius: 14px;
font-size: 14px;
text-shadow: 0 1px 2px rgba(0,0,0,0.5);
th, td {
padding: 14px 12px;
border-bottom: 1px solid #eee;
font-size: 16px;
}
tbody tr:hover {
background: #fff2f2;
}
.text-col {
max-width: 360px;
line-height: 1.5em;
word-break: break-word;
font-weight: 600;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<h1>王者荣耀 — 对局列表</h1>
<h1>王者荣耀 — 仇人列表</h1>
{% for m in data %}
<div class="match-card
{% if m.gameresult == 1 %}win
{% elif m.gameresult == 2 %}lose
{% else %}draw
{% endif %}">
<div class="hero-box">
<img src="{{ m.heroIcon }}">
<div class="hero-desc">{{ m.desc }}</div>
</div>
<div class="content">
<!-- 右上角标签(evaluate + MVP PNG -->
<div class="tag-area">
{% if m.evaluateUrlV3 %}
<img src="{{ m.evaluateUrlV3 }}"
style="height: 32px; border-radius: 6px;">
{% endif %}
{% if m.mvpUrlV3 %}
<img src="{{ m.mvpUrlV3 }}"
style="height: 32px; border-radius: 6px;">
{% endif %}
<div class="result-tag
{% if m.gameresult == 1 %}win-tag
{% elif m.gameresult == 2 %}lose-tag
{% else %}draw-tag
{% endif %}">
{% if m.gameresult == 1 %}胜利
{% elif m.gameresult == 2 %}失败
{% else %}平局
{% endif %}
</div>
</div>
<!-- 对局时间 + 对局类型 -->
<div class="info-line-time">
{{ m.gametime }} · {{ m.mapName }}
</div>
<!-- 段位 + 星星 -->
<div class="rank-stars">
{{ m.roleJobName }} · ⭐{{ m.stars }}
</div>
<!-- 巅峰赛积分(原 KDA 位置) -->
<div class="master-score">
巅峰赛积分 {{ m.oldMasterMatchScore }} → {{ m.newMasterMatchScore }}
</div>
<!-- KDA 信息(原巅峰赛位置) -->
<div class="kda-info">
击杀 {{ m.killcnt }} 死亡 {{ m.deadcnt }} 助攻 {{ m.assistcnt }} 时长 {{ m.time_str }}
</div>
<!-- 新增成就显示 -->
<div class="achievement-tags">
{% if m.godLikeCnt > 0 %}<span>超神 × {{ m.godLikeCnt }}</span>{% endif %}
{% if m.firstBlood > 0 %}<span>一血</span>{% endif %}
{% if m.hero1TripleKillCnt > 0 %}<span>三杀 × {{ m.hero1TripleKillCnt }}</span>{% endif %}
{% if m.hero1UltraKillCnt > 0 %}<span>四杀 × {{ m.hero1UltraKillCnt }}</span>{% endif %}
{% if m.hero1RampageCnt > 0 %}<span>五杀 × {{ m.hero1RampageCnt }}</span>{% endif %}
</div>
<!-- 评分放右下角 -->
<div class="score-badge">
评分 {{ m.gradeGame }}
</div>
</div>
</div>
<table>
<thead>
<tr>
<th>ID</th>
<th>名称</th>
<th>英雄</th>
<th>分路</th>
<th>记录者</th>
<th>时间</th>
<th>描述</th>
</tr>
</thead>
<tbody>
{% for m in lists %}
<tr>
<td>{{ m.id }}</td>
<td>{{ m.name }}</td>
<td>{{ m.hero }}</td>
<td>{{ m.fenglu }}</td>
<td>{{ m.user }}</td>
<td>{{ m.time }}</td>
<td class="text-col">{{ m.text }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</body>