Fix beacon lookup to match by namespace (first 20 chars) instead of full UUID
This allows beacons to use any Eddystone-UID configuration where: - Namespace (10 bytes) matches first 20 hex chars of shard UUID - Instance bytes encode Major/Minor for business/service point lookup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d5dab8f9c5
commit
0bdf9d60b7
1 changed files with 6 additions and 2 deletions
|
|
@ -39,7 +39,10 @@
|
||||||
<cfcontinue>
|
<cfcontinue>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
<!--- Resolve via sharding: UUID -> Shard -> Business (Major) -> ServicePoint (Minor) --->
|
<!--- Resolve via sharding: Namespace (first 20 chars of UUID) -> Shard -> Business (Major) -> ServicePoint (Minor) --->
|
||||||
|
<!--- Extract namespace (first 20 hex chars) from beacon UUID for matching --->
|
||||||
|
<cfset namespace = lCase(left(reReplace(uuid, "-", "", "all"), 20))>
|
||||||
|
|
||||||
<cfquery name="qShard" datasource="payfrit">
|
<cfquery name="qShard" datasource="payfrit">
|
||||||
SELECT
|
SELECT
|
||||||
biz.ID AS BusinessID,
|
biz.ID AS BusinessID,
|
||||||
|
|
@ -48,12 +51,13 @@
|
||||||
COALESCE(parent.Name, '') AS ParentBusinessName,
|
COALESCE(parent.Name, '') AS ParentBusinessName,
|
||||||
sp.ID AS ServicePointID,
|
sp.ID AS ServicePointID,
|
||||||
sp.Name AS ServicePointName,
|
sp.Name AS ServicePointName,
|
||||||
|
bs.UUID AS ShardUUID,
|
||||||
(SELECT COUNT(*) FROM Businesses WHERE ParentBusinessID = biz.ID) AS ChildCount
|
(SELECT COUNT(*) FROM Businesses WHERE ParentBusinessID = biz.ID) AS ChildCount
|
||||||
FROM BeaconShards bs
|
FROM BeaconShards bs
|
||||||
JOIN Businesses biz ON biz.BeaconShardID = bs.ID AND biz.BeaconMajor = <cfqueryparam cfsqltype="cf_sql_smallint" value="#major#">
|
JOIN Businesses biz ON biz.BeaconShardID = bs.ID AND biz.BeaconMajor = <cfqueryparam cfsqltype="cf_sql_smallint" value="#major#">
|
||||||
LEFT JOIN ServicePoints sp ON sp.BusinessID = biz.ID AND sp.BeaconMinor = <cfqueryparam cfsqltype="cf_sql_smallint" value="#minor#"> AND sp.IsActive = 1
|
LEFT JOIN ServicePoints sp ON sp.BusinessID = biz.ID AND sp.BeaconMinor = <cfqueryparam cfsqltype="cf_sql_smallint" value="#minor#"> AND sp.IsActive = 1
|
||||||
LEFT JOIN Businesses parent ON biz.ParentBusinessID = parent.ID
|
LEFT JOIN Businesses parent ON biz.ParentBusinessID = parent.ID
|
||||||
WHERE bs.UUID = <cfqueryparam cfsqltype="cf_sql_varchar" value="#uuid#">
|
WHERE LEFT(REPLACE(bs.UUID, '-', ''), 20) = <cfqueryparam cfsqltype="cf_sql_varchar" value="#namespace#">
|
||||||
AND bs.IsActive = 1
|
AND bs.IsActive = 1
|
||||||
AND biz.IsDemo = 0
|
AND biz.IsDemo = 0
|
||||||
AND biz.IsPrivate = 0
|
AND biz.IsPrivate = 0
|
||||||
|
|
|
||||||
Reference in a new issue