From 316cd23dd75adceb22532ec2531f919e0bc7aeb1 Mon Sep 17 00:00:00 2001 From: chuan <2154243450@qq.com> Date: Wed, 19 Feb 2025 16:59:50 +0800 Subject: [PATCH] role requirements --- app/admin/controller/Admin.php | 14 ++++++++ app/admin/route/app.php | 4 ++- app/admin/service/AdminService.php | 53 ++++++++++++++++++++++++++++++ app/home/service/WalletService.php | 5 ++- config/queue.php | 2 +- 5 files changed, 75 insertions(+), 3 deletions(-) diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index b9b22fc8..20027fb1 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -103,4 +103,18 @@ class Admin extends AdminBaseController $returnData = (new AdminService())->translatorBindCustomerList($this->request->param()); return json($returnData); } + + // 获取用户访问页面的记录 + public function getUserAccessLog() + { + $returnData = (new AdminService())->getUserAccessLog($this->request->param()); + return json($returnData); + } + + // 获取admin的操作记录 + public function getAdminOperationLog() + { + $returnData = (new AdminService())->getAdminOperationLog($this->request->param()); + return json($returnData); + } } diff --git a/app/admin/route/app.php b/app/admin/route/app.php index d2616566..e44aab14 100644 --- a/app/admin/route/app.php +++ b/app/admin/route/app.php @@ -14,7 +14,7 @@ $header = [ //Route::get('/test', 'Test/index'); Route::post('/test', 'Test/index'); Route::post('/test_upload', 'Upload/uploadVideo'); -Route::post('test_api', 'Agent/statsByChannel'); +Route::post('test_api', 'Admin/getAdminOperationLog'); Route::group('/', function () { // 上传图片 Route::post('/upload', 'Upload/upload'); @@ -587,6 +587,8 @@ Route::group('/', function () { Route::post('/account/get_translator_list', 'Admin/getTranslatorList'); //获取翻译员列表 Route::post('/account/translator_add_customer', 'Admin/translatorAddCustomer')->middleware('admin_log'); //翻译员添加客服好友 Route::post('/account/translator_bind_customer_list', 'Admin/translatorBindCustomerList')->middleware('admin_log'); // 翻译员绑定的客服列表 + Route::post('admin/get_user_access_log', 'Admin/getUserAccessLog'); //获取用户访问页面的记录 + Route::post('admin/get_admin_operation_log', 'Admin/getAdminOperationLog'); //获取管理员admin的操作记录 //权限菜单 Route::post('/auth/rule/add', 'auth.AuthRule/add'); diff --git a/app/admin/service/AdminService.php b/app/admin/service/AdminService.php index a3561b1d..8163418e 100644 --- a/app/admin/service/AdminService.php +++ b/app/admin/service/AdminService.php @@ -2,12 +2,14 @@ namespace app\admin\service; +use app\admin\middleware\AdminLog; use app\admin\validate\AdminValidate; use app\home\service\BaseHomeService; use app\model\AdminLogModel; use app\model\AdminModel; use app\model\AuthRoleModel; use app\model\TranslatorCustomerModel; +use app\model\UserAccessLogModel; use app\model\UserChatGroupModel; use app\model\UserChatLinkModel; use phpDocumentor\Reflection\Type; @@ -520,4 +522,55 @@ class AdminService extends AdminBaseService } } + // 用户访问页面的记录 + public function getUserAccessLog($param) + { + try { + if (empty($param['page']) || empty($param['limit'])) { + return $this->toData('400', '缺少分页参数'); + } + $where = []; + if (!empty($param['module'])) { + $where['module'] = $param['module']; + } + $list = UserAccessLogModel::where($where)->order('id', 'desc')->paginate([ + 'list_rows' => $param['limit'], + 'page' => $param['page'], + ]); + return $this->toData('0', 'SUCCESS', [ + 'list' => $list->items(), + 'page' => $list->currentPage(), + 'total' => $list->total(), + 'last_page' => $list->lastPage(), + ]); + } catch (\Exception $exception) { + return $this->toData('500', 'The system is busy.', [$exception->getMessage(), $exception->getTrace()]); + } + } + + public function getAdminOperationLog($param) + { + try { + if (empty($param['page']) || empty($param['limit'])) { + return $this->toData('400', '缺少分页参数'); + } + $where = []; + if (!empty($param['admin_id'])) { + $where['admin_id'] = $param['admin_id']; + } + $list = AdminLogModel::where($where)->order('id', 'desc')->paginate([ + 'list_rows' => $param['limit'], + 'page' => $param['page'], + ]); + return $this->toData('0', 'SUCCESS', [ + 'list' => $list->items(), + 'page' => $list->currentPage(), + 'total' => $list->total(), + 'last_page' => $list->lastPage(), + ]); + } catch (\Exception $exception) { + return $this->toData('500', 'The system is busy.', [$exception->getMessage(), $exception->getTrace()]); + } + } + } diff --git a/app/home/service/WalletService.php b/app/home/service/WalletService.php index 7b0465ba..af9bbef0 100644 --- a/app/home/service/WalletService.php +++ b/app/home/service/WalletService.php @@ -977,7 +977,10 @@ class WalletService extends BaseHomeService //校验交易密码 $salt = env('ENCRYPT.SALT'); $name = env('WALLET.NAME'); - $user_info = UserModel::getFieldsByUserId('trade_password,is_real', $data['user_id']); + $user_info = UserModel::getFieldsByUserId('trade_password,is_real,status', $data['user_id']); + if (in_array($user_info['status'], [UserModel::STATUS_FORBID, UserModel::STATUS_BLACK])) { + return $this->toData(3, "禁用或拉黑账户不能提款"); + } if (empty($user_info['trade_password'])) { return $this->toData(3, "Please set a transaction password first."); } diff --git a/config/queue.php b/config/queue.php index b9c84333..d4a3e564 100644 --- a/config/queue.php +++ b/config/queue.php @@ -12,7 +12,7 @@ return [ 'default' => 'redis', 'connections' => [ - 'sync' => [ + 'sync' => [ //同步执行 'type' => 'sync', ], 'redis' => [