61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
||
namespace app\adminapi\controller;
|
||
|
||
use app\adminapi\logic\LoginLogic;
|
||
use app\adminapi\validate\{LoginValidate,LoginAgentValidate};
|
||
|
||
/**
|
||
* 管理员登录控制器
|
||
* Class LoginController
|
||
* @package app\adminapi\controller
|
||
*/
|
||
class LoginController extends BaseAdminController
|
||
{
|
||
public array $notNeedLogin = ['account','agentAccount'];
|
||
|
||
/**
|
||
* @notes 账号登录
|
||
* @date 2021/6/30 17:01
|
||
* @return \think\response\Json
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author 令狐冲
|
||
*/
|
||
public function account()
|
||
{
|
||
$params = (new LoginValidate())->post()->goCheck();
|
||
return $this->data((new LoginLogic())->login($params));
|
||
}
|
||
|
||
/**
|
||
* @notes 代理账号登录
|
||
* @date 2021/6/30 17:01
|
||
* @return \think\response\Json
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author 令狐冲
|
||
*/
|
||
public function agentAccount()
|
||
{
|
||
$params = (new LoginAgentValidate())->post()->goCheck();
|
||
return $this->data((new LoginLogic())->loginAgent($params));
|
||
}
|
||
|
||
/**
|
||
* @notes 退出登录
|
||
* @return \think\response\Json
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author 令狐冲
|
||
* @date 2021/7/8 00:36
|
||
*/
|
||
public function logout()
|
||
{
|
||
//退出登录情况特殊,只有成功的情况,也不需要token验证
|
||
(new LoginLogic())->logout($this->adminInfo);
|
||
return $this->success();
|
||
}
|
||
} |