feat(revenue): immediate commission credit with independent withdrawable pool

Aligns affiliate commission with the reference theme: commission is credited
to a dedicated COMMISSION asset pool the moment an order is paid, removing the
7-day settlement freeze, the settlement cron, and the settlement_days setting.

- Ledger: add AssetType::COMMISSION (isolated from the recharge balance wallet)
- CommissionLedger: credit-on-record + opportunistic debt repayment; refunds
  claw back the full commission from the pool, carrying any shortfall as debt
  (aksrt_commission_debt) that future commission pays down first
- Withdrawal: make asset-aware via a source discriminator (commission vs
  balance); each pool keeps independent daily limits, pending gate, and
  reject-refund. Balance withdrawal (recharge + creator income) is unchanged
- Fix pay_rebate_self_s: honor self-commission at purchase time
- Revenue card: show pool balance + 累计/已提现 (drop 待结算), debt when present
- Schema 2.0.0 -> 2.1.0: add commission_debt, drop freeze columns
This commit is contained in:
kate522 committed 2026-09-28 21:27:44 +08:00
1 parent cded20ae02
commit 61667aa03c
22 files changed
+569 -268

No files matched your search

+27
View File
@@ -158,6 +158,26 @@
return true;
}
/* 推广收益三个 Tab 的内容在首屏已由 PHP 全部直出,切换只需本地切换
* 显隐,无需任何网络往返,消除切换阻塞。分页仍走 loadRevenueTab。 */
function toggleRevenueTab(tabName) {
var target = document.getElementById('panel-revenue');
if (!target) return false;
var pane = target.querySelector('[data-reward-pane="' + tabName + '"]');
if (!pane) return false;
target.querySelectorAll('[data-reward-pane]').forEach(function(node) {
var active = node === pane;
node.hidden = !active;
});
target.querySelectorAll('.uc-reward-tabs a[data-reward-tab]').forEach(function(link) {
var active = link.getAttribute('data-reward-tab') === tabName;
link.classList.toggle('is-active', active);
if (active) link.setAttribute('aria-current', 'page');
else link.removeAttribute('aria-current');
});
return true;
}
function loadRevenueTab(queryParams) {
var target = document.getElementById('panel-revenue');
var restUrl = (window.aksrtData && (window.aksrtData.restUrl || window.aksrtData.apiUrl)) || cfg.restUrl || '';
@@ -260,6 +280,13 @@
if (link.closest('.uc-reward-tabs, .uc-reward-pagination')) {
e.preventDefault();
e.stopPropagation();
var rewardTab = link.getAttribute('data-reward-tab');
/* Tab 切换:内容已全部直出,纯本地切换显隐,零网络往返。 */
if (rewardTab && toggleRevenueTab(rewardTab)) {
if (window.history.replaceState) window.history.replaceState({}, '', '/user/revenue/');
return;
}
/* 分页:需要新一页数据,仍走 REST 片段加载。 */
loadRevenueTab(url.searchParams).then(function() {
if (window.history.replaceState) window.history.replaceState({}, '', '/user/revenue/');
if (typeof window.AKSRTAffiliateRevenueInit === 'function') window.AKSRTAffiliateRevenueInit();