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

namespace app\api\business;
use app\api\model\Jcdw;
use app\common\lib\Arr;
use app\common\lib\auth\JwtAuth;

//检测单位
class TestUnitBus
{
    private $rymc;
    public function __construct()
    {
        $jwtAuth=JwtAuth::getInstance();            //实例化jwtAuth
        $this->rymc = $jwtAuth->getRymc();          //setRybh是在middleware/jwtAuth中完成的
    }

    public function selectTestUnit($data,$group_type,$pageNum=1,$pageSize=10)
    {
        //判断where条件
        //任务名称：模糊查询
        $where=[
            ['groupname','=', $group_type,]
        ];
        if ($data['name'] != '' ) array_push($where, ['name', 'LIKE', '%'.$data['name'].'%']);
        //获取数据
        $result = (new Jcdw())->getInfoList($where,$pageNum, $pageSize)->toArray();
        //过滤字段
        $data=(new Arr())->Arr_columns($result, 'id,name,groupname,ssqy');
        //获取总数
        $count=(new Jcdw())->getInfoListCount($where);
        return ['rows'=>$data, 'total'=>$count,];
    }

}



















