diff --git a/internal/controller/energy_controller.go b/internal/controller/energy_controller.go index 2bbb474..13aaf29 100644 --- a/internal/controller/energy_controller.go +++ b/internal/controller/energy_controller.go @@ -103,6 +103,7 @@ func (ec *EnergyController) GetEnergyInfo(c *gin.Context) { "daily_energize_exp": info.DailyEnergizeExp, "daily_exp_cap": info.DailyExpCap, "daily_exp_cap_reached": info.DailyExpCapReached, + "post_energize_total": info.PostEnergizeTotal, }) } diff --git a/templates/MetaLab-2026/static/js/post-energize.js b/templates/MetaLab-2026/static/js/post-energize.js index 7135d92..2cf37f6 100644 --- a/templates/MetaLab-2026/static/js/post-energize.js +++ b/templates/MetaLab-2026/static/js/post-energize.js @@ -58,23 +58,32 @@ showToast('无法给自己赋能'); return; } + btn.disabled = true; fetch('/api/energy/info?post_id=' + postId) .then(function(r) { return r.json(); }) .then(function(d) { - if (d.success && d.data) { - if (d.data.daily_exp_cap_reached) { - capHint.style.display = 'block'; - } - var total = d.data.post_energize_total || 0; - if (total >= 20) { - disableAll(); - } else if (total >= 10) { - disableHeavy(); - } + btn.disabled = false; + if (!d.success || !d.data) { + showToast('获取状态失败,请稍后重试'); + return; + } + if (d.data.daily_exp_cap_reached) { + capHint.style.display = 'block'; + } + var total = d.data.post_energize_total || 0; + if (total >= 20) { + showToast('对该文章赋能已达上限'); + return; + } + if (total >= 10) { + disableHeavy(); } showOverlay(); }) - .catch(function() { showOverlay(); }); + .catch(function() { + btn.disabled = false; + showToast('获取状态失败,请稍后重试'); + }); }); closeBtn.addEventListener('click', hideOverlay);