作者 邓超

Merge branch 'develop' into dc

<?php
namespace App\Http\Controllers\Aside;
use App\Models\Manage\Manage;
use App\Utils\LogUtils;
/**
* Class NoticeController
* @package App\Http\Controllers\Aside
* @author zbj
* @date 2023/6/26
*/
class NoticeController extends BaseController
{
/**
* 项目通知
* @return \Illuminate\Http\JsonResponse
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @author zbj
* @date 2023/6/26
*/
public function project()
{
//首次 续费
LogUtils::info('notice project', $this->param);
return $this->success();
}
}
... ...
... ... @@ -63,7 +63,7 @@ class ProjectDeptController extends BaseController
->orderBy('gl_project_dept_user.id','desc');
$query = $this->searchParam($query);
$lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page);
return $this->success($lists);
$this->response('success',Code::SUCCESS,$lists);
}
/**
... ...
... ... @@ -18,22 +18,26 @@ use Illuminate\Http\Request;
class ProjectRoleController extends BaseController
{
/**
* @name :列表
* @return json
* @author :liyuhang
* @method
* @remark :用户角色列表
* @name :lists
* @author :lyh
* @method :post
* @time :2023/6/27 10:47
*/
public function lists (){
$roleModel = new ProjectRoleModel();
$lists = $roleModel->lists($this->map,$this->page,$this->row,$this->order,['*']);
$filed = ['id','name','project_id','operator_id','status','created_at','updated_at'];
$lists = $roleModel->lists($this->map,$this->page,$this->row,$this->order,$filed);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @name :详情
* @return void
* @author :liyuhang
* @method
* @param ProjectRoleLogic $roleLogic
* @remark :获取角色详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/6/27 10:50
*/
public function info(ProjectRoleLogic $roleLogic){
$this->request->validate([
... ... @@ -47,10 +51,12 @@ class ProjectRoleController extends BaseController
}
/**
* @name :添加角色时获取菜单列表
* @return void
* @author :liyuhang
* @method
* @param ProjectRoleLogic $roleLogic
* @remark :添加角色时获取菜单列表
* @name :get_menu
* @author :lyh
* @method :post
* @time :2023/6/27 10:51
*/
public function get_menu(ProjectRoleLogic $roleLogic){
$list = $roleLogic->role_get_menu();
... ...
... ... @@ -6,6 +6,8 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\User\UserLogic;
use App\Http\Requests\Aside\User\UserRequest;
use App\Models\Project\Project;
use App\Models\User\User;
use App\Models\User\User as UserModel;
use Illuminate\Http\Request;
... ... @@ -26,9 +28,15 @@ class ProjectUserController extends BaseController
* @time :2023/6/25 9:27
*/
public function lists(){
$filed = ['id','mobile','name','project_id','created_at','updated_at','image','operator_id'];
$userModel = new UserModel();
$lists = $userModel->lists($this->map,$this->page,$this->row,$this->order,
['id','mobile','name','created_at','updated_at','image','operator_id']);
$lists = $userModel->lists($this->map,$this->page,$this->row,$this->order,$filed);
if(!empty($lists)){
foreach ($lists['list'] as $k => $v){
$lists['list'][$k]['operator_name'] = (new User())->read(['id'=>$v['operator_id']],['name'])['name'];
$lists['list'][$k]['project_name'] = (new Project())->read(['id'=>$v['project_id']],['title'])['title'];
}
}
$this->response('列表',Code::SUCCESS,$lists);
}
... ...
... ... @@ -267,4 +267,30 @@ class FileController
}
return $data;
}
/**
* @remark :文件下载
* @name :downLoad
* @author :lyh
* @method :post
* @time :2023/6/26 16:28
*/
public function downLoad($hash){
$file_model = new File();
$info = $file_model->read(['hash' => $hash]);
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
$path = $info['path'];
if (!is_file($path)) {
$this->response('指定文件已被系统删除!', Code::USER_ERROR);
}
$fileUrl = url('upload/files/'.basename($path)); // 文件的 URL
$fileName = 'downloaded_file'.'.'.$info['type']; // 要保存的文件名
// 设置响应头
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
// 下载文件
readfile($fileUrl);
}
}
... ...
... ... @@ -242,7 +242,6 @@ class ImageController
* @method
*/
protected function _extents($data) {
if (empty($data) || !is_array($data)) {
return empty($data) ? is_array($data) ? [] : '' : $data;
}
... ... @@ -264,4 +263,5 @@ class ImageController
}
return $data;
}
}
... ...
... ... @@ -21,7 +21,8 @@ class DeptLogic extends BaseLogic
* @method :post
* @time :2023/6/21 14:56
*/
public function DeptLists($map,$page,$row,$order = 'created_at',$filed = ['*']){
public function DeptLists($map,$page,$row,$order = 'created_at'){
$filed = ['id','pid','title','sort','created_at','remark'];
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
... ... @@ -34,7 +35,8 @@ class DeptLogic extends BaseLogic
* @time :2023/6/21 15:01
*/
public function DeptRead(){
$info = $this->model->read($this->param);
$filed = ['id','pid','title','sort','created_at','remark'];
$info = $this->model->read($this->param,$filed);
if($info === false){
$this->fail('当前数据不存在,或者被删除');
}
... ...
... ... @@ -92,7 +92,8 @@ class ProjectMenuLogic extends BaseLogic
* @time :2023/6/21 17:26
*/
public function MenuList(){
$lists = $this->model->list(['status'=>$this->model::ZERO,'is_role'=>$this->model::ZERO,'pid'=>$this->model::ZERO]);
$filed = ['id','pid','name','created_at','status','rules','is_role','icon','action','updated_at'];
$lists = $this->model->list(['status'=>$this->model::ZERO,'is_role'=>$this->model::ZERO,'pid'=>$this->model::ZERO],'created_at',$filed);
return $this->success($lists);
}
}
... ...
... ... @@ -2,7 +2,9 @@
namespace App\Http\Logic\Aside\User;
use App\Helper\Common;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\Project;
use App\Models\User\User;
class UserLogic extends BaseLogic
... ... @@ -22,10 +24,16 @@ class UserLogic extends BaseLogic
* @method
*/
public function user_info(){
$info = $this->model->read($this->param,['id','project_id','name','status','mobile','operator_id']);
if($info === false){
$this->fail('当前数据不存在');
$info = Common::get_user_cache($this->model,$this->param['id'],'A');
if(empty($info)){
$info = $this->model->read($this->param,['id','project_id','name','status','mobile','operator_id']);
if($info === false){
$this->fail('当前数据不存在');
}
$info['operator_name'] = (new User())->read(['id'=>$info['operator_id']],['name'])['name'];
$info['project_name'] = (new Project())->read(['id'=>$info['project_id']],['title'])['title'];
}
Common::set_user_cache($info,$this->model,$this->param['id'],'A');
return $this->success($info);
}
/**
... ... @@ -63,6 +71,7 @@ class UserLogic extends BaseLogic
if($rs === false){
$this->fail('编辑失败');
}
Common::del_user_cache($this->model,$this->param['id'],'A');
return $this->success();
}
... ... @@ -73,11 +82,13 @@ class UserLogic extends BaseLogic
* @method
*/
public function user_del(){
$ids = $this->param['id'];
$this->param['id'] = ['in',$this->param['id']];
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('删除失败');
}
Common::del_user_cache($this->model,$ids,'A');
return $this->success();
}
... ...
... ... @@ -214,6 +214,8 @@ Route::group([], function () {
Route::any('/login', [Aside\LoginController::class, 'login'])->name('admin.login.white');
Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('admin.image_show');
Route::any('/file/{hash}', [\App\Http\Controllers\File\FileController::class, 'index'])->name('admin.file_show');
Route::get('/notice/project', [Aside\NoticeController::class, 'project'])->name('admin.notice.project');
});
... ...