feat(payment): rebuild order details and asset records

This commit is contained in:
kate522 committed 2026-10-05 16:42:25 +08:00
1 parent 476e2f961d
commit 7b55cfb190
57 files changed
+2080 -1294

No files matched your search

+9 -1
View File
@@ -10,6 +10,7 @@ final class CommissionLedger {
private function __construct() {}
public function init(): void {
add_action('rest_api_init', [$this, 'register_routes']);
add_action('aksrt_order_commission', [$this, 'record_order_transition']);
// 佣金已改为即时入账,历史遗留的结算 cron 需主动清理(无兼容层)。
$timestamp = wp_next_scheduled('aksrt_affiliate_settle_due');
if ($timestamp) {
@@ -45,7 +46,14 @@ final class CommissionLedger {
if ($currency === \AKSRT\Ledger\AssetType::POINTS->value) return 0;
if (!\AKSRT\Settings\Settings::affiliate_enabled()) return 0;
$type = sanitize_key((string) ($order['product_type'] ?? ''));
$map = ['vip' => 'membership', 'resource' => 'content'];
$map = [
'vip' => 'membership',
'resource' => 'content',
'reading' => 'content',
'download' => 'content',
'image' => 'content',
'video' => 'content',
];
$order_type = $map[$type] ?? $type;
$settings = \AKSRT\Settings\Settings::get_affiliate_settings();
$order_no = sanitize_text_field((string) ($order['order_number'] ?? ''));