SchoolPhysicalExamination/application/DeviceEnter/controller/admin/Login.php

42 lines
1.0 KiB
PHP
Raw Normal View History

2025-09-26 16:35:42 +08:00
<?php
namespace app\DeviceEnter\controller\admin;
use think\Controller;
use think\Db;
use think\Cache;
use think\Log;
use PHPMailer\PHPMailer\PHPMailer;
class Login extends Base{
protected $token_time = 30;//30天的秒数
protected $file_size = 5*1024*1024;
public function login(){
// dump(md5('DeviceEnter0932'));
return $this->fetch();
}
// 检测登录信息是否超时
public function login_action(){
$data = input();
// 验证数据项是否完整
if(!array_key_exists('username', $data) || !array_key_exists('password', $data)){
return $this->msg(10001);
}
$data['password_md5'] = md5($data['password']);
$device = Db::connect('device_enter_db');
$account = $device->ttable('admin_account')->where(['user_name'=>$data['username'],'pass_word'=>$data['password_md5']])->find();
if($account>0){
return $this->msg([]);
}else{
return $this->msg(10003);
}
}
}