Compare commits

..

2 Commits

View File

@ -108,7 +108,7 @@ class Helper
} }
} }
public static function getSubscribeUrl(string $token, $subscribeUrl = null) public static function getSubscribeUrl(string $token, $subscribeUrl = null)
{ {
$strs = 'QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm'; $strs = 'QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm';
$randstr = substr(str_shuffle($strs), 0, rand(4,8)); $randstr = substr(str_shuffle($strs), 0, rand(4,8));
@ -120,10 +120,9 @@ class Helper
$subscribeUrl = self::replaceByPattern($subscribeUrl); $subscribeUrl = self::replaceByPattern($subscribeUrl);
if (strpos($subscribeUrl, "*") !== false) { if (strpos($subscribeUrl, "*") !== false) {
$subscribeUrl = str_replace("*", $randstr, $subscribeUrl); $subscribeUrl = str_replace("*", $randstr, $subscribeUrl);
} elseif (strpos($subscribeUrl, '{uuid}') !== false) { } elseif (strpos($subscribeUrl, "[uuid]") !== false) {
$user = User::where('token', $token)->first(); $user = User::where('token', $token)->first();
$subscribeUrl = str_replace('{uuid}', $user->uuid, $subscribeUrl); $subscribeUrl = str_replace("*", $user->uuid, $subscribeUrl);
}
} }
return $subscribeUrl ? rtrim($subscribeUrl, '/') . $path : url($path); return $subscribeUrl ? rtrim($subscribeUrl, '/') . $path : url($path);
} }