This commit is contained in:
2025-12-13 15:14:49 +08:00
parent 2c7735aa2d
commit 3445809d71
5 changed files with 337 additions and 0 deletions
+83
View File
@@ -697,3 +697,86 @@ class JX3Service:
return_data["code"] = 200
return return_data
async def dilujilu(self, server: str) -> Dict[str, Any]:
"""的卢记录"""
return_data = self._init_return_data()
# 获取配置中的 Token
token = self._config.get("jx3api_token", "")
if token == "":
return_data["msg"] = "系统未配置API访问Token"
return return_data
# 1. 构造请求参数
params = {"server": server, "token": token}
# 2. 调用基础请求
data: Optional[Dict[str, Any]] = await self._base_request(
"jx3_dilujilu", "GET", params=params
)
if not data:
return_data["msg"] = "获取接口信息失败"
return return_data
# 3. 处理返回数据
for item in data:
item["refresh_time"] = datetime.fromtimestamp(item["refresh_time"]).strftime("%Y-%m-%d %H:%M:%S")
item["capture_time"] = datetime.fromtimestamp(item["capture_time"]).strftime("%Y-%m-%d %H:%M:%S")
item["auction_time"] = datetime.fromtimestamp(item["auction_time"]).strftime("%Y-%m-%d %H:%M:%S")
# 4. 加载模板
try:
return_data["temp"] = load_template("dilujilu.html")
except FileNotFoundError as e:
logger.error(f"加载模板失败: {e}")
return_data["msg"] = "系统错误:模板文件不存在"
return return_data
return_data["data"]["list"] = data
return_data["code"] = 200
return return_data
async def tuanduizhaomu(self, server: str, keyword: str) -> Dict[str, Any]:
"""团队招募"""
return_data = self._init_return_data()
# 获取配置中的 Token
token = self._config.get("jx3api_token", "")
if token == "":
return_data["msg"] = "系统未配置API访问Token"
return return_data
# 1. 构造请求参数
params = {"server": server, "keyword": keyword, "token": token}
# 2. 调用基础请求
data: Optional[Dict[str, Any]] = await self._base_request(
"jx3_tuanduizhaomu", "GET", params=params
)
if not data:
return_data["msg"] = "获取接口信息失败"
return return_data
# 3. 处理返回数据
for item in data["data"]:
item["createTime"] = datetime.fromtimestamp(item["createTime"]).strftime("%Y-%m-%d %H:%M:%S")
item["number"] = f"{item['number']}/{item['maxNumber']}"
# 4. 加载模板
try:
return_data["temp"] = load_template("tuanduizhaomu.html")
except FileNotFoundError as e:
logger.error(f"加载模板失败: {e}")
return_data["msg"] = "系统错误:模板文件不存在"
return return_data
return_data["data"]["list"] = data["data"]
return_data["code"] = 200
return return_data
+20
View File
@@ -176,5 +176,25 @@
"name": "萝莉",
"token":""
}
},
"jx3_dilujilu":{
"url":"https://www.jx3api.com/data/dilu/records",
"method":"GET",
"description":"此接口用于查询的卢马的刷新、捕获及拍卖记录,包括捕获者、拍卖价格及相关时间信息",
"params":{
"server": "唯我独尊",
"token":""
}
},
"jx3_tuanduizhaomu":{
"url":"https://www.jx3api.com/data/member/recruit",
"method":"GET",
"description":"此接口用于查询指定区服的团队招募信息,包括活动类型、队长信息及当前队伍状态。",
"params":{
"server": "梦江南",
"keyword": "25人普通会战弓月城",
"table": 1,
"token":""
}
}
}
+32
View File
@@ -324,6 +324,38 @@ class Jx3ApiPlugin(Star):
yield event.plain_result("猪脑过载,请稍后再试")
@jx3.command("的卢")
async def jx3_dilujilu(self, event: AstrMessageEvent,server: str = "梦江南"):
"""剑三 的卢 服务器"""
try:
data= await self.jx3fun.dilujilu(server)
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
except Exception as e:
logger.error(f"功能函数执行错误: {e}")
yield event.plain_result("猪脑过载,请稍后再试")
@jx3.command("招募")
async def jx3_tuanduizhaomu(self, event: AstrMessageEvent,keyword: str = "25人普通会战弓月城", server: str = "梦江南"):
"""剑三 招募 副本 服务器"""
try:
data= await self.jx3fun.tuanduizhaomu(server,keyword)
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
except Exception as e:
logger.error(f"功能函数执行错误: {e}")
yield event.plain_result("猪脑过载,请稍后再试")
async def terminate(self):
"""可选择实现异步的插件销毁方法,当插件被卸载/停用时会调用。"""
# 关闭数据库连接
+105
View File
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>的卢记录</title>
<style>
body {
font-family: 'Microsoft YaHei', Arial, sans-serif;
background: #f1f2f6;
margin: 0;
padding: 20px;
}
.container {
max-width: 1300px;
margin: 0 auto;
text-align: center; /* ★ 让容器内标题更自然居中 */
}
h1 {
font-size: 32px;
margin-bottom: 25px;
color: #222;
font-weight: 800;
text-align: center; /* ★ 强制居中 */
}
table {
width: 100%;
border-collapse: collapse;
background: white;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
margin-top: 10px;
text-align: left; /* 不影响表格内容 */
}
thead {
background: #d93939;
color: white;
font-size: 18px;
}
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>
<table>
<thead>
<tr>
<th>服务器</th>
<th>开始时间</th>
<th>捕获时间</th>
<th>捕获人</th>
<th>所属阵营</th>
<th>拍卖时间</th>
<th>拍卖价格</th>
<th>拍得者</th>
<th>所属阵营</th>
</tr>
</thead>
<tbody>
{% for m in list %}
<tr>
<td>{{ m.server }}</td>
<td>{{ m.refresh_time }}</td>
<td>{{ m.capture_time }}</td>
<td>{{ m.capture_role_name }}</td>
<td>{{ m.capture_camp_name }}</td>
<td>{{ m.auction_time }}</td>
<td>{{ m.auction_amount }}</td>
<td>{{ m.auction_role_name }}</td>
<td>{{ m.auction_camp_name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</body>
</html>
+97
View File
@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>团队招募</title>
<style>
body {
font-family: 'Microsoft YaHei', Arial, sans-serif;
background: #f1f2f6;
margin: 0;
padding: 20px;
}
.container {
max-width: 1300px;
margin: 0 auto;
text-align: center; /* ★ 让容器内标题更自然居中 */
}
h1 {
font-size: 32px;
margin-bottom: 25px;
color: #222;
font-weight: 800;
text-align: center; /* ★ 强制居中 */
}
table {
width: 100%;
border-collapse: collapse;
background: white;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
margin-top: 10px;
text-align: left; /* 不影响表格内容 */
}
thead {
background: #d93939;
color: white;
font-size: 18px;
}
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>
<table>
<thead>
<tr>
<th>副本名称</th>
<th>招募人</th>
<th>招募时间</th>
<th>人数</th>
<th>招募说明</th>
</tr>
</thead>
<tbody>
{% for m in list %}
<tr>
<td>{{ m.activity }}</td>
<td>{{ m.leader }}</td>
<td>{{ m.createTime }}</td>
<td>{{ m.number }}</td>
<td>{{ m.content }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</body>
</html>