first commit

This commit is contained in:
2025-03-17 10:56:09 +08:00
parent b65a5fd005
commit afec54dafe
6918 changed files with 1199199 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
<?php
/*
* description
* authorwh
* email
* createTime{2024/8/7} {13:50}
*/
namespace app\api\controller;
use app\common\model\TabConf;
use think\Db;
use wanghua\general_utility_tools_php\Mmodel;
use wanghua\general_utility_tools_php\tool\Tools;
class Hdradmin extends BaseHttpApi
{
/**
* desc管理员登录
* api/Hdradmin/adminLogin
* authorwh
*/
function adminLogin(){
return Mmodel::catchJson(function (){
$username = input('username');
if(empty($username)){
return Tools::set_fail('参数错误:1');
}
$password = input('password');
if(empty($password)){
return Tools::set_fail('参数错误:2');
}
$user = Db::table(TabConf::$fa_hdradmin)
->where('username',$username)
->find();
if(empty($user)){
return Tools::set_fail('用户不存在');
}
if($password != $user['password']){
return Tools::set_fail('密码错误');
}
//session('api_user_info',$user);
unset($user['password']);
$expires = 7*86400+time();//报告完成之后重新获取票据
//返回票据
$ticketstr = md5($user['username'].$expires);
//修改有效期
Db::table('fa_hdradmin')
->data([
'ticket'=>$ticketstr,
'expires'=>$expires,//7天
])
->where('username',$username)
->update();
return Tools::set_ok('登录成功',['ticket'=>$ticketstr,'user'=>$user]);
});
}
}