|
...
|
...
|
@@ -55,77 +55,6 @@ class TaskController extends BaseController |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取任务列表
|
|
|
|
* @name :getTaskList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/23 15:44
|
|
|
|
*/
|
|
|
|
public function getTaskList(&$task,$ids){
|
|
|
|
$lists = $task->list(['id'=>['in',$ids]]);
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
$v = $this->getFileUrl($v);
|
|
|
|
$lists[$k] = $v;
|
|
|
|
}
|
|
|
|
return $lists;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理文件
|
|
|
|
* @name :getFileUrl
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/23 16:15
|
|
|
|
*/
|
|
|
|
public function getFileUrl(&$v){
|
|
|
|
$fileModel = new File();
|
|
|
|
$file_info = $fileModel->read(['hash'=>$v['attachment']]);
|
|
|
|
if($file_info !== false){
|
|
|
|
$v['attachment_name'] = basename($file_info['path']);
|
|
|
|
if($file_info['is_cos'] == 1){
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosCdn = $cos['cdn'];
|
|
|
|
$v['attachment'] = $cosCdn.$file_info['path'];
|
|
|
|
}else{
|
|
|
|
$v['attachment'] = url('a/download_files?hash='.$v['attachment']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $v;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function items(Request $request, TaskLogic $logic)
|
|
|
|
{
|
|
|
|
$request->validate([
|
|
|
|
'own_manage_id'=>'required'
|
|
|
|
],[
|
|
|
|
'own_manage_id.required' => '所属人ID不能为空'
|
|
|
|
]);
|
|
|
|
$map[] = ['id', 'in', TaskOwner::where('manage_id', $this->param['own_manage_id'])->pluck('id')->toArray()];
|
|
|
|
if(!empty($this->param['search']) && !empty($this->param['search_type'])){
|
|
|
|
if($this->param['search_type'] == 'project'){
|
|
|
|
$map[] = ['project_id', 'in', Project::where('title', 'like', "%{$this->param['search']}%")->pluck('id')->toarray()];
|
|
|
|
}else{
|
|
|
|
$map[] = [$this->param['search_type'], 'like', "%{$this->param['search']}%"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!empty($this->param['dep_id'])){
|
|
|
|
$manage_ids = Manage::where('dept_id', $this->param['dep_id'])->pluck('id')->toArray();
|
|
|
|
$map[] = ['id', 'in', TaskOwner::whereIn('manage_id',$manage_ids)->pluck('task_id')->toArray()];
|
|
|
|
}
|
|
|
|
if(!empty($this->param['manage_id']) && !empty($this->param['type'])){
|
|
|
|
if($this->param['type'] == 1){
|
|
|
|
$map[] = ['created_manage_id', $this->param['manage_id']];
|
|
|
|
}else{
|
|
|
|
$map[] = ['id', 'in', TaskOwner::where('manage_id', $this->param['manage_id'])->pluck('task_id')->toArray()];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$sort = ['id' => 'desc'];
|
|
|
|
$data = $logic->getList($map, $sort, ['id', 'project_id', 'workload', 'priority', 'content', 'attachment', 'status', 'end_at', 'created_manage_id']);
|
|
|
|
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取详情
|
|
|
|
* @name :info
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -138,7 +67,7 @@ class TaskController extends BaseController |
|
|
|
],[
|
|
|
|
'id.required' => 'ID不能为空'
|
|
|
|
]);
|
|
|
|
$data = $logic->getTaskInfo($this->param['id']);
|
|
|
|
$data = $logic->getTaskInfo();
|
|
|
|
return $this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -157,7 +86,7 @@ class TaskController extends BaseController |
|
|
|
* @date 2023/4/27
|
|
|
|
*/
|
|
|
|
public function status(Request $request, TaskLogic $logic){
|
|
|
|
$request->validate([
|
|
|
|
$this->request->validate([
|
|
|
|
'id'=>'required',
|
|
|
|
'status' => ['required', Rule::in(array_keys(Task::statusMap()))]
|
|
|
|
],[
|
|
...
|
...
|
@@ -181,4 +110,43 @@ class TaskController extends BaseController |
|
|
|
$data = $logic->save($this->param);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取任务列表
|
|
|
|
* @name :getTaskList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/23 15:44
|
|
|
|
*/
|
|
|
|
public function getTaskList(&$task,$ids){
|
|
|
|
$lists = $task->list(['id'=>['in',$ids]]);
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
$v = $this->getFileUrl($v);
|
|
|
|
$lists[$k] = $v;
|
|
|
|
}
|
|
|
|
return $lists;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理文件
|
|
|
|
* @name :getFileUrl
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/23 16:15
|
|
|
|
*/
|
|
|
|
public function getFileUrl(&$v){
|
|
|
|
$fileModel = new File();
|
|
|
|
$file_info = $fileModel->read(['hash'=>$v['attachment']]);
|
|
|
|
if($file_info !== false){
|
|
|
|
$v['attachment_name'] = basename($file_info['path']);
|
|
|
|
if($file_info['is_cos'] == 1){
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosCdn = $cos['cdn'];
|
|
|
|
$v['attachment'] = $cosCdn.$file_info['path'];
|
|
|
|
}else{
|
|
|
|
$v['attachment'] = url('a/download_files?hash='.$v['attachment']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $v;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|