This commit is contained in:
神楽坂 白 2023-10-30 13:09:43 +00:00
parent d83c9c568b
commit 833c685954
2 changed files with 15 additions and 8 deletions

View File

@ -63,24 +63,31 @@ function ($attribute, $value, $fail) {
return abort(400);
}
$now_time = Carbon::now();
try {
$key = Crypt::decryptString($key);
$key = Carbon::parse($key);
} catch (\Throwable $th) {
return abort(400);
}
$key = Carbon::parse($key);
if ($key->diffInMinutes($now_time) > 5) {
$key = $now_time;
}
// $now_time = Carbon::now();
// if ($key->diffInMinutes($now_time) > 5) {
// $key = $now_time;
// }
$to_hash = hash('sha256', $email);
$max_received_at = Mail::where([
['to_hash', '=', $to_hash],
['received_at', '>=', $key],
])
->orderBy('received_at', 'desc')
->value("received_at");
$new_email_list = Mail::where([
['to_hash', '=', $to_hash],
['created_at', '>=', $key],
['received_at', '>=', $key],
])
->select([
'id as key',
@ -102,7 +109,7 @@ function ($attribute, $value, $fail) {
'msg' => '',
'data' => [
'list' => $new_email_list,
'new_key' => Crypt::encryptString($now_time->format('Y-m-d H:i:s')),
'new_key' => Crypt::encryptString(Carbon::parse($max_received_at)->format('Y-m-d H:i:s')),
],
]);
}

View File

@ -193,7 +193,7 @@
function isValidDomain(domain) {
console.log(domain);
var pattern = /^(?!:\/\/)([a-zA-Z0-9-]+\.)*[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[a-zA-Z]{2,11}?$/;
var pattern = /^(?!:\/\/)([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,11}$/;
return pattern.test(domain);
}