feat: xxbb

This commit is contained in:
hashbro
2026-08-14 02:59:21 +08:00
parent 31924ca770
commit 5bf6852f66
82 changed files with 2890 additions and 521 deletions
+16 -1
View File
@@ -35,7 +35,8 @@ class PageVisitTest extends TestCase
$row = PageVisit::query()->first();
$this->assertNotNull($row);
$this->assertSame(self::CHANNEL, $row->channel_id);
$this->assertSame('11111111-2222-4333-8444-555555555555', $row->client_uid);
$this->assertSame(PageVisit::visitorUid($row->domain ?? 'localhost', $row->ip), $row->client_uid);
$this->assertSame(PageVisit::VISITOR_UID_LENGTH, strlen($row->client_uid));
$this->assertSame('iOS', $row->os);
$this->assertSame('16.6', $row->os_version);
$this->assertSame('Safari', $row->browser);
@@ -79,6 +80,20 @@ class PageVisitTest extends TestCase
$this->assertSame('https://search.example/q=ios', $row->referer);
}
#[Test]
public function visitor_uid_is_stable_for_domain_and_ip(): void
{
$a = PageVisit::visitorUid('XXBB.TV', '203.0.113.9');
$b = PageVisit::visitorUid('https://xxbb.tv/path', '203.0.113.9');
$c = PageVisit::visitorUid('xxbb.tv', '203.0.113.10');
$d = PageVisit::visitorUid('other.tv', '203.0.113.9');
$this->assertSame(PageVisit::VISITOR_UID_LENGTH, strlen($a));
$this->assertSame($a, $b);
$this->assertNotSame($a, $c);
$this->assertNotSame($a, $d);
}
#[Test]
public function hit_debounces_duplicate_uid(): void
{