diff --git a/assets/css/routes/user-center/credits.css b/assets/css/routes/user-center/credits.css index 56da512f..da9d08c9 100644 --- a/assets/css/routes/user-center/credits.css +++ b/assets/css/routes/user-center/credits.css @@ -526,12 +526,6 @@ body.uc-modal-open { line-height: 1.4; } -.uc-transactions__remark { - font-size: 12px; - color: var(--color-ink-4); - margin-left: 4px; -} - .uc-transactions__time { font-size: 12px; color: var(--color-ink-4); diff --git a/inc/helpers/user-center-renderers/credits-transactions.php b/inc/helpers/user-center-renderers/credits-transactions.php index bd1db204..b5652661 100644 --- a/inc/helpers/user-center-renderers/credits-transactions.php +++ b/inc/helpers/user-center-renderers/credits-transactions.php @@ -21,16 +21,13 @@ defined('ABSPATH') || exit; $credits_page = ($asset_request['asset'] ?? '') === 'points' ? max(1, (int) ($asset_request['page'] ?? 1)) : 1; - $log = \AKSRT\Ledger\LedgerQuery::get_instance()->history(['user_id' => $user_id, 'asset' => 'points', 'page' => $credits_page, 'per_page' => 10]); + $log = \AKSRT\Ledger\LedgerQuery::get_instance()->history(['user_id' => $user_id, 'asset' => 'points', 'page' => $credits_page, 'per_page' => 10]); if (!empty($log['items'])) : ?>
= 0 ? 'is-positive' : 'is-negative'; - $record_note = (string) $row['reason'] === 'points_exchange' - ? (string) $row['ref_key'] - : (string) $row['remark']; ?>
@@ -39,9 +36,6 @@ defined('ABSPATH') || exit;
- - () -
diff --git a/inc/helpers/user-center-renderers/credits-wallet-ledger.php b/inc/helpers/user-center-renderers/credits-wallet-ledger.php index f3e76324..5a7ffb2e 100644 --- a/inc/helpers/user-center-renderers/credits-wallet-ledger.php +++ b/inc/helpers/user-center-renderers/credits-wallet-ledger.php @@ -33,12 +33,6 @@ $wlog = \AKSRT\Ledger\LedgerQuery::get_instance()->history([ $delta = (int) $row['delta_minor']; $delta_class = $delta >= 0 ? 'is-positive' : 'is-negative'; $delta_txt = ($delta > 0 ? '+' : '-') . \AKSRT\Ledger\AssetAmount::from_minor(\AKSRT\Ledger\AssetType::BALANCE, abs($delta))->formatted(); - $record_note = (string) $row['reason'] === 'points_exchange' - ? (string) $row['ref_key'] - : (string) ($row['remark'] ?? ''); - if (in_array((string) $row['reason'], ['withdraw_hold', 'withdraw_refund'], true)) { - $record_note = (string) ($row['withdrawal_number'] ?? ''); - } ?>
@@ -47,9 +41,6 @@ $wlog = \AKSRT\Ledger\LedgerQuery::get_instance()->history([
- - () -
diff --git a/inc/helpers/user-center-renderers/credits-wallet.php b/inc/helpers/user-center-renderers/credits-wallet.php index a026f616..303c2c54 100644 --- a/inc/helpers/user-center-renderers/credits-wallet.php +++ b/inc/helpers/user-center-renderers/credits-wallet.php @@ -243,7 +243,3 @@ endif; ?>
- - - - diff --git a/inc/helpers/user-center-renderers/profile-credits.php b/inc/helpers/user-center-renderers/profile-credits.php index df1b2f18..85d0397e 100644 --- a/inc/helpers/user-center-renderers/profile-credits.php +++ b/inc/helpers/user-center-renderers/profile-credits.php @@ -22,11 +22,7 @@ if ($show_wallet || $show_credits) :
- +
diff --git a/src/Ledger/LedgerQuery.php b/src/Ledger/LedgerQuery.php index 399768a9..b099dac1 100644 --- a/src/Ledger/LedgerQuery.php +++ b/src/Ledger/LedgerQuery.php @@ -42,7 +42,6 @@ final class LedgerQuery { $entry_table = \AKSRT\Core\DBMigrator::table('asset_entry'); $transaction_table = \AKSRT\Core\DBMigrator::table('asset_transaction'); - $flow_table = \AKSRT\Core\DBMigrator::table('financial_flow'); $where = ['1=1']; $params = []; if ($user_id > 0) { @@ -108,10 +107,9 @@ final class LedgerQuery { $entry_params[] = $asset; } $rows = $wpdb->get_results($wpdb->prepare( - "SELECT e.*, t.operation_key, t.reason, t.ref_type, t.ref_key, t.actor_user_id, t.metadata, t.created_at transaction_created_at, f.withdrawal_number + "SELECT e.*, t.operation_key, t.reason, t.ref_type, t.ref_key, t.actor_user_id, t.metadata, t.created_at transaction_created_at FROM {$entry_table} e INNER JOIN {$transaction_table} t ON t.id = e.transaction_id - LEFT JOIN {$flow_table} f ON f.ledger_transaction_id = t.id WHERE " . implode(' AND ', $entry_where) . ' ORDER BY e.transaction_id DESC, e.line_no ASC', $entry_params ), ARRAY_A); @@ -126,7 +124,6 @@ final class LedgerQuery { 'reason' => (string) $row['reason'], 'ref_type' => (string) ($row['ref_type'] ?? ''), 'ref_key' => (string) ($row['ref_key'] ?? ''), - 'withdrawal_number' => (string) ($row['withdrawal_number'] ?? ''), 'actor_user_id' => (int) ($row['actor_user_id'] ?? 0), 'metadata' => json_decode((string) ($row['metadata'] ?? ''), true) ?: [], 'created_at' => (string) $row['transaction_created_at'], diff --git a/tests/widget-system/asset-ledger-contract.test.cjs b/tests/widget-system/asset-ledger-contract.test.cjs index 8b3bb079..a35d0d15 100644 --- a/tests/widget-system/asset-ledger-contract.test.cjs +++ b/tests/widget-system/asset-ledger-contract.test.cjs @@ -78,10 +78,12 @@ test('user asset submissions send idempotency keys', () => { } }) -test('profile asset records show order references and only the changed amount', () => { +test('profile asset records show only the reason label and the changed amount', () => { for (const file of ['credits-transactions.php', 'credits-wallet-ledger.php']) { const source = fs.readFileSync(path.join(root, 'inc', 'helpers', 'user-center-renderers', file), 'utf8') - assert.match(source, /\$record_note\s*=\s*\(string\) \$row\['reason'\] === 'points_exchange'[\s\S]*?\(string\) \$row\['ref_key'\]/) + assert.match(source, /aksrt_asset_reason_label\(\(string\) \$row\['reason'\]\)/) + // 记录名称后不再拼接(引用键 / 备注 / 提现单号)。 + assert.doesNotMatch(source, /\$record_note|uc-transactions__remark|\$row\['ref_key'\]|\$row\['remark'\]|withdrawal_number/) assert.doesNotMatch(source, /uc-transactions__balance|交易 #%d|\$row\['fee_minor'\]|\$row\['ref_id'\]/) } }) diff --git a/tests/widget-system/financial-flow-contract.test.cjs b/tests/widget-system/financial-flow-contract.test.cjs index 571337ed..817464e9 100644 --- a/tests/widget-system/financial-flow-contract.test.cjs +++ b/tests/widget-system/financial-flow-contract.test.cjs @@ -63,19 +63,18 @@ test('native and front-end surfaces expose immutable business numbers', () => { assert.match(read('assets/js/order-center.js'), /\["流水号", order\.order_number\]/) assert.doesNotMatch(read('assets/js/order-center.js'), /flow_number|账本流水号/) assert.doesNotMatch(read('src/Payment/UserOrders.php'), /\$view\['flow_number'\]/) - assert.match(read('inc/helpers/user-center-renderers/credits-wallet-ledger.php'), /withdrawal_number/) }) -test('balance history renders withdrawal numbers from the committed flow', () => { +test('ledger history carries no financial flow coupling', () => { const query = read('src/Ledger/LedgerQuery.php') - const profile = read('inc/helpers/user-center-renderers/credits-wallet-ledger.php') - const wallet = read('inc/helpers/user-center-renderers/credits-wallet.php') + read('inc/helpers/user-center-renderers/credits-wallet-ledger.php') - assert.match(query, /LEFT JOIN \{\$flow_table\} f ON f\.ledger_transaction_id = t\.id/) - assert.match(query, /'withdrawal_number'\s*=>\s*\(string\)/) - for (const source of [profile, wallet]) { - assert.match(source, /\['withdraw_hold', 'withdraw_refund'\]/) - assert.match(source, /\$row\['withdrawal_number'\]/) - } + const records = [ + read('inc/helpers/user-center-renderers/credits-transactions.php'), + read('inc/helpers/user-center-renderers/credits-wallet-ledger.php'), + ].join('\n') + // 前台余额/积分记录只展示中文变动原因与变动额:提现单号既不查询也不下发, + // 账本历史不再为了它 LEFT JOIN financial_flow。 + assert.doesNotMatch(query, /financial_flow|withdrawal_number/) + assert.doesNotMatch(records, /\$row\['ref_key'\]|\$row\['remark'\]|withdrawal_number|uc-transactions__remark/) }) test('user withdrawal history uses one paginated ten-item endpoint', () => {