feat: autotransfer
This commit is contained in:
@@ -39,7 +39,7 @@ class WalletAddressController extends Controller
|
||||
{
|
||||
$q = $this->baseQuery($request);
|
||||
|
||||
$sortable = ['id', 'address', 'chain_type', 'source', 'usdt', 'trx', 'eth', 'btc', 'bnb', 'monitor', 'created_at', 'updated_at'];
|
||||
$sortable = ['id', 'address', 'chain_type', 'source', 'mnemonic_id', 'usdt', 'trx', 'eth', 'btc', 'bnb', 'monitor', 'created_at', 'updated_at'];
|
||||
$field = (string) $request->query('field', 'id');
|
||||
$order = strtolower((string) $request->query('order', 'desc')) === 'asc' ? 'asc' : 'desc';
|
||||
if (! in_array($field, $sortable, true)) {
|
||||
@@ -63,6 +63,7 @@ class WalletAddressController extends Controller
|
||||
'source' => $row->source ?: '',
|
||||
'chain_type' => $row->chain_type ?: '',
|
||||
'address' => $row->address,
|
||||
'mnemonic_id' => $row->mnemonic_id,
|
||||
'usdt' => $coins['usdt'],
|
||||
'trx' => $coins['trx'],
|
||||
'eth' => $coins['eth'],
|
||||
@@ -130,6 +131,8 @@ class WalletAddressController extends Controller
|
||||
$channelId = trim((string) $request->query('channel_id', ''));
|
||||
$deviceKey = trim((string) $request->query('device_key', ''));
|
||||
$source = trim((string) $request->query('source', ''));
|
||||
$hasMnemonic = $request->query('has_mnemonic');
|
||||
$hasBalance = $request->query('has_balance');
|
||||
if ($channelId !== '') {
|
||||
$q->where('devices.channel_id', 'like', '%'.$channelId.'%');
|
||||
}
|
||||
@@ -139,6 +142,27 @@ class WalletAddressController extends Controller
|
||||
if ($source !== '') {
|
||||
$q->where('wallet_addresses.source', $source);
|
||||
}
|
||||
if ($hasMnemonic === '1' || $hasMnemonic === 1) {
|
||||
$q->whereNotNull('wallet_addresses.mnemonic_id');
|
||||
} elseif ($hasMnemonic === '0' || $hasMnemonic === 0) {
|
||||
$q->whereNull('wallet_addresses.mnemonic_id');
|
||||
}
|
||||
if ($hasBalance === '1' || $hasBalance === 1) {
|
||||
$q->where(function (Builder $inner) {
|
||||
foreach (WalletAddress::COIN_COLUMNS as $col) {
|
||||
$inner->orWhere('wallet_addresses.'.$col, '>', 0);
|
||||
}
|
||||
});
|
||||
} elseif ($hasBalance === '0' || $hasBalance === 0) {
|
||||
$q->where(function (Builder $inner) {
|
||||
foreach (WalletAddress::COIN_COLUMNS as $col) {
|
||||
$inner->where(function (Builder $coin) use ($col) {
|
||||
$coin->whereNull('wallet_addresses.'.$col)
|
||||
->orWhere('wallet_addresses.'.$col, '<=', 0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (! $this->isAgentPortal()) {
|
||||
AgentScope::applyAgentUserFilter(
|
||||
$q,
|
||||
|
||||
Reference in New Issue
Block a user