Merge branch 'develop' into dc
正在显示
10 个修改的文件
包含
110 行增加
和
23 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside; | ||
| 4 | + | ||
| 5 | +use App\Models\Manage\Manage; | ||
| 6 | +use App\Utils\LogUtils; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Class NoticeController | ||
| 10 | + * @package App\Http\Controllers\Aside | ||
| 11 | + * @author zbj | ||
| 12 | + * @date 2023/6/26 | ||
| 13 | + */ | ||
| 14 | +class NoticeController extends BaseController | ||
| 15 | +{ | ||
| 16 | + /** | ||
| 17 | + * 项目通知 | ||
| 18 | + * @return \Illuminate\Http\JsonResponse | ||
| 19 | + * @throws \Psr\Container\ContainerExceptionInterface | ||
| 20 | + * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 21 | + * @author zbj | ||
| 22 | + * @date 2023/6/26 | ||
| 23 | + */ | ||
| 24 | + public function project() | ||
| 25 | + { | ||
| 26 | + //首次 续费 | ||
| 27 | + LogUtils::info('notice project', $this->param); | ||
| 28 | + return $this->success(); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | +} |
| @@ -63,7 +63,7 @@ class ProjectDeptController extends BaseController | @@ -63,7 +63,7 @@ class ProjectDeptController extends BaseController | ||
| 63 | ->orderBy('gl_project_dept_user.id','desc'); | 63 | ->orderBy('gl_project_dept_user.id','desc'); |
| 64 | $query = $this->searchParam($query); | 64 | $query = $this->searchParam($query); |
| 65 | $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page); | 65 | $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page); |
| 66 | - return $this->success($lists); | 66 | + $this->response('success',Code::SUCCESS,$lists); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | /** | 69 | /** |
| @@ -18,22 +18,26 @@ use Illuminate\Http\Request; | @@ -18,22 +18,26 @@ use Illuminate\Http\Request; | ||
| 18 | class ProjectRoleController extends BaseController | 18 | class ProjectRoleController extends BaseController |
| 19 | { | 19 | { |
| 20 | /** | 20 | /** |
| 21 | - * @name :列表 | ||
| 22 | - * @return json | ||
| 23 | - * @author :liyuhang | ||
| 24 | - * @method | 21 | + * @remark :用户角色列表 |
| 22 | + * @name :lists | ||
| 23 | + * @author :lyh | ||
| 24 | + * @method :post | ||
| 25 | + * @time :2023/6/27 10:47 | ||
| 25 | */ | 26 | */ |
| 26 | public function lists (){ | 27 | public function lists (){ |
| 27 | $roleModel = new ProjectRoleModel(); | 28 | $roleModel = new ProjectRoleModel(); |
| 28 | - $lists = $roleModel->lists($this->map,$this->page,$this->row,$this->order,['*']); | 29 | + $filed = ['id','name','project_id','operator_id','status','created_at','updated_at']; |
| 30 | + $lists = $roleModel->lists($this->map,$this->page,$this->row,$this->order,$filed); | ||
| 29 | $this->response('success',Code::SUCCESS,$lists); | 31 | $this->response('success',Code::SUCCESS,$lists); |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | /** | 34 | /** |
| 33 | - * @name :详情 | ||
| 34 | - * @return void | ||
| 35 | - * @author :liyuhang | ||
| 36 | - * @method | 35 | + * @param ProjectRoleLogic $roleLogic |
| 36 | + * @remark :获取角色详情 | ||
| 37 | + * @name :info | ||
| 38 | + * @author :lyh | ||
| 39 | + * @method :post | ||
| 40 | + * @time :2023/6/27 10:50 | ||
| 37 | */ | 41 | */ |
| 38 | public function info(ProjectRoleLogic $roleLogic){ | 42 | public function info(ProjectRoleLogic $roleLogic){ |
| 39 | $this->request->validate([ | 43 | $this->request->validate([ |
| @@ -47,10 +51,12 @@ class ProjectRoleController extends BaseController | @@ -47,10 +51,12 @@ class ProjectRoleController extends BaseController | ||
| 47 | } | 51 | } |
| 48 | 52 | ||
| 49 | /** | 53 | /** |
| 50 | - * @name :添加角色时获取菜单列表 | ||
| 51 | - * @return void | ||
| 52 | - * @author :liyuhang | ||
| 53 | - * @method | 54 | + * @param ProjectRoleLogic $roleLogic |
| 55 | + * @remark :添加角色时获取菜单列表 | ||
| 56 | + * @name :get_menu | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2023/6/27 10:51 | ||
| 54 | */ | 60 | */ |
| 55 | public function get_menu(ProjectRoleLogic $roleLogic){ | 61 | public function get_menu(ProjectRoleLogic $roleLogic){ |
| 56 | $list = $roleLogic->role_get_menu(); | 62 | $list = $roleLogic->role_get_menu(); |
| @@ -6,6 +6,8 @@ use App\Enums\Common\Code; | @@ -6,6 +6,8 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\User\UserLogic; | 7 | use App\Http\Logic\Aside\User\UserLogic; |
| 8 | use App\Http\Requests\Aside\User\UserRequest; | 8 | use App\Http\Requests\Aside\User\UserRequest; |
| 9 | +use App\Models\Project\Project; | ||
| 10 | +use App\Models\User\User; | ||
| 9 | use App\Models\User\User as UserModel; | 11 | use App\Models\User\User as UserModel; |
| 10 | use Illuminate\Http\Request; | 12 | use Illuminate\Http\Request; |
| 11 | 13 | ||
| @@ -26,9 +28,15 @@ class ProjectUserController extends BaseController | @@ -26,9 +28,15 @@ class ProjectUserController extends BaseController | ||
| 26 | * @time :2023/6/25 9:27 | 28 | * @time :2023/6/25 9:27 |
| 27 | */ | 29 | */ |
| 28 | public function lists(){ | 30 | public function lists(){ |
| 31 | + $filed = ['id','mobile','name','project_id','created_at','updated_at','image','operator_id']; | ||
| 29 | $userModel = new UserModel(); | 32 | $userModel = new UserModel(); |
| 30 | - $lists = $userModel->lists($this->map,$this->page,$this->row,$this->order, | ||
| 31 | - ['id','mobile','name','created_at','updated_at','image','operator_id']); | 33 | + $lists = $userModel->lists($this->map,$this->page,$this->row,$this->order,$filed); |
| 34 | + if(!empty($lists)){ | ||
| 35 | + foreach ($lists['list'] as $k => $v){ | ||
| 36 | + $lists['list'][$k]['operator_name'] = (new User())->read(['id'=>$v['operator_id']],['name'])['name']; | ||
| 37 | + $lists['list'][$k]['project_name'] = (new Project())->read(['id'=>$v['project_id']],['title'])['title']; | ||
| 38 | + } | ||
| 39 | + } | ||
| 32 | $this->response('列表',Code::SUCCESS,$lists); | 40 | $this->response('列表',Code::SUCCESS,$lists); |
| 33 | } | 41 | } |
| 34 | 42 |
| @@ -267,4 +267,30 @@ class FileController | @@ -267,4 +267,30 @@ class FileController | ||
| 267 | } | 267 | } |
| 268 | return $data; | 268 | return $data; |
| 269 | } | 269 | } |
| 270 | + | ||
| 271 | + /** | ||
| 272 | + * @remark :文件下载 | ||
| 273 | + * @name :downLoad | ||
| 274 | + * @author :lyh | ||
| 275 | + * @method :post | ||
| 276 | + * @time :2023/6/26 16:28 | ||
| 277 | + */ | ||
| 278 | + public function downLoad($hash){ | ||
| 279 | + $file_model = new File(); | ||
| 280 | + $info = $file_model->read(['hash' => $hash]); | ||
| 281 | + if ($info === false) { | ||
| 282 | + $this->response('指定文件不存在!', Code::USER_ERROR); | ||
| 283 | + } | ||
| 284 | + $path = $info['path']; | ||
| 285 | + if (!is_file($path)) { | ||
| 286 | + $this->response('指定文件已被系统删除!', Code::USER_ERROR); | ||
| 287 | + } | ||
| 288 | + $fileUrl = url('upload/files/'.basename($path)); // 文件的 URL | ||
| 289 | + $fileName = 'downloaded_file'.'.'.$info['type']; // 要保存的文件名 | ||
| 290 | + // 设置响应头 | ||
| 291 | + header('Content-Type: application/octet-stream'); | ||
| 292 | + header('Content-Disposition: attachment; filename="' . $fileName . '"'); | ||
| 293 | + // 下载文件 | ||
| 294 | + readfile($fileUrl); | ||
| 295 | + } | ||
| 270 | } | 296 | } |
| @@ -242,7 +242,6 @@ class ImageController | @@ -242,7 +242,6 @@ class ImageController | ||
| 242 | * @method | 242 | * @method |
| 243 | */ | 243 | */ |
| 244 | protected function _extents($data) { | 244 | protected function _extents($data) { |
| 245 | - | ||
| 246 | if (empty($data) || !is_array($data)) { | 245 | if (empty($data) || !is_array($data)) { |
| 247 | return empty($data) ? is_array($data) ? [] : '' : $data; | 246 | return empty($data) ? is_array($data) ? [] : '' : $data; |
| 248 | } | 247 | } |
| @@ -264,4 +263,5 @@ class ImageController | @@ -264,4 +263,5 @@ class ImageController | ||
| 264 | } | 263 | } |
| 265 | return $data; | 264 | return $data; |
| 266 | } | 265 | } |
| 266 | + | ||
| 267 | } | 267 | } |
| @@ -21,7 +21,8 @@ class DeptLogic extends BaseLogic | @@ -21,7 +21,8 @@ class DeptLogic extends BaseLogic | ||
| 21 | * @method :post | 21 | * @method :post |
| 22 | * @time :2023/6/21 14:56 | 22 | * @time :2023/6/21 14:56 |
| 23 | */ | 23 | */ |
| 24 | - public function DeptLists($map,$page,$row,$order = 'created_at',$filed = ['*']){ | 24 | + public function DeptLists($map,$page,$row,$order = 'created_at'){ |
| 25 | + $filed = ['id','pid','title','sort','created_at','remark']; | ||
| 25 | $lists = $this->model->lists($map,$page,$row,$order,$filed); | 26 | $lists = $this->model->lists($map,$page,$row,$order,$filed); |
| 26 | return $this->success($lists); | 27 | return $this->success($lists); |
| 27 | } | 28 | } |
| @@ -34,7 +35,8 @@ class DeptLogic extends BaseLogic | @@ -34,7 +35,8 @@ class DeptLogic extends BaseLogic | ||
| 34 | * @time :2023/6/21 15:01 | 35 | * @time :2023/6/21 15:01 |
| 35 | */ | 36 | */ |
| 36 | public function DeptRead(){ | 37 | public function DeptRead(){ |
| 37 | - $info = $this->model->read($this->param); | 38 | + $filed = ['id','pid','title','sort','created_at','remark']; |
| 39 | + $info = $this->model->read($this->param,$filed); | ||
| 38 | if($info === false){ | 40 | if($info === false){ |
| 39 | $this->fail('当前数据不存在,或者被删除'); | 41 | $this->fail('当前数据不存在,或者被删除'); |
| 40 | } | 42 | } |
| @@ -92,7 +92,8 @@ class ProjectMenuLogic extends BaseLogic | @@ -92,7 +92,8 @@ class ProjectMenuLogic extends BaseLogic | ||
| 92 | * @time :2023/6/21 17:26 | 92 | * @time :2023/6/21 17:26 |
| 93 | */ | 93 | */ |
| 94 | public function MenuList(){ | 94 | public function MenuList(){ |
| 95 | - $lists = $this->model->list(['status'=>$this->model::ZERO,'is_role'=>$this->model::ZERO,'pid'=>$this->model::ZERO]); | 95 | + $filed = ['id','pid','name','created_at','status','rules','is_role','icon','action','updated_at']; |
| 96 | + $lists = $this->model->list(['status'=>$this->model::ZERO,'is_role'=>$this->model::ZERO,'pid'=>$this->model::ZERO],'created_at',$filed); | ||
| 96 | return $this->success($lists); | 97 | return $this->success($lists); |
| 97 | } | 98 | } |
| 98 | } | 99 | } |
| @@ -2,7 +2,9 @@ | @@ -2,7 +2,9 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Logic\Aside\User; | 3 | namespace App\Http\Logic\Aside\User; |
| 4 | 4 | ||
| 5 | +use App\Helper\Common; | ||
| 5 | use App\Http\Logic\Aside\BaseLogic; | 6 | use App\Http\Logic\Aside\BaseLogic; |
| 7 | +use App\Models\Project\Project; | ||
| 6 | use App\Models\User\User; | 8 | use App\Models\User\User; |
| 7 | 9 | ||
| 8 | class UserLogic extends BaseLogic | 10 | class UserLogic extends BaseLogic |
| @@ -22,10 +24,16 @@ class UserLogic extends BaseLogic | @@ -22,10 +24,16 @@ class UserLogic extends BaseLogic | ||
| 22 | * @method | 24 | * @method |
| 23 | */ | 25 | */ |
| 24 | public function user_info(){ | 26 | public function user_info(){ |
| 25 | - $info = $this->model->read($this->param,['id','project_id','name','status','mobile','operator_id']); | ||
| 26 | - if($info === false){ | ||
| 27 | - $this->fail('当前数据不存在'); | 27 | + $info = Common::get_user_cache($this->model,$this->param['id'],'A'); |
| 28 | + if(empty($info)){ | ||
| 29 | + $info = $this->model->read($this->param,['id','project_id','name','status','mobile','operator_id']); | ||
| 30 | + if($info === false){ | ||
| 31 | + $this->fail('当前数据不存在'); | ||
| 32 | + } | ||
| 33 | + $info['operator_name'] = (new User())->read(['id'=>$info['operator_id']],['name'])['name']; | ||
| 34 | + $info['project_name'] = (new Project())->read(['id'=>$info['project_id']],['title'])['title']; | ||
| 28 | } | 35 | } |
| 36 | + Common::set_user_cache($info,$this->model,$this->param['id'],'A'); | ||
| 29 | return $this->success($info); | 37 | return $this->success($info); |
| 30 | } | 38 | } |
| 31 | /** | 39 | /** |
| @@ -63,6 +71,7 @@ class UserLogic extends BaseLogic | @@ -63,6 +71,7 @@ class UserLogic extends BaseLogic | ||
| 63 | if($rs === false){ | 71 | if($rs === false){ |
| 64 | $this->fail('编辑失败'); | 72 | $this->fail('编辑失败'); |
| 65 | } | 73 | } |
| 74 | + Common::del_user_cache($this->model,$this->param['id'],'A'); | ||
| 66 | return $this->success(); | 75 | return $this->success(); |
| 67 | } | 76 | } |
| 68 | 77 | ||
| @@ -73,11 +82,13 @@ class UserLogic extends BaseLogic | @@ -73,11 +82,13 @@ class UserLogic extends BaseLogic | ||
| 73 | * @method | 82 | * @method |
| 74 | */ | 83 | */ |
| 75 | public function user_del(){ | 84 | public function user_del(){ |
| 85 | + $ids = $this->param['id']; | ||
| 76 | $this->param['id'] = ['in',$this->param['id']]; | 86 | $this->param['id'] = ['in',$this->param['id']]; |
| 77 | $rs = $this->model->del($this->param); | 87 | $rs = $this->model->del($this->param); |
| 78 | if($rs === false){ | 88 | if($rs === false){ |
| 79 | $this->fail('删除失败'); | 89 | $this->fail('删除失败'); |
| 80 | } | 90 | } |
| 91 | + Common::del_user_cache($this->model,$ids,'A'); | ||
| 81 | return $this->success(); | 92 | return $this->success(); |
| 82 | } | 93 | } |
| 83 | 94 |
| @@ -214,6 +214,8 @@ Route::group([], function () { | @@ -214,6 +214,8 @@ Route::group([], function () { | ||
| 214 | Route::any('/login', [Aside\LoginController::class, 'login'])->name('admin.login.white'); | 214 | Route::any('/login', [Aside\LoginController::class, 'login'])->name('admin.login.white'); |
| 215 | Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('admin.image_show'); | 215 | Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('admin.image_show'); |
| 216 | Route::any('/file/{hash}', [\App\Http\Controllers\File\FileController::class, 'index'])->name('admin.file_show'); | 216 | Route::any('/file/{hash}', [\App\Http\Controllers\File\FileController::class, 'index'])->name('admin.file_show'); |
| 217 | + | ||
| 218 | + Route::get('/notice/project', [Aside\NoticeController::class, 'project'])->name('admin.notice.project'); | ||
| 217 | }); | 219 | }); |
| 218 | 220 | ||
| 219 | 221 |
-
请 注册 或 登录 后发表评论