|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Aside\Project;
|
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
use App\Http\Logic\Aside\Project\ProjectLogic;
|
|
|
|
use App\Http\Requests\Aside\Project\ProjectRequest;
|
|
|
|
use App\Rules\Ids;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 项目管理
|
|
|
|
* Class ProjectController
|
|
|
|
* @package App\Http\Controllers\Aside\Project
|
|
|
|
* @author zbj
|
|
|
|
* @date 2023/4/25
|
|
|
|
*/
|
|
|
|
class ProjectController extends BaseController
|
|
|
|
{
|
|
|
|
|
|
|
|
public function list(ProjectLogic $logic)
|
|
|
|
{
|
|
|
|
$map = [];
|
|
|
|
if(!empty($this->param['search'])){
|
|
|
|
$map[] = ['title', 'like', "%{$this->param['search']}%"];
|
|
|
|
}
|
|
|
|
$sort = ['id' => 'desc'];
|
|
|
|
$data = $logic->getList($map, $sort);
|
|
|
|
|
|
|
|
return view("admin.project", ["list" => $data]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function info(Request $request, ProjectLogic $logic){
|
|
|
|
$request->validate([
|
|
|
|
'id'=>'required'
|
|
|
|
],[
|
|
|
|
'id.required' => 'ID不能为空'
|
|
|
|
]);
|
|
|
|
$data = $logic->getInfo($this->param['id']);
|
|
|
|
return $this->success(Arr::twoKeepKeys($data, ['id', 'pid', 'title', 'manager_uids', 'remark']));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function save(ProjectRequest $request, ProjectLogic $logic)
|
|
|
|
{
|
|
|
|
$data = $logic->save($this->param);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete(Request $request, ProjectLogic $logic)
|
|
|
|
{
|
|
|
|
$request->validate([
|
|
|
|
'ids'=>['required', new Ids()]
|
|
|
|
],[
|
|
|
|
'ids.required' => 'ID不能为空'
|
|
|
|
]);
|
|
|
|
|
|
|
|
$data = $logic->delete($this->param['ids']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|