where('phone', $phone) ->where('type', $type) ->where('code', $code) ->order('created_at', 'desc') ->order('id', 'desc') ->find(); if (!$item) { return false; } if ($item['expired_at'] < date('Y-m-d H:i:s')) { return false; } return $item->save(['status' => self::SMS_STATUS_OK]); } /** * 日志记录 * * @param string $msg * @param Exception|null $e * @param string $level * @param string $channel */ public static function log(string $msg, Exception $e = null, string $level = 'error', string $channel = 'file') { if ($e != null) { $msg = sprintf("[%s]%s:%s %s", $msg, $e->getFile(), $e->getLine(), $e->getMessage()); } else { $msg = sprintf("%s", $msg); } Log::channel($channel)->$level($msg); } }