mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-05 17:42:49 +08:00
清理技术债务;发布新版本
This commit is contained in:
@@ -1,96 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace base\admin\controller;
|
|
||||||
|
|
||||||
use app\admin\model\SystemAdmin;
|
|
||||||
use app\common\controller\AdminController;
|
|
||||||
use think\captcha\facade\Captcha;
|
|
||||||
use think\facade\Env;
|
|
||||||
use think\facade\Event;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Login.
|
|
||||||
*/
|
|
||||||
class LoginBase extends AdminController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 初始化方法.
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
parent::initialize();
|
|
||||||
$action = $this->request->action();
|
|
||||||
if (!empty(session('admin')) && !in_array($action, ['out'])) {
|
|
||||||
$adminModuleName = config('app.admin_alias_name');
|
|
||||||
$this->success('已登录,无需再次登录', [], __url("@{$adminModuleName}"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户登录.
|
|
||||||
* @return string
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
event_response('AdminLoginIndex', [
|
|
||||||
'controller' => $this,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$captcha = Env::get('adminsystem.captcha', 1);
|
|
||||||
if ($this->request->isPost()) {
|
|
||||||
$post = $this->request->post();
|
|
||||||
$rule = [
|
|
||||||
'username|用户名' => 'require',
|
|
||||||
'password|密码' => 'require',
|
|
||||||
'keep_login|是否保持登录' => 'require',
|
|
||||||
];
|
|
||||||
$captcha == 1 && $rule['captcha|验证码'] = 'require|captcha';
|
|
||||||
$this->validate($post, $rule);
|
|
||||||
$admin = SystemAdmin::where(['username' => $post['username']])->find();
|
|
||||||
if (empty($admin)) {
|
|
||||||
$this->error('用户不存在');
|
|
||||||
}
|
|
||||||
if (password($post['password']) != $admin->password) {
|
|
||||||
$this->error('密码输入有误');
|
|
||||||
}
|
|
||||||
if ($admin->status == 0) {
|
|
||||||
$this->error('账号已被禁用');
|
|
||||||
}
|
|
||||||
$admin->login_num += 1;
|
|
||||||
$admin->save();
|
|
||||||
|
|
||||||
Event::trigger('AdminLoginSuccess', $admin);
|
|
||||||
|
|
||||||
$admin = $admin->toArray();
|
|
||||||
unset($admin['password']);
|
|
||||||
$admin['expire_time'] = $post['keep_login'] == 1 ? true : time() + 7200;
|
|
||||||
session('admin', $admin);
|
|
||||||
|
|
||||||
$this->success('登录成功');
|
|
||||||
}
|
|
||||||
$this->assign('captcha', $captcha);
|
|
||||||
$this->assign('demo', $this->isDemo);
|
|
||||||
|
|
||||||
return $this->fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户退出.
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function out()
|
|
||||||
{
|
|
||||||
session('admin', null);
|
|
||||||
$this->success('退出登录成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证码
|
|
||||||
* @return \think\Response
|
|
||||||
*/
|
|
||||||
public function captcha()
|
|
||||||
{
|
|
||||||
return Captcha::create();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,12 +12,12 @@ use think\console\Output;
|
|||||||
|
|
||||||
class VersionBase extends Command
|
class VersionBase extends Command
|
||||||
{
|
{
|
||||||
public const VERSION = 'v2.0.54';
|
public const VERSION = 'v2.0.55';
|
||||||
|
|
||||||
public const LAYUI_VERSION = '2.8.17';
|
public const LAYUI_VERSION = '2.8.17';
|
||||||
|
|
||||||
public const COMMENT = [
|
public const COMMENT = [
|
||||||
'增加登录跳转到指定页面',
|
'清理技术债务',
|
||||||
'发布新版本',
|
'发布新版本',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user