作者 lyh

gx

@@ -95,7 +95,7 @@ class BaseController extends Controller @@ -95,7 +95,7 @@ class BaseController extends Controller
95 $this->map['updated_at'] = ['between', $this->_btw]; 95 $this->map['updated_at'] = ['between', $this->_btw];
96 break; 96 break;
97 default: 97 default:
98 - if (!empty($v) || $v == 0) { 98 + if (!empty($v) && ($v != null)) {
99 $this->map[$k] = $v; 99 $this->map[$k] = $v;
100 } 100 }
101 break; 101 break;
@@ -83,8 +83,15 @@ class ProjectController extends BaseController @@ -83,8 +83,15 @@ class ProjectController extends BaseController
83 * @method :post 83 * @method :post
84 * @time :2023/8/30 10:11 84 * @time :2023/8/30 10:11
85 */ 85 */
86 - public function lists(){  
87 - 86 + public function lists(Project $project){
  87 + $map = [];
  88 + //类型
  89 + if(isset($this->map['type'])){
  90 + $map['type'] = $this->searchType($this->map['type']);
  91 + }
  92 + //搜索参数处理
  93 + $map = $this->searchParam($map,$this->map);
  94 + $project->formatQuery($map)->with()->paginate($this->row, ['*'], 'page', $this->page);
88 } 95 }
89 96
90 /** 97 /**
@@ -95,18 +102,56 @@ class ProjectController extends BaseController @@ -95,18 +102,56 @@ class ProjectController extends BaseController
95 * @time :2023/8/30 10:14 102 * @time :2023/8/30 10:14
96 */ 103 */
97 public function searchType($type){ 104 public function searchType($type){
98 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_ZERO){  
99 - $this->param['type'] = Project::TYPE_ZERO; 105 + //初始项目
  106 + if($type == Project::TYPE_ZERO){
  107 + $type = Project::TYPE_ZERO;
100 } 108 }
101 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_THREE){  
102 - $this->param['type'] = ['in',[Project::TYPE_FOUR,Project::TYPE_SIX]]; 109 + //建站中
  110 + if($type == Project::TYPE_ONE){
  111 + $type = Project::TYPE_ONE;
103 } 112 }
104 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_TWO){  
105 - $this->param['type'] = ['in',[Project::TYPE_TWO,Project::TYPE_THREE]]; 113 + //建站完成
  114 + if($type == Project::TYPE_TWO){
  115 + $type = ['in',[Project::TYPE_TWO,Project::TYPE_THREE]];
  116 + }
  117 + if($this->param['type'] == Project::TYPE_THREE){
  118 + $type = ['in',[Project::TYPE_FOUR,Project::TYPE_SIX]];
  119 + }
  120 + return $type;
  121 + }
  122 +
  123 + /**
  124 + * @remark :搜索参数处理
  125 + * @name :searchParam
  126 + * @author :lyh
  127 + * @method :post
  128 + * @time :2023/8/30 10:30
  129 + */
  130 + public function searchParam(&$map,$param){
  131 + //搜索技术组
  132 + if(!empty($param['dep_id'])){
  133 + $map['id'] = ['in', DeployBuild::where('dept_id', $this->param['dep_id'])->pluck('project_id')->toArray()];
  134 + }
  135 + //搜索技术人员
  136 + if(!empty($param['manage_id'])){
  137 + $map['id'] = ['in', DeployBuild::where('leader_mid', $this->param['manage_id'])
  138 + ->orwhere('manager_mid', $this->param['manage_id'])
  139 + ->orwhere('designer_mid', $this->param['manage_id'])
  140 + ->orwhere('tech_mid', $this->param['manage_id'])
  141 + ->pluck('project_id')
  142 + ->toArray()];
  143 +
  144 + }
  145 + //按类型搜索
  146 + if(!empty($param['search']) && !empty($param['search_type'])){
  147 + if($this->param['search_type'] == 'domain'){
  148 + //搜索域名
  149 + $map['id'] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$this->param['search']}%")->pluck('project_id')->toArray()];
  150 + }else{
  151 + $map[$param['search_type']] = ['like', "%{$param['search']}%"];
106 } 152 }
107 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_ONE){  
108 - $this->param['type'] = Project::TYPE_ONE;  
109 } 153 }
  154 + return $map;
110 } 155 }
111 156
112 /** 157 /**
@@ -117,7 +117,7 @@ class LoginLogic extends BaseLogic @@ -117,7 +117,7 @@ class LoginLogic extends BaseLogic
117 */ 117 */
118 public function getSpecialMenu($id){ 118 public function getSpecialMenu($id){
119 $specialMenuModel = new MenuSpecial(); 119 $specialMenuModel = new MenuSpecial();
120 - $list = $specialMenuModel->list(['user_list'=>['like',','.$id.',']],'id',['id','name','remark']); 120 + $list = $specialMenuModel->list(['user_list'=>['like','%,'.$id.',%']],'id',['id','name','remark']);
121 return $list; 121 return $list;
122 } 122 }
123 123
@@ -24,12 +24,13 @@ class ManageLogic extends BaseLogic @@ -24,12 +24,13 @@ class ManageLogic extends BaseLogic
24 } 24 }
25 25
26 public function managerSave(){ 26 public function managerSave(){
  27 + if(isset($this->param['id']) && !empty($this->param['id'])){
27 if(isset($this->param['password']) && !empty($this->param['password'])){ 28 if(isset($this->param['password']) && !empty($this->param['password'])){
28 $this->param['password'] = Hash::make($this->param['password']); 29 $this->param['password'] = Hash::make($this->param['password']);
29 } 30 }
30 - if(isset($this->param['id']) && !empty($this->param['id'])){  
31 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 31 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
32 }else{ 32 }else{
  33 + $this->param['password'] = Hash::make($this->param['password']);
33 $rs = $this->model->add($this->param); 34 $rs = $this->model->add($this->param);
34 } 35 }
35 if($rs === false){ 36 if($rs === false){
@@ -36,7 +36,7 @@ class ManageRequest extends FormRequest @@ -36,7 +36,7 @@ class ManageRequest extends FormRequest
36 'name'=>'required|max:20', 36 'name'=>'required|max:20',
37 'email'=>'email|max:64', 37 'email'=>'email|max:64',
38 'mobile' => ['required', new Mobile(), Rule::unique('gl_manage')->ignore(request()->get('id',0))], 38 'mobile' => ['required', new Mobile(), Rule::unique('gl_manage')->ignore(request()->get('id',0))],
39 - 'password' => 'required|min:6', 39 +// 'password' => 'required|min:6',
40 'status' => ['required', Rule::in(array_keys(Manage::statusMap()))], 40 'status' => ['required', Rule::in(array_keys(Manage::statusMap()))],
41 ]; 41 ];
42 } 42 }
@@ -50,8 +50,8 @@ class ManageRequest extends FormRequest @@ -50,8 +50,8 @@ class ManageRequest extends FormRequest
50 'email.max' => '邮箱不能超过64个字', 50 'email.max' => '邮箱不能超过64个字',
51 'mobile.required' => '请输入手机号', 51 'mobile.required' => '请输入手机号',
52 'mobile.unique' => '手机号已存在', 52 'mobile.unique' => '手机号已存在',
53 - 'password.required' => '请输入密码',  
54 - 'password.min' => '密码长度不能小于6位', 53 +// 'password.required' => '请输入密码',
  54 +// 'password.min' => '密码长度不能小于6位',
55 'status.required' => '请选择状态', 55 'status.required' => '请选择状态',
56 'status.in' => '状态值不正确', 56 'status.in' => '状态值不正确',
57 ]; 57 ];