feat: quene

This commit is contained in:
hashbro
2026-09-01 05:09:00 +08:00
parent 337bf45c79
commit e23550e820
28 changed files with 969 additions and 234 deletions
+17 -5
View File
@@ -154,18 +154,20 @@ class DarkSwordIngestAdapter
$ip = $this->clientIp($request, $payload);
$referer = trim((string) $request->headers->get('referer', ''));
$os = $ios !== null ? 'iOS' : $parsed['os'];
$osVersion = $ios ?? ($parsed['os_version'] !== '' ? $parsed['os_version'] : null);
PageVisit::recordLanding([
'channel_id' => $channel,
'client_uid' => $uid,
'user_agent' => $ua !== '' ? $ua : null,
'os' => $ios !== null ? 'iOS' : $parsed['os'],
'os_version' => $ios ?? ($parsed['os_version'] !== '' ? $parsed['os_version'] : null),
'os' => $os,
'os_version' => $osVersion,
'browser' => $parsed['browser'],
'browser_version' => $parsed['browser_version'] !== '' ? $parsed['browser_version'] : null,
'ip' => $ip !== '' ? $ip : null,
'domain' => PageVisit::normalizeDomain($request->getHost()),
'referer' => $referer !== '' ? substr($referer, 0, 512) : null,
], PageVisit::CHAIN_DARKSWORD);
], PageVisit::chainFromIosVersion($os, $osVersion));
}
/**
@@ -273,10 +275,20 @@ class DarkSwordIngestAdapter
$ua = substr((string) $request->userAgent(), 0, 2000);
$existing = Device::query()->where('device_id', $key)->first();
if ($ios !== null) {
$chain = PageVisit::isDarkSwordIosVersionString($ios)
? Device::CHAIN_DARKSWORD
: Device::CHAIN_CORUNA;
} else {
$chain = $existing
? (int) $existing->chain
: Device::CHAIN_CORUNA;
}
if ($existing) {
$touch = [
'updated_at' => now(),
'chain' => Device::CHAIN_DARKSWORD,
'chain' => $chain,
];
if ($ip !== '') {
$touch['ip'] = $ip;
@@ -301,7 +313,7 @@ class DarkSwordIngestAdapter
$device = Device::query()->create([
'device_id' => $key,
'chain' => Device::CHAIN_DARKSWORD,
'chain' => $chain,
'ip' => $ip !== '' ? $ip : null,
'device_model' => $model,
'ios_version' => $ios,