<?php
/**
 *
 *User:Administrator
 *Date:2021/10/12
 */

namespace app\api\controller\v1;

//牵头单位

use app\api\business\OrganizerTaskBus;

class Organizer
{
    private $OrganizerTaskBus;

    public function __construct()
    {
        $this->OrganizerTaskBus = new OrganizerTaskBus();
    }

    public function selectTaskList()
    {
        $task_class = request()->param('task_class');
        $pageNum = request()->param('pageNum',1,'int');
        $pageSize = request()->param('pageSize',10,'int');
        $data=[
            'year'=>request()->param('year','','trim'),//年度
            'ispublic'=>request()->param('ispublic','','trim'),//任务状态：0：未发布，1：执行中，2：已结束未完成，3：已结束已完成
            'starttime' => request()->param('starttime','','trim'),//任务开始时间
            'endtime' => request()->param('endtime','','trim'),//任务结束时间
            'task_name' => request()->param('task_name','','trim'),//任务名称
        ];
        $result =$this->OrganizerTaskBus->selectTask($task_class,$pageNum,$pageSize,$data);
        return showSuccess($result);
    }

    public function getTaskInfo()
    {
        $pageNum = request()->param('pageNum', 1, 'int');
        $pageSize = request()->param('pageSize', null, 'trim');
        $task_id = request()->param('task_id');
        $result = $this->OrganizerTaskBus->getTaskInfo($task_id,$pageNum,$pageSize);
        return showSuccess($result);
    }

    public function qtRelease()
    {
        $task_id = request()->param('task_id', '', 'int');
        $result = $this->OrganizerTaskBus->releaseTask($task_id);
        return showSuccess($result);
    }
}