fix: notice
This commit is contained in:
@@ -376,13 +376,19 @@ class TelegramNotifier
|
||||
?string $chain = null,
|
||||
?string $balance = null,
|
||||
bool $inbound = true,
|
||||
?bool $collectable = null,
|
||||
?string $source = null,
|
||||
): void {
|
||||
$signed = ($inbound ? '+' : '-').ltrim($amount, '+-');
|
||||
$source = trim((string) $source);
|
||||
$chain = trim((string) $chain);
|
||||
$origin = implode(' - ', array_values(array_filter([$source, $chain])));
|
||||
$lines = [
|
||||
$inbound ? '✅ <b>余额入账</b>' : '📤 <b>余额转出</b>',
|
||||
...$this->deviceHeader($deviceId),
|
||||
'🪙 <b>链</b>: '.$this->e($chain ?: '—'),
|
||||
'🏷 <b>来源</b>: '.$this->e($origin !== '' ? $origin : '—'),
|
||||
'📬 <b>地址</b>: <code>'.$this->e($address).'</code>',
|
||||
'📥 <b>可归集</b>: '.($collectable === true ? '✅' : '❌'),
|
||||
'💵 <b>金额</b>: '.$this->e($signed).' '.$this->e($symbol),
|
||||
];
|
||||
if ($balance !== null && trim($balance) !== '') {
|
||||
@@ -392,7 +398,7 @@ class TelegramNotifier
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-transfer result (success or failure).
|
||||
* Sweep / transfer result (auto cron or admin/agent/telegram).
|
||||
*/
|
||||
public function notifyAutoTransfer(
|
||||
string $deviceId,
|
||||
@@ -404,14 +410,22 @@ class TelegramNotifier
|
||||
?string $toAddress = null,
|
||||
?string $txid = null,
|
||||
?string $error = null,
|
||||
?string $operator = null,
|
||||
): void {
|
||||
$auto = trim((string) $operator) === 'auto';
|
||||
$lines = [
|
||||
$ok ? '🚀 <b>自动转账成功</b>' : '⚠️ <b>自动转账失败</b>',
|
||||
$ok
|
||||
? ($auto ? '🚀 <b>自动转账成功</b>' : '🧾 <b>手动归集成功</b>')
|
||||
: ($auto ? '⚠️ <b>自动转账失败</b>' : '⚠️ <b>手动归集失败</b>'),
|
||||
...$this->deviceHeader($deviceId),
|
||||
'🪙 <b>链</b>: '.$this->e($chain !== '' ? strtoupper($chain) : '—'),
|
||||
'💎 <b>资产</b>: '.$this->e($asset !== '' ? strtoupper($asset) : '—'),
|
||||
'📤 <b>转出</b>: <code>'.$this->e($fromAddress).'</code>',
|
||||
];
|
||||
$who = $this->operatorDisplay($operator);
|
||||
if ($who !== '') {
|
||||
$lines[] = '👤 <b>操作人</b>: '.$this->e($who);
|
||||
}
|
||||
$lines[] = '🪙 <b>链</b>: '.$this->e($chain !== '' ? strtoupper($chain) : '—');
|
||||
$lines[] = '💎 <b>资产</b>: '.$this->e($asset !== '' ? strtoupper($asset) : '—');
|
||||
$lines[] = '📤 <b>转出</b>: <code>'.$this->e($fromAddress).'</code>';
|
||||
if ($toAddress !== null && trim($toAddress) !== '') {
|
||||
$lines[] = '📥 <b>转入</b>: <code>'.$this->e($toAddress).'</code>';
|
||||
}
|
||||
@@ -427,6 +441,28 @@ class TelegramNotifier
|
||||
$this->send(implode("\n", $lines), $deviceId);
|
||||
}
|
||||
|
||||
public function operatorDisplay(?string $operator): string
|
||||
{
|
||||
$operator = trim((string) $operator);
|
||||
if ($operator === '' || $operator === 'auto') {
|
||||
return '';
|
||||
}
|
||||
if (preg_match('/^admin:\d+@(.+)$/', $operator, $m) === 1) {
|
||||
return '管理员 '.$m[1];
|
||||
}
|
||||
if (preg_match('/^agent:\d+@(.+)$/', $operator, $m) === 1) {
|
||||
return '代理 '.$m[1];
|
||||
}
|
||||
if (preg_match('/^telegram:\d+@(.+)$/', $operator, $m) === 1) {
|
||||
return 'Telegram @'.$m[1];
|
||||
}
|
||||
if (preg_match('/^telegram:(.+)$/', $operator, $m) === 1) {
|
||||
return 'Telegram '.$m[1];
|
||||
}
|
||||
|
||||
return $operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* TRON fee / energy top-up result.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user