Merge branch 'master' of https://github.com/yanwenwu/catch-admin
This commit is contained in:
commit
eee53b3131
@ -96,7 +96,7 @@ class Role extends CatchController
|
|||||||
|
|
||||||
// 更新department
|
// 更新department
|
||||||
$hasDepartmentIds = $role->getDepartments()->column('id');
|
$hasDepartmentIds = $role->getDepartments()->column('id');
|
||||||
$departmentIds = $request->param('departments');
|
$departmentIds = $request->param('departments',[]);
|
||||||
|
|
||||||
// 已存在部门 IDS
|
// 已存在部门 IDS
|
||||||
$existedDepartmentIds = [];
|
$existedDepartmentIds = [];
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace catchAdmin\system\controller;
|
namespace catchAdmin\system\controller;
|
||||||
|
|
||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use think\facade\Db;
|
|
||||||
use catchAdmin\system\model\OperateLog as Log;
|
use catchAdmin\system\model\OperateLog as Log;
|
||||||
|
|
||||||
class OperateLog extends CatchController
|
class OperateLog extends CatchController
|
||||||
@ -31,4 +31,22 @@ class OperateLog extends CatchController
|
|||||||
{
|
{
|
||||||
return CatchResponse::success($log->where('id', '>', 0)->delete(), '清空成功');
|
return CatchResponse::success($log->where('id', '>', 0)->delete(), '清空成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param mixed $id
|
||||||
|
* @throws \Exception
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function delete($id, Log $log)
|
||||||
|
{
|
||||||
|
$ids = explode(',', $id);
|
||||||
|
|
||||||
|
if (empty($ids)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CatchResponse::success($log->whereIn('id', $ids)->delete());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace catchAdmin\system\model;
|
namespace catchAdmin\system\model;
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Users;
|
use catchAdmin\permissions\model\Users;
|
||||||
use catcher\traits\db\BaseOptionsTrait;
|
use catcher\traits\db\BaseOptionsTrait;
|
||||||
|
use catchAdmin\system\model\search\OperateLogSearch;
|
||||||
|
|
||||||
class OperateLog extends \think\Model
|
class OperateLog extends \think\Model
|
||||||
{
|
{
|
||||||
use BaseOptionsTrait;
|
use BaseOptionsTrait;
|
||||||
|
use OperateLogSearch;
|
||||||
|
|
||||||
|
|
||||||
protected $name = 'operate_log';
|
protected $name = 'operate_log';
|
||||||
|
|
||||||
@ -34,6 +38,7 @@ class OperateLog extends \think\Model
|
|||||||
{
|
{
|
||||||
return $this->field([$this->aliasField('*')])
|
return $this->field([$this->aliasField('*')])
|
||||||
->catchJoin(Users::class, 'id', 'creator_id', ['username as creator'])
|
->catchJoin(Users::class, 'id', 'creator_id', ['username as creator'])
|
||||||
|
->catchSearch()
|
||||||
->order($this->aliasField('id'), 'desc')
|
->order($this->aliasField('id'), 'desc')
|
||||||
->paginate();
|
->paginate();
|
||||||
}
|
}
|
||||||
|
26
catch/system/model/search/OperateLogSearch.php
Normal file
26
catch/system/model/search/OperateLogSearch.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace catchAdmin\system\model\search;
|
||||||
|
|
||||||
|
trait OperateLogSearch
|
||||||
|
{
|
||||||
|
public function searchModuleAttr($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->whereLike('module', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchMethodAttr($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->whereLike('method', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchCreatorAttr($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->where('username', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchCreateAtAttr($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->whereTime($this->aliasField('created_at'), 'between', $value);
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
$router->group(function () use ($router){
|
$router->group(function () use ($router) {
|
||||||
// 登录日志
|
// 登录日志
|
||||||
$router->get('log/login', '\catchAdmin\system\controller\LoginLog@list');
|
$router->get('log/login', '\catchAdmin\system\controller\LoginLog@list');
|
||||||
$router->delete('loginLog/empty', '\catchAdmin\system\controller\LoginLog@empty');
|
$router->delete('loginLog/empty', '\catchAdmin\system\controller\LoginLog@empty');
|
||||||
// 操作日志
|
// 操作日志
|
||||||
$router->get('log/operate', '\catchAdmin\system\controller\OperateLog@list');
|
$router->get('log/operate', '\catchAdmin\system\controller\OperateLog@list');
|
||||||
$router->delete('operateLog/empty', '\catchAdmin\system\controller\OperateLog@empty');
|
$router->delete('operateLog/empty', '\catchAdmin\system\controller\OperateLog@empty');
|
||||||
|
$router->delete('operateLog/delete', '\catchAdmin\system\controller\OperateLog@delete');
|
||||||
|
|
||||||
// 数据字典
|
// 数据字典
|
||||||
$router->get('tables', '\catchAdmin\system\controller\DataDictionary@tables');
|
$router->get('tables', '\catchAdmin\system\controller\DataDictionary@tables');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user