代码功能更新
This commit is contained in:
Executable
+76
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller\admin\login;
|
||||
|
||||
use laytp\controller\Backend;
|
||||
use laytp\library\CommonFun;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 后台登录日志
|
||||
*/
|
||||
class Log extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* admin_login_log模型对象
|
||||
* @var \app\model\admin\login\Log
|
||||
*/
|
||||
protected $model;
|
||||
protected $hasSoftDel = 0;//是否拥有软删除功能
|
||||
|
||||
protected $noNeedLogin = []; // 无需登录即可请求的方法
|
||||
protected $noNeedAuth = ['index', 'info']; // 无需鉴权即可请求的方法
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
$this->model = new \app\model\admin\login\Log();
|
||||
}
|
||||
|
||||
|
||||
//查看和搜索列表
|
||||
|
||||
/**
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$where = $this->buildSearchParams();
|
||||
$order = $this->buildOrder();
|
||||
$data = $this->model->where($where)->order($order)->with(['adminUser']);
|
||||
$paging = $this->request->param('paging', false);
|
||||
if ($paging) {
|
||||
$limit = $this->request->param('limit', Config::get('paginate.limit'));
|
||||
$data = $data->paginate($limit)->toArray();
|
||||
$data['data'] = $this->getSelectedData($data['data']);
|
||||
} else {
|
||||
$data = $data->select()->toArray();
|
||||
}
|
||||
return $this->success('数据获取成功', $data);
|
||||
}
|
||||
|
||||
|
||||
//查看详情
|
||||
public function info()
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
$info = $this->model->find($id);
|
||||
return $this->success('获取成功', $info);
|
||||
}
|
||||
|
||||
|
||||
//回收站
|
||||
public function recycle()
|
||||
{
|
||||
$where = $this->buildSearchParams();
|
||||
$order = $this->buildOrder();
|
||||
$limit = $this->request->param('limit', Config::get('paginate.limit'));
|
||||
$data = $this->model->onlyTrashed()
|
||||
->where($where)
|
||||
->with(['adminUser'])
|
||||
->order($order)->paginate($limit)->toArray();
|
||||
return $this->success('回收站数据获取成功', $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user