1.优化运维管理中渠道列表选择渠道的筛选错误问题

2.优化渠道运维管理目录菜单权限
This commit is contained in:
2026-05-19 15:31:04 +08:00
parent 5628af683f
commit 37c0035bfc
9 changed files with 115 additions and 8 deletions

View File

@@ -32,6 +32,7 @@ class SystemLogController extends BaseController
['username', ''],
['status', ''],
['ip', ''],
['dept_id', ''],
]);
$logic = new SystemLoginLogLogic();
$query = $logic->search($where);
@@ -71,6 +72,7 @@ class SystemLogController extends BaseController
['service_name', ''],
['router', ''],
['ip', ''],
['dept_id', ''],
]);
$logic = new SystemOperLogLogic();
$logic->init($this->adminInfo);

View File

@@ -9,6 +9,7 @@ namespace plugin\saiadmin\app\event;
use plugin\saiadmin\app\cache\ReflectionCache;
use plugin\saiadmin\app\model\system\SystemLoginLog;
use plugin\saiadmin\app\model\system\SystemOperLog;
use plugin\saiadmin\app\model\system\SystemUser as SystemUserModel;
class SystemUser
{
@@ -32,6 +33,10 @@ class SystemUser
if (isset($item['admin_id'])) {
$data['created_by'] = $item['admin_id'];
$data['updated_by'] = $item['admin_id'];
$deptId = SystemUserModel::where('id', $item['admin_id'])->value('dept_id');
if ($deptId !== null && $deptId !== '' && $deptId > 0) {
$data['dept_id'] = $deptId;
}
}
SystemLoginLog::create($data);
}
@@ -49,6 +54,9 @@ class SystemUser
return false;
}
$info = getCurrentInfo();
if (!$info) {
return false;
}
$ip = $request->getRealIp();
$module = $request->plugin;
$rule = trim($request->uri());
@@ -60,6 +68,14 @@ class SystemUser
$data['ip'] = $ip;
$data['ip_location'] = self::getIpLocation($ip);
$data['request_data'] = $this->filterParams($request->all());
if (isset($info['dept_id']) && $info['dept_id'] > 0) {
$data['dept_id'] = $info['dept_id'];
} elseif (isset($info['id'])) {
$deptId = SystemUserModel::where('id', $info['id'])->value('dept_id');
if ($deptId !== null && $deptId !== '' && $deptId > 0) {
$data['dept_id'] = $deptId;
}
}
SystemOperLog::create($data);
return true;
}

View File

@@ -23,6 +23,7 @@ use plugin\saiadmin\basic\think\BaseModel;
* @property $status 登录状态
* @property $message 提示消息
* @property $login_time 登录时间
* @property $dept_id 所属渠道
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
@@ -47,4 +48,14 @@ class SystemLoginLog extends BaseModel
$query->whereTime('login_time', 'between', $value);
}
/**
* 渠道搜索
*/
public function searchDeptIdAttr($query, $value): void
{
if ($value !== '' && $value !== null && $value > 0) {
$query->where('dept_id', '=', $value);
}
}
}

View File

@@ -23,6 +23,7 @@ use plugin\saiadmin\basic\think\BaseModel;
* @property $ip 请求IP地址
* @property $ip_location IP所属地
* @property $request_data 请求数据
* @property $dept_id 所属渠道
* @property $remark 备注
* @property $created_by 创建者
* @property $updated_by 更新者
@@ -39,4 +40,14 @@ class SystemOperLog extends BaseModel
protected $table = 'sa_system_oper_log';
/**
* 渠道搜索
*/
public function searchDeptIdAttr($query, $value): void
{
if ($value !== '' && $value !== null && $value > 0) {
$query->where('dept_id', '=', $value);
}
}
}