This commit is contained in:
神楽坂 白 2023-12-04 09:53:04 +08:00
parent 1d24a03dd2
commit e667c674a4

View File

@ -71,13 +71,15 @@ function ($attribute, $value, $fail) {
try {
$key = Crypt::decryptString($key);
$key = json_decode($key, true);
if (time() - $key['time'] < 300 && !empty($key['id'])) {
if (!empty($key['id'])) {
$where[] = ['id', '>', $key['id']];
} elseif (time() - $key['time'] < 300) {
$where[] = ['received_at', '>', Carbon::parse($key['time'])];
} else {
$where[] = ['received_at', '>', Carbon::now()];
$where[] = ['received_at', '>', Carbon::now()->subSeconds(60)];
}
} catch (\Throwable $th) {
return abort(400);
return abort(400, $th->getMessage());
}
$new_email_list = Mail::where($where)
@ -125,11 +127,14 @@ public function put(Request $request)
return abort(401);
}
$to = strtolower($to);
$from = strtolower($from);
$mail = new Mail;
$mail->from = $from;
$mail->from_hash = hash('sha256', $from);
$mail->to = strtolower($to);
$mail->to = $to;
$mail->to_hash = hash('sha256', $to);
$mail->title = $title;