feat: address

This commit is contained in:
hashbro
2026-09-12 18:14:03 +08:00
parent f15df77828
commit 0996d4e563
14 changed files with 350 additions and 30 deletions
@@ -75,6 +75,8 @@ class WalletAddressController extends Controller
'btc' => $coins['btc'],
'bnb' => $coins['bnb'],
'monitor' => (int) $row->monitor,
'monitor_synced' => (bool) $row->monitor_synced,
'monitor_failures' => (int) $row->monitor_failures,
'created_at' => optional($row->created_at)->format('Y-m-d H:i:s'),
'updated_at' => optional($row->updated_at)->format('Y-m-d H:i:s'),
'detail_url' => route($portal.'.devices.show', $row->device_id),
@@ -100,6 +102,10 @@ class WalletAddressController extends Controller
}
$address->monitor = (int) $data['monitor'];
// When the user toggles the switch, mark as unsynced and reset the
// failure counter so the scheduled task retries from scratch.
$address->monitor_synced = false;
$address->monitor_failures = 0;
$address->save();
try {
@@ -113,7 +119,12 @@ class WalletAddressController extends Controller
return response()->json([
'code' => 0,
'msg' => 'ok',
'data' => ['id' => $address->id, 'monitor' => (int) $address->monitor],
'data' => [
'id' => $address->id,
'monitor' => (int) $address->monitor,
'monitor_synced' => (bool) $address->monitor_synced,
'monitor_failures' => (int) $address->monitor_failures,
],
]);
}