Standardize UUID format: generateUUID() now returns unhyphenated 32-char hex
- Remove vsprintf hyphenation from generateUUID() in helpers.php
- Remove redundant str_replace('-', '', ...) wrappers in callers
- Fix grants/create, tabs/open, orders/getOrCreateCart which were storing hyphenated UUIDs
- Cast prices to float in getForBuilder.php
- Uppercase auth response keys (TOKEN, USERID, FIRSTNAME)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bb03cb0533
commit
5761ed3e88
6 changed files with 10 additions and 10 deletions
|
|
@ -29,7 +29,7 @@ if (!$user) {
|
||||||
|
|
||||||
$userUUID = $user['UUID'] ?? '';
|
$userUUID = $user['UUID'] ?? '';
|
||||||
if (empty(trim($userUUID))) {
|
if (empty(trim($userUUID))) {
|
||||||
$userUUID = str_replace('-', '', generateUUID());
|
$userUUID = generateUUID();
|
||||||
queryTimed("UPDATE Users SET UUID = ? WHERE ID = ?", [$userUUID, $user['ID']]);
|
queryTimed("UPDATE Users SET UUID = ? WHERE ID = ?", [$userUUID, $user['ID']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,14 @@ $userUUID = '';
|
||||||
if ($existing) {
|
if ($existing) {
|
||||||
$userUUID = $existing['UUID'] ?? '';
|
$userUUID = $existing['UUID'] ?? '';
|
||||||
if (empty(trim($userUUID))) {
|
if (empty(trim($userUUID))) {
|
||||||
$userUUID = str_replace('-', '', generateUUID());
|
$userUUID = generateUUID();
|
||||||
}
|
}
|
||||||
queryTimed(
|
queryTimed(
|
||||||
"UPDATE Users SET MobileVerifyCode = ?, UUID = ? WHERE ID = ?",
|
"UPDATE Users SET MobileVerifyCode = ?, UUID = ? WHERE ID = ?",
|
||||||
[$otp, $userUUID, $existing['ID']]
|
[$otp, $userUUID, $existing['ID']]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$userUUID = str_replace('-', '', generateUUID());
|
$userUUID = generateUUID();
|
||||||
queryTimed(
|
queryTimed(
|
||||||
"INSERT INTO Users (ContactNumber, UUID, MobileVerifyCode, IsContactVerified, IsEmailVerified, IsActive, AddedOn, Password, PromoCode)
|
"INSERT INTO Users (ContactNumber, UUID, MobileVerifyCode, IsContactVerified, IsEmailVerified, IsActive, AddedOn, Password, PromoCode)
|
||||||
VALUES (?, ?, ?, 0, 0, 0, ?, '', ?)",
|
VALUES (?, ?, ?, 0, 0, 0, ?, '', ?)",
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ queryTimed(
|
||||||
jsonResponse([
|
jsonResponse([
|
||||||
'OK' => true,
|
'OK' => true,
|
||||||
'ERROR' => '',
|
'ERROR' => '',
|
||||||
'UserID' => $uid,
|
'USERID' => $uid,
|
||||||
'FirstName' => $user['FirstName'],
|
'FIRSTNAME' => $user['FirstName'],
|
||||||
'Token' => $token,
|
'TOKEN' => $token,
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ function generateUUID(): string {
|
||||||
$bytes[6] = chr(ord($bytes[6]) & 0x0f | 0x40);
|
$bytes[6] = chr(ord($bytes[6]) & 0x0f | 0x40);
|
||||||
// Set variant bits
|
// Set variant bits
|
||||||
$bytes[8] = chr(ord($bytes[8]) & 0x3f | 0x80);
|
$bytes[8] = chr(ord($bytes[8]) & 0x3f | 0x80);
|
||||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($bytes), 4));
|
return bin2hex($bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate unique folder name
|
// Generate unique folder name
|
||||||
$uniqueId = strtolower(str_replace('-', '', generateUUID()));
|
$uniqueId = generateUUID();
|
||||||
$extractDir = "$tempBaseDir/$uniqueId";
|
$extractDir = "$tempBaseDir/$uniqueId";
|
||||||
|
|
||||||
// Validate it's a ZIP file
|
// Validate it's a ZIP file
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ try {
|
||||||
// Create rating records for service point tasks
|
// Create rating records for service point tasks
|
||||||
if ($hasServicePoint && $customerUserID > 0 && $workerUserID > 0) {
|
if ($hasServicePoint && $customerUserID > 0 && $workerUserID > 0) {
|
||||||
// 1. Customer rates Worker
|
// 1. Customer rates Worker
|
||||||
$customerToken = strtolower(str_replace('-', '', generateUUID()));
|
$customerToken = generateUUID();
|
||||||
queryTimed("
|
queryTimed("
|
||||||
INSERT INTO TaskRatings (
|
INSERT INTO TaskRatings (
|
||||||
TaskID, ByUserID, ForUserID, Direction,
|
TaskID, ByUserID, ForUserID, Direction,
|
||||||
|
|
@ -309,7 +309,7 @@ try {
|
||||||
|
|
||||||
// 2. Worker rates Customer (if provided)
|
// 2. Worker rates Customer (if provided)
|
||||||
if (!empty($workerRating)) {
|
if (!empty($workerRating)) {
|
||||||
$workerToken = strtolower(str_replace('-', '', generateUUID()));
|
$workerToken = generateUUID();
|
||||||
queryTimed("
|
queryTimed("
|
||||||
INSERT INTO TaskRatings (
|
INSERT INTO TaskRatings (
|
||||||
TaskID, ByUserID, ForUserID, Direction,
|
TaskID, ByUserID, ForUserID, Direction,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue