TaskInformationBus.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace app\api\business;
  3. use app\api\model\Ccjc;
  4. use app\api\model\Jgry;
  5. use app\api\model\TestModel;
  6. use app\api\model\Undertake;
  7. use app\common\lib\auth\JwtAuth;
  8. class TaskInformationBus
  9. {
  10. private $uid;
  11. public function __construct()
  12. {
  13. $jwtAuth= JwtAuth::getInstance(); //实例化jwtAuth
  14. $this->uid = $jwtAuth->getUid(); //setRybh是在middleware/jwtAuth中完成的
  15. }
  16. public function getTaskDetail($task_id,$pageNum=1,$pageSize=null)
  17. {
  18. //任务信息
  19. $task_info = (new Ccjc())->getTaskInfoByTaskID($task_id);
  20. $task_releaser_info = (new Jgry())->getJgryInfoByRymc($task_info['releaser']);
  21. //获取uid下创建的所有模型信息
  22. if (isset($task_info['test_model_id'])) {
  23. $task_product_info = (new TestModel())->getProductInfo($task_info['test_model_id']);
  24. $task_pesticides_info = (new TestModel())->getPesticidesInfo($task_info['test_model_id']);
  25. $task_model_info=(new TestModel())->getModelInfoByModelID($task_info['test_model_id']);
  26. }else{
  27. $task_product_info ='';
  28. $task_pesticides_info='';
  29. $task_model_info='';
  30. }
  31. $result = [
  32. 'taskInfo'=>$task_info,
  33. 'releaserInfo'=>$task_releaser_info,
  34. 'product'=>$task_product_info,
  35. 'pesticides'=>$task_pesticides_info,
  36. 'modelInfo'=>$task_model_info,
  37. ];
  38. return $result;
  39. }
  40. //获取抽样任务列表
  41. public function getSampleTaskList($task_id,$pageNum=1,$pageSize=null)
  42. {
  43. $uid = $this->uid;
  44. $where = ['bear_id', '=', $uid];
  45. $sample_task_list = (new Undertake())->selectByTaskIdAndWhere($task_id,$where,$pageNum,$pageSize);
  46. $count = (new Undertake())->countByTaskIdAndWhere($task_id,$where);
  47. return ['rows'=>$sample_task_list,'count'=>$count];
  48. }
  49. //获取检测任务列表
  50. public function getCheckTaskList($task_id,$pageNum=1,$pageSize=null)
  51. {
  52. $uid = $this->uid;
  53. $where = ['check_id', '=', $uid];
  54. $sample_task_list = (new Undertake())->selectByTaskIdAndWhere($task_id,$where,$pageNum,$pageSize);
  55. $count = (new Undertake())->countByTaskIdAndWhere($task_id,$where);
  56. return ['rows'=>$sample_task_list,'count'=>$count];
  57. }
  58. //获取报告上传任务列表
  59. public function getReportTaskList($task_id,$pageNum=1,$pageSize=null)
  60. {
  61. $uid = $this->uid;
  62. $where = ['report_id', '=', $uid];
  63. $sample_task_list = (new Undertake())->selectByTaskIdAndWhere($task_id,$where,$pageNum,$pageSize);
  64. $count = (new Undertake())->countByTaskIdAndWhere($task_id,$where);
  65. return ['rows'=>$sample_task_list,'count'=>$count];
  66. }
  67. }