TestUnitBus.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. *
  4. *User:Administrator
  5. *Date:2021/10/10
  6. */
  7. namespace app\api\business;
  8. use app\api\model\Jcdw;
  9. use app\common\lib\Arr;
  10. use app\common\lib\auth\JwtAuth;
  11. //检测单位
  12. class TestUnitBus
  13. {
  14. private $rymc;
  15. public function __construct()
  16. {
  17. $jwtAuth=JwtAuth::getInstance(); //实例化jwtAuth
  18. $this->rymc = $jwtAuth->getRymc(); //setRybh是在middleware/jwtAuth中完成的
  19. }
  20. public function selectTestUnit($data)
  21. {
  22. //判断where条件
  23. //任务名称:模糊查询
  24. $where=[
  25. ['groupname','=', $data['group_type'],]
  26. ];
  27. if ($data['name'] != '' ) array_push($where, ['name', 'LIKE', '%'.$data['name'].'%']);
  28. //获取数据
  29. $result = (new Jcdw())->getInfoList($where,$data['pageNum'], $data['pageSize'])->toArray();
  30. //过滤字段
  31. $data=(new Arr())->Arr_columns($result, 'id,name,groupname,ssqy');
  32. //获取总数
  33. $count=(new Jcdw())->getInfoListCount($where);
  34. return ['rows'=>$data, 'total'=>$count,];
  35. }
  36. }