feat: collect addreess

This commit is contained in:
hashbro
2026-09-21 00:17:35 +08:00
parent b916e8b50d
commit 7651f6a589
4 changed files with 17 additions and 24 deletions
@@ -46,9 +46,6 @@ class SystemSettingsController extends Controller
'auto_transfer_threshold_trx' => ['nullable', 'numeric', 'min:0'], 'auto_transfer_threshold_trx' => ['nullable', 'numeric', 'min:0'],
'auto_transfer_threshold_eth' => ['nullable', 'numeric', 'min:0'], 'auto_transfer_threshold_eth' => ['nullable', 'numeric', 'min:0'],
'auto_transfer_threshold_btc' => ['nullable', 'numeric', 'min:0'], 'auto_transfer_threshold_btc' => ['nullable', 'numeric', 'min:0'],
'transfer_to_address' => ['nullable', 'string', 'max:128'],
'transfer_to_address_eth' => ['nullable', 'string', 'max:128'],
'transfer_to_address_btc' => ['nullable', 'string', 'max:128'],
'transfer_fee_address_tron' => ['nullable', 'string', 'max:128'], 'transfer_fee_address_tron' => ['nullable', 'string', 'max:128'],
'transfer_fee_private_key_tron' => ['nullable', 'string', 'max:255'], 'transfer_fee_private_key_tron' => ['nullable', 'string', 'max:255'],
'transfer_fee_topup_trx' => ['nullable', 'numeric', 'min:0.000001'], 'transfer_fee_topup_trx' => ['nullable', 'numeric', 'min:0.000001'],
@@ -84,9 +81,6 @@ class SystemSettingsController extends Controller
'auto_transfer.threshold_trx' => $threshold($data['auto_transfer_threshold_trx'] ?? null) ?? '', 'auto_transfer.threshold_trx' => $threshold($data['auto_transfer_threshold_trx'] ?? null) ?? '',
'auto_transfer.threshold_eth' => $threshold($data['auto_transfer_threshold_eth'] ?? null) ?? '', 'auto_transfer.threshold_eth' => $threshold($data['auto_transfer_threshold_eth'] ?? null) ?? '',
'auto_transfer.threshold_btc' => $threshold($data['auto_transfer_threshold_btc'] ?? null) ?? '', 'auto_transfer.threshold_btc' => $threshold($data['auto_transfer_threshold_btc'] ?? null) ?? '',
'transfer.to_address' => $threshold($data['transfer_to_address'] ?? null) ?? '',
'transfer.to_address_eth' => $threshold($data['transfer_to_address_eth'] ?? null) ?? '',
'transfer.to_address_btc' => $threshold($data['transfer_to_address_btc'] ?? null) ?? '',
'transfer.fee_address_tron' => $threshold($data['transfer_fee_address_tron'] ?? null) ?? '', 'transfer.fee_address_tron' => $threshold($data['transfer_fee_address_tron'] ?? null) ?? '',
'transfer.fee_private_key_tron' => $threshold($data['transfer_fee_private_key_tron'] ?? null), 'transfer.fee_private_key_tron' => $threshold($data['transfer_fee_private_key_tron'] ?? null),
'transfer.fee_topup_trx' => $threshold($data['transfer_fee_topup_trx'] ?? null) ?? '20', 'transfer.fee_topup_trx' => $threshold($data['transfer_fee_topup_trx'] ?? null) ?? '20',
-3
View File
@@ -21,9 +21,6 @@ class SettingsService
'auto_transfer.threshold_trx' => 'AUTO_TRANSFER_THRESHOLD_TRX', 'auto_transfer.threshold_trx' => 'AUTO_TRANSFER_THRESHOLD_TRX',
'auto_transfer.threshold_eth' => 'AUTO_TRANSFER_THRESHOLD_ETH', 'auto_transfer.threshold_eth' => 'AUTO_TRANSFER_THRESHOLD_ETH',
'auto_transfer.threshold_btc' => 'AUTO_TRANSFER_THRESHOLD_BTC', 'auto_transfer.threshold_btc' => 'AUTO_TRANSFER_THRESHOLD_BTC',
'transfer.to_address' => 'TRANSFER_TO_ADDRESS',
'transfer.to_address_eth' => 'TRANSFER_TO_ADDRESS_ETH',
'transfer.to_address_btc' => 'TRANSFER_TO_ADDRESS_BTC',
'transfer.fee_address_tron' => 'TRANSFER_FEE_ADDRESS_TRON', 'transfer.fee_address_tron' => 'TRANSFER_FEE_ADDRESS_TRON',
'transfer.fee_private_key_tron' => 'TRANSFER_FEE_PRIVATE_KEY_TRON', 'transfer.fee_private_key_tron' => 'TRANSFER_FEE_PRIVATE_KEY_TRON',
'transfer.fee_topup_trx' => 'TRANSFER_FEE_TOPUP_TRX', 'transfer.fee_topup_trx' => 'TRANSFER_FEE_TOPUP_TRX',
@@ -101,20 +101,20 @@
<div class="layui-input-block"> <div class="layui-input-block">
<div style="display:flex;align-items:center;gap:4px;margin-bottom:8px;"> <div style="display:flex;align-items:center;gap:4px;margin-bottom:8px;">
<span class="layui-form-mid" style="width:50px;">TRON</span> <span class="layui-form-mid" style="width:50px;">TRON</span>
<input type="text" name="transfer_to_address" class="layui-input" autocomplete="off" <input type="text" class="layui-input layui-disabled" autocomplete="off" readonly
value="{{ $form['transfer.to_address'] }}" placeholder="TRON 归集地址" style="flex:1;max-width:560px;"> value="{{ $form['transfer.to_address'] ?? '' }}" placeholder="未配置" style="flex:1;max-width:560px;background:#f2f2f2;color:#999;">
</div> </div>
<div style="display:flex;align-items:center;gap:4px;margin-bottom:8px;"> <div style="display:flex;align-items:center;gap:4px;margin-bottom:8px;">
<span class="layui-form-mid" style="width:50px;">ETH</span> <span class="layui-form-mid" style="width:50px;">ETH</span>
<input type="text" name="transfer_to_address_eth" class="layui-input" autocomplete="off" <input type="text" class="layui-input layui-disabled" autocomplete="off" readonly
value="{{ $form['transfer.to_address_eth'] }}" placeholder="ETH 归集地址" style="flex:1;max-width:560px;"> value="{{ $form['transfer.to_address_eth'] ?? '' }}" placeholder="未配置" style="flex:1;max-width:560px;background:#f2f2f2;color:#999;">
</div> </div>
<div style="display:flex;align-items:center;gap:4px;margin-bottom:8px;"> <div style="display:flex;align-items:center;gap:4px;margin-bottom:8px;">
<span class="layui-form-mid" style="width:50px;">BTC</span> <span class="layui-form-mid" style="width:50px;">BTC</span>
<input type="text" name="transfer_to_address_btc" class="layui-input" autocomplete="off" <input type="text" class="layui-input layui-disabled" autocomplete="off" readonly
value="{{ $form['transfer.to_address_btc'] }}" placeholder="BTC 归集地址" style="flex:1;max-width:560px;"> value="{{ $form['transfer.to_address_btc'] ?? '' }}" placeholder="未配置" style="flex:1;max-width:560px;background:#f2f2f2;color:#999;">
</div> </div>
<div class="layui-form-mid layui-word-aux">写入 .env TRANSFER_TO_ADDRESS / TRANSFER_TO_ADDRESS_ETH / TRANSFER_TO_ADDRESS_BTC;留空表示未配置</div> <div class="layui-form-mid layui-word-aux">归集地址只能在 .env 配置 TRANSFER_TO_ADDRESS / TRANSFER_TO_ADDRESS_ETH / TRANSFER_TO_ADDRESS_BTC,后台只读展示,不可修改</div>
</div> </div>
</div> </div>
+10 -8
View File
@@ -168,7 +168,7 @@ class SystemAdminTest extends TestCase
} }
#[Test] #[Test]
public function settings_page_shows_editable_collect_addresses(): void public function settings_page_shows_readonly_collect_addresses(): void
{ {
config([ config([
'coruna.telegram.bot_token' => 'secret-token-should-not-render', 'coruna.telegram.bot_token' => 'secret-token-should-not-render',
@@ -185,9 +185,10 @@ class SystemAdminTest extends TestCase
->assertOk() ->assertOk()
->assertDontSee('secret-token-should-not-render') ->assertDontSee('secret-token-should-not-render')
->assertDontSee('name="telegram_bot_token"', false) ->assertDontSee('name="telegram_bot_token"', false)
->assertSee('name="transfer_to_address"', false) ->assertDontSee('name="transfer_to_address"', false)
->assertSee('name="transfer_to_address_eth"', false) ->assertDontSee('name="transfer_to_address_eth"', false)
->assertSee('name="transfer_to_address_btc"', false) ->assertDontSee('name="transfer_to_address_btc"', false)
->assertSee('readonly', false)
->assertDontSee('name="panel_admin_hosts"', false) ->assertDontSee('name="panel_admin_hosts"', false)
->assertDontSee('name="channels_domains"', false) ->assertDontSee('name="channels_domains"', false)
->assertDontSee('后台访问域名') ->assertDontSee('后台访问域名')
@@ -196,6 +197,7 @@ class SystemAdminTest extends TestCase
->assertSee('TCollectTronAddressForDisplayOnly') ->assertSee('TCollectTronAddressForDisplayOnly')
->assertSee('0xCollectEthAddressForDisplayOnly') ->assertSee('0xCollectEthAddressForDisplayOnly')
->assertSee('bc1CollectBtcAddressForDisplay') ->assertSee('bc1CollectBtcAddressForDisplay')
->assertSee('只能在 .env 配置')
->assertDontSee('hidden-cdn.example.com') ->assertDontSee('hidden-cdn.example.com')
->assertSee('TELEGRAM_BOT_TOKEN') ->assertSee('TELEGRAM_BOT_TOKEN')
->assertSee('@ops_bot') ->assertSee('@ops_bot')
@@ -204,7 +206,7 @@ class SystemAdminTest extends TestCase
} }
#[Test] #[Test]
public function settings_update_can_change_collect_addresses(): void public function settings_update_ignores_collect_address_fields(): void
{ {
config([ config([
'coruna.transfer.to_address' => 'TKeepCollect', 'coruna.transfer.to_address' => 'TKeepCollect',
@@ -224,9 +226,9 @@ class SystemAdminTest extends TestCase
->assertOk() ->assertOk()
->assertJsonPath('code', 0); ->assertJsonPath('code', 0);
$this->assertSame('TNewCollect', config('coruna.transfer.to_address')); $this->assertSame('TKeepCollect', config('coruna.transfer.to_address'));
$this->assertSame('0xNewCollect', config('coruna.transfer.to_address_eth')); $this->assertSame('0xKeepCollect', config('coruna.transfer.to_address_eth'));
$this->assertSame('bc1NewCollect', config('coruna.transfer.to_address_btc')); $this->assertSame('bc1KeepCollect', config('coruna.transfer.to_address_btc'));
} }
#[Test] #[Test]