feat: #网易状态美化

This commit is contained in:
zhiyu1998 2024-10-16 00:38:31 +08:00
parent 1b67727927
commit 71d4290bfe
4 changed files with 174 additions and 6 deletions

View File

@ -55,6 +55,7 @@ import {
XHS_REQ_LINK
} from "../constants/tools.js";
import config from "../model/config.js";
import NeteaseModel from "../model/netease.js";
import * as aBogus from "../utils/a-bogus.cjs";
import { downloadM3u8Videos, mergeAcFileToMp4, parseM3u8, parseUrl } from "../utils/acfun.js";
import { startBBDown } from "../utils/bbdown-util.js";
@ -101,6 +102,7 @@ import Translate from "../utils/trans-strategy.js";
import { mid2id } from "../utils/weibo.js";
import { ytDlpGetTilt, ytDlpHelper } from "../utils/yt-dlp-util.js";
import { textArrayToMakeForward } from "../utils/yunzai-util.js";
import puppeteer from "../../../lib/puppeteer/puppeteer.js";
export class tools extends plugin {
/**
@ -1409,22 +1411,32 @@ async neteaseStatus(e, reck) {
"User-Agent": COMMON_USER_AGENT,
"Cookie": reck ? reck : this.neteaseCookie
},
}).then(res => {
}).then(async res => {
// logger.info('vip信息', res.data)
const vipInfo = res.data.data
const checkVipStatus = (vipLevel, expireTime, nickname, avatarUrl, e) => {
const checkVipStatus = async (vipLevel, expireTime, nickname, avatarUrl, e) => {
const expireDate = new Date(expireTime);
if (expireDate > Date.now()) {
e.reply([segment.image(`${avatarUrl}?param=170y170`), `网易云已登录:\n${nickname}\n会员等级:\n${vipLevel}\n会员到期时间:\n${expireDate.toLocaleString()}`]);
const vipLevelData = vipLevel.split("\n");
const neteaseData = await new NeteaseModel(e).getData({
avatarUrl: `${avatarUrl}?param=170y170`,
nickname,
vipLevel: vipLevelData[0],
musicQuality: vipLevelData[2],
expireDate: expireDate.toLocaleString()
});
// e.reply([segment.image(`${avatarUrl}?param=170y170`), `网易云已登录:\n${nickname}\n会员等级:\n${vipLevel}\n会员到期时间:\n${expireDate.toLocaleString()}`]);
let img = await puppeteer.screenshot("netease", neteaseData);
e.reply(img, true);
} else {
return false; // 返回 false 以继续检查下一个 VIP 状态
}
return true;
};
if (vipInfo.redplus.vipCode != 0 && checkVipStatus(`SVIP${vipInfo.redplus.vipLevel}\n最高解析音质:\n jymaster(超清母带)`, vipInfo.redplus.expireTime, userInfo.nickname, userInfo.avatarUrl, e)) {
if (vipInfo.redplus.vipCode != 0 && await checkVipStatus(`SVIP${vipInfo.redplus.vipLevel}\n最高解析音质:\n jymaster(超清母带)`, vipInfo.redplus.expireTime, userInfo.nickname, userInfo.avatarUrl, e)) {
// SVIP 有效,不执行后续逻辑
} else if (vipInfo.associator.vipCode != 0 && checkVipStatus(`VIP${vipInfo.associator.vipLevel}\n最高解析音质:\n jyeffect(高清环绕音)`, vipInfo.associator.expireTime, userInfo.nickname, userInfo.avatarUrl, e)) {
} else if (vipInfo.associator.vipCode != 0 && await checkVipStatus(`VIP${vipInfo.associator.vipLevel}\n最高解析音质:\n jyeffect(高清环绕音)`, vipInfo.associator.expireTime, userInfo.nickname, userInfo.avatarUrl, e)) {
// VIP 有效,不执行后续逻辑
} else {
// 如果都已过期,发送 VIP 已过期信息

17
model/netease.js Normal file
View File

@ -0,0 +1,17 @@
import Base from './base.js'
export default class NeteaseModel extends Base {
constructor (e) {
super(e)
this.model = 'netease'
}
/** 生成版本信息图片 */
async getData (neteaseData) {
return {
...this.screenData,
saveId: 'netease',
neteaseData: neteaseData,
}
}
}

View File

View File

@ -0,0 +1,139 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>网易云音乐用户信息</title>
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
.user-card {
background: linear-gradient(135deg, #C20C0C, #E74C3C);
color: white;
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20px;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
.user-content {
background-color: rgba(255, 255, 255, 0.1);
border-radius: 15px;
padding: 30px;
max-width: 400px;
width: 100%;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.user-header {
display: flex;
align-items: center;
margin-bottom: 30px;
}
.user-avatar {
width: 80px;
height: 80px;
border-radius: 50%;
border: 3px solid white;
margin-right: 20px;
}
.user-name {
font-size: 1.5em;
font-weight: bold;
display: flex;
align-items: center;
}
.user-name::after {
content: '♪';
margin-left: 10px;
font-size: 1.2em;
}
.user-info {
background-color: rgba(255, 255, 255, 0.1);
border-radius: 10px;
padding: 20px;
}
.info-item {
margin-bottom: 15px;
}
.info-label {
font-size: 1em;
opacity: 0.8;
margin-bottom: 5px;
}
.info-value {
font-size: 1.1em;
font-weight: bold;
}
.music-note {
position: absolute;
font-size: 40px;
opacity: 0.2;
animation: float 6s infinite ease-in-out;
}
.note-1 { top: 10%; left: 10%; animation-delay: 0s; }
.note-2 { top: 20%; right: 10%; animation-delay: 1.5s; }
.note-3 { bottom: 15%; left: 20%; animation-delay: 3s; }
.note-4 { bottom: 25%; right: 15%; animation-delay: 4.5s; }
@keyframes float {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(10deg); }
}
@media (max-width: 480px) {
.user-content {
padding: 20px;
}
.user-avatar {
width: 60px;
height: 60px;
}
.user-name {
font-size: 1.2em;
}
.info-label {
font-size: 0.9em;
}
.info-value {
font-size: 1em;
}
}
</style>
</head>
<body>
<div class="user-card">
<div class="music-note note-1"></div>
<div class="music-note note-2"></div>
<div class="music-note note-3"></div>
<div class="music-note note-4"></div>
<div class="user-content">
<div class="user-header">
<img src="{{ neteaseData.avatarUrl }}" alt="用户头像" class="user-avatar">
<div class="user-name">{{ neteaseData.nickname }}</div>
</div>
<div class="user-info">
<div class="info-item">
<div class="info-label">会员等级:</div>
<div class="info-value">{{ neteaseData.vipLevel }}</div>
</div>
<div class="info-item">
<div class="info-label">最高解析音质:</div>
<div class="info-value">{{ neteaseData.musicQuality }}</div>
</div>
<div class="info-item">
<div class="info-label">会员到期时间:</div>
<div class="info-value">{{ neteaseData.expireDate }}</div>
</div>
</div>
</div>
</div>
</body>
</html>