批量更新租户规则

This commit is contained in:
2026-03-09 23:00:20 +08:00
parent e09b4c639c
commit e27cc8f457
45 changed files with 579 additions and 314 deletions
@@ -7,8 +7,8 @@ namespace app\admin\controller\OperationLog;
use app\admin\BaseController;
use think\facade\Request;
use think\response\Json;
use app\model\OperationLog;
use app\model\AdminUser;
use app\model\System\OperationLog;
use app\model\System\AdminUser;
class OperationLogController extends BaseController
{
@@ -28,7 +28,8 @@ class OperationLogController extends BaseController
$startTime = Request::param('startTime/s', '');
$endTime = Request::param('endTime/s', '');
$query = OperationLog::where('delete_time', null);
$query = OperationLog::where('delete_time', null)
->where('tid', $this->getTenantId());
// 关键词搜索(用户姓名、URL
if ($keyword) {
@@ -129,6 +130,7 @@ class OperationLogController extends BaseController
{
try {
$log = OperationLog::where('id', $id)
->where('tid', $this->getTenantId())
->where('delete_time', null)
->find();
@@ -164,6 +166,7 @@ class OperationLogController extends BaseController
{
try {
$log = OperationLog::where('id', $id)
->where('tid', $this->getTenantId())
->where('delete_time', null)
->find();
@@ -206,6 +209,7 @@ class OperationLogController extends BaseController
}
OperationLog::whereIn('id', $ids)
->where('tid', $this->getTenantId())
->where('delete_time', null)
->delete();
@@ -230,11 +234,13 @@ class OperationLogController extends BaseController
try {
// 获取模块列表
$modules = OperationLog::where('delete_time', null)
->where('tid', $this->getTenantId())
->group('module')
->column('module');
// 获取动作列表
$actions = OperationLog::where('delete_time', null)
->where('tid', $this->getTenantId())
->group('action')
->column('action');
@@ -2,7 +2,7 @@
namespace app\admin\controller\OperationLog;
use app\model\OperationLog;
use app\model\System\OperationLog;
use think\facade\Request;
use think\facade\Session;
@@ -37,6 +37,7 @@ class OperationLogHelper
$userId = $userInfo['id'] ?? 0;
$userAccount = $userInfo['account'] ?? '';
$userName = $userInfo['name'] ?? '';
$tid = $userInfo['tid'] ?? ($userInfo['tid'] ?? 0);
// 获取请求信息
$method = Request::method();
@@ -52,6 +53,7 @@ class OperationLogHelper
'user_id' => $userId,
'user_account' => $userAccount,
'user_name' => $userName,
'tid' => $tid,
'module' => $module,
'action' => $action,
'method' => $method,
@@ -3,7 +3,7 @@
namespace app\admin\controller\OperationLog;
use think\facade\Request;
use app\model\OperationLog;
use app\model\System\OperationLog;
use app\service\JwtService;
/**
@@ -33,6 +33,7 @@ class OperationLogger
$userId = $userInfo['id'] ?? 0;
$userAccount = $userInfo['account'] ?? '';
$userName = $userInfo['name'] ?? '';
$tid = $userInfo['tid'] ?? ($userInfo['tid'] ?? 0);
if (empty($requestData)) {
$requestData = Request::param();
@@ -49,6 +50,7 @@ class OperationLogger
'user_id' => $userId,
'user_account' => $userAccount,
'user_name' => $userName,
'tid' => $tid,
'module' => $module,
'action' => $action,
'method' => $method,