作者 lyh

gx

... ... @@ -95,7 +95,7 @@ class BaseController extends Controller
$this->map['updated_at'] = ['between', $this->_btw];
break;
default:
if (!empty($v) || $v == 0) {
if (!empty($v) && ($v != null)) {
$this->map[$k] = $v;
}
break;
... ...
... ... @@ -83,8 +83,15 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/30 10:11
*/
public function lists(){
public function lists(Project $project){
$map = [];
//类型
if(isset($this->map['type'])){
$map['type'] = $this->searchType($this->map['type']);
}
//搜索参数处理
$map = $this->searchParam($map,$this->map);
$project->formatQuery($map)->with()->paginate($this->row, ['*'], 'page', $this->page);
}
/**
... ... @@ -95,18 +102,56 @@ class ProjectController extends BaseController
* @time :2023/8/30 10:14
*/
public function searchType($type){
if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_ZERO){
$this->param['type'] = Project::TYPE_ZERO;
//初始项目
if($type == Project::TYPE_ZERO){
$type = Project::TYPE_ZERO;
}
if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_THREE){
$this->param['type'] = ['in',[Project::TYPE_FOUR,Project::TYPE_SIX]];
//建站中
if($type == Project::TYPE_ONE){
$type = Project::TYPE_ONE;
}
if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_TWO){
$this->param['type'] = ['in',[Project::TYPE_TWO,Project::TYPE_THREE]];
//建站完成
if($type == Project::TYPE_TWO){
$type = ['in',[Project::TYPE_TWO,Project::TYPE_THREE]];
}
if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_ONE){
$this->param['type'] = Project::TYPE_ONE;
if($this->param['type'] == Project::TYPE_THREE){
$type = ['in',[Project::TYPE_FOUR,Project::TYPE_SIX]];
}
return $type;
}
/**
* @remark :搜索参数处理
* @name :searchParam
* @author :lyh
* @method :post
* @time :2023/8/30 10:30
*/
public function searchParam(&$map,$param){
//搜索技术组
if(!empty($param['dep_id'])){
$map['id'] = ['in', DeployBuild::where('dept_id', $this->param['dep_id'])->pluck('project_id')->toArray()];
}
//搜索技术人员
if(!empty($param['manage_id'])){
$map['id'] = ['in', DeployBuild::where('leader_mid', $this->param['manage_id'])
->orwhere('manager_mid', $this->param['manage_id'])
->orwhere('designer_mid', $this->param['manage_id'])
->orwhere('tech_mid', $this->param['manage_id'])
->pluck('project_id')
->toArray()];
}
//按类型搜索
if(!empty($param['search']) && !empty($param['search_type'])){
if($this->param['search_type'] == 'domain'){
//搜索域名
$map['id'] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$this->param['search']}%")->pluck('project_id')->toArray()];
}else{
$map[$param['search_type']] = ['like', "%{$param['search']}%"];
}
}
return $map;
}
/**
... ...
... ... @@ -117,7 +117,7 @@ class LoginLogic extends BaseLogic
*/
public function getSpecialMenu($id){
$specialMenuModel = new MenuSpecial();
$list = $specialMenuModel->list(['user_list'=>['like',','.$id.',']],'id',['id','name','remark']);
$list = $specialMenuModel->list(['user_list'=>['like','%,'.$id.',%']],'id',['id','name','remark']);
return $list;
}
... ...
... ... @@ -24,12 +24,13 @@ class ManageLogic extends BaseLogic
}
public function managerSave(){
if(isset($this->param['password']) && !empty($this->param['password'])){
$this->param['password'] = Hash::make($this->param['password']);
}
if(isset($this->param['id']) && !empty($this->param['id'])){
if(isset($this->param['password']) && !empty($this->param['password'])){
$this->param['password'] = Hash::make($this->param['password']);
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['password'] = Hash::make($this->param['password']);
$rs = $this->model->add($this->param);
}
if($rs === false){
... ...
... ... @@ -36,7 +36,7 @@ class ManageRequest extends FormRequest
'name'=>'required|max:20',
'email'=>'email|max:64',
'mobile' => ['required', new Mobile(), Rule::unique('gl_manage')->ignore(request()->get('id',0))],
'password' => 'required|min:6',
// 'password' => 'required|min:6',
'status' => ['required', Rule::in(array_keys(Manage::statusMap()))],
];
}
... ... @@ -50,8 +50,8 @@ class ManageRequest extends FormRequest
'email.max' => '邮箱不能超过64个字',
'mobile.required' => '请输入手机号',
'mobile.unique' => '手机号已存在',
'password.required' => '请输入密码',
'password.min' => '密码长度不能小于6位',
// 'password.required' => '请输入密码',
// 'password.min' => '密码长度不能小于6位',
'status.required' => '请选择状态',
'status.in' => '状态值不正确',
];
... ...