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

namespace app\api\controller\v1;

use app\api\business\OrganizerTaskBus;
use app\api\business\TestUnitBus;

class TaskCommon
{
    //获取检测单位列表(抽样机构 todo 增加查询功能 检测单位和抽样单位可以写到一起

    private $OrganizerTaskBus;

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

    public function getTestUnitList()
    {
        $pageNum = request()->param('pageNum',1,'int');
        $pageSize = request()->param('pageSize',10,'int');
        $group_type = request()->param('groupname', '检测机构', 'trim');//todo 这里看以后的数据安排，先默认显示检测机构的分组
        $data=[
            'name' => request()->param('name','','trim'),
        ];
        $result = (new TestUnitBus())->selectTestUnit($data,$group_type,$pageNum,$pageSize);
        return showSuccess($result);
    }

    public function getTaskInfo()
    {
        $task_id = request()->param('task_id');
        $result = $this->OrganizerTaskBus->getTaskInfo($task_id);
        return showSuccess($result);

    }

}