登录控制器
<?php
namespace App\Http\Controllers;
use App\logic\LoginLogic;
use App\Models\Login;
use Illuminate\Http\Request;
class LoginController extends Controller
{
//登录
public function login(Request $request)
{
try {
//接值
$params = $request->post();
//非空验证
if (empty($params['phone'])) throw new \Exception('手机号码 不能为空');
if (empty($params['code'])) throw new \Exception('验证码 不能为空');
//防注入处理
$phone = addslashes(htmlspecialchars($params['phone']));
$code = addslashes(htmlspecialchars($params['code']));
//设置唯一的短信和手机号码名
$sendCode = 'code_' . $code;
$sendPhone = 'phone_' . $phone;
//取出手机号码 没设置则未发送
$getPhone = Cache::get($sendPhone);
if(!isset($getPhone