原动作:DeepSeek 余额查询
原作者:Anlv
AI生成不一定完美,有朋友手动调整过的可把修改更完美的版本发出来给大伙用用

<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><style>html,body{ margin:0; width:100%; height:100%; overflow:hidden; background:transparent; font-family:"Microsoft YaHei",sans-serif;}*{box-sizing:border-box}
.card{ width:100%; height:100%; padding:16px; border-radius:18px; background:linear-gradient(145deg,#101827,#16263d 55%,#0b1423); border:1px solid rgba(120,180,255,.3); box-shadow: inset 0 1px 15px rgba(255,255,255,.07), 0 8px 30px rgba(0,0,0,.25); color:#eaf3ff; display:flex; flex-direction:column;}
.top{ height:38px; display:flex; align-items:center; justify-content:space-between;}
.brand{ display:flex; align-items:center; gap:9px;}
.logo{ width:28px; height:28px; border-radius:8px; overflow:hidden; background:rgba(255,255,255,.08); display:flex; align-items:center; justify-content:center;}
.logo img{ width:22px; height:22px;}
.title{ font-size:16px; font-weight:700;}
.subtitle{ font-size:11px; color:#91a7c2;}
.actions{ display:flex; gap:8px;}
.icon{ width:30px; height:30px; border-radius:9px; border:1px solid rgba(130,180,255,.25); background:rgba(255,255,255,.06); color:#dbeaff; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:16px; transition:.2s;}
.icon:hover{ background:rgba(100,170,255,.22);}
.icon:active{ transform:scale(.9);}
.settings{ display:none; margin-top:10px; padding:10px; border-radius:12px; background:rgba(255,255,255,.05); border:1px solid rgba(120,170,230,.18); gap:10px; align-items:flex-end;}
.settings.show{ display:flex;}
.field{ flex:1; display:flex; flex-direction:column; gap:4px;}
.field span{ font-size:11px; color:#91a7c2;}
.input{ height:30px; background:#091221; border:1px solid rgba(130,180,255,.25); border-radius:8px; color:white; padding:0 9px; outline:none; font-size:12px;}
.input:focus{ border-color:#5aa5ff;}
.save{ height:30px; padding:0 14px; border-radius:8px; border:0; cursor:pointer; background:#347cff; color:white;}
.save:hover{ filter:brightness(1.12);}
.content{ margin-top:14px; flex:1; display:grid; grid-template-columns:1fr 1fr; gap:10px;}
.item{ background:rgba(255,255,255,.045); border:1px solid rgba(130,180,255,.12); border-radius:12px; padding:12px; display:flex; flex-direction:column; justify-content:center;}
.label{ color:#91a7c2; font-size:12px;}
.value{ margin-top:5px; font-size:22px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.footer{ margin-top:8px; height:16px; font-size:11px; color:#8096b2;}</style></head>
<body>
<div class="card">
<div class="top">
<div class="brand">
<div class="logo"> <img src="https://www.deepseek.com/favicon.ico"> </div>
<div> <div class="title">余额查询</div> <div class="subtitle">DeepSeek API</div> </div>
</div>
<div class="actions"> <button class="icon" id="refresh">↻</button> <button class="icon" id="setting">⚙</button> </div>
</div>
<div class="settings" id="settings">
<div class="field"> <span>DeepSeek API Key</span> <input class="input" id="apikey" type="password" placeholder="请输入 API Key"> </div>
<div class="field" style="max-width:90px"> <span>刷新时间(分钟)</span> <input class="input" id="interval" type="number" min="1" placeholder="5"> </div>
<button class="save" id="save">保存</button>
</div>
<div class="content">
<div class="item"> <div class="label">币种</div> <div class="value" id="currency">--</div> </div>
<div class="item"> <div class="label">总余额</div> <div class="value" id="total">--</div> </div>
<div class="item"> <div class="label">未过期赠金</div> <div class="value" id="grant">--</div> </div>
<div class="item"> <div class="label">充值余额</div> <div class="value" id="topup">--</div> </div>
</div>
<div class="footer" id="status"> 自动刷新:5分钟 </div>
</div>
<script>
(function(){
let apiKey="";let interval=5;let timer=null;
function invoke(method,args){ if(window.fudao && window.fudao.invoke){ return window.fudao.invoke(method,args||{}); } return Promise.reject("fudao unavailable");}
function init(){
if(window.fudao && window.fudao.invoke){
Promise.all([
invoke("state.read",{ key:"deepseek_api_key", defaultValue:"" }),
invoke("state.read",{ key:"refresh_interval", defaultValue:"5" })
]).then(function(res){
if(res[0] && typeof res[0].value==="string"){ apiKey=res[0].value; apikey.value=apiKey; }
if(res[1] && res[1].value){ interval=parseInt(res[1].value)||5; document.getElementById("interval").value=interval; }
startTimer(); query();
});
}else{ setTimeout(init,500); }
}
function save(){
apiKey=document.getElementById("apikey").value.trim();
interval=parseInt( document.getElementById("interval").value )||5;
Promise.all([
invoke("state.write",{ key:"deepseek_api_key", value:apiKey }),
invoke("state.write",{ key:"refresh_interval", value:String(interval) })
]).then(function(){
document.getElementById("settings") .classList.remove("show");
document.getElementById("status").innerText= "自动刷新:"+interval+"分钟";
startTimer();
query();
});
}
function startTimer(){
if(timer){ clearInterval(timer); }
timer=setInterval(query,interval*60*1000);
}
function query(){
if(!apiKey){
document.getElementById("status").innerText= "请设置 API Key";
return; }
document.getElementById("status").innerText="正在刷新";
invoke("http.get",{
url:"https://api.deepseek.com/user/balance",
headers:{ "Authorization":"Bearer "+apiKey, "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/112 Safari/537.36" },
timeoutMs:10000
}).then(function(res){
if(!res.ok){
document.getElementById("status").innerText= "查询失败:"+res.status;
return;
}
try{
let data=JSON.parse(res.text); let info=data.balance_infos[0];
currency.innerText=info.currency||"--"; total.innerText=info.total_balance||"0"; grant.innerText=info.granted_balance||"0"; topup.innerText=info.topped_up_balance||"0";
document.getElementById("status").innerText= "更新完成 · 自动刷新:"+interval+"分钟";
}catch(e){
document.getElementById("status").innerText= "解析失败";
}
}).catch(function(){
document.getElementById("status").innerText= "请求失败";
});
}
document.getElementById("setting").onclick=function(){
document.getElementById("settings") .classList.toggle("show");
};
document.getElementById("save").onclick=save;
document.getElementById("refresh").onclick=query;
init();
})();
</script>
</body></html>