tubelogic.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\client\logic;
  3. use app\common\logic\baselogic;
  4. use app\common\model\tubemodel;
  5. /**
  6. * 登记记录表
  7. *
  8. * @author wj
  9. * @date 2022-07-22
  10. */
  11. class tubelogic extends baselogic
  12. {
  13. /**
  14. * 设置请求数据规则
  15. * 20220107
  16. * wj
  17. */
  18. protected function setrules()
  19. {
  20. $list = [
  21. 'gettodaydata' => [
  22. ['name' => 'page', 'title' => '当前页数', 'require' => false, 'type' => 'numeric', 'default' => 1],
  23. ['name' => 'size', 'title' => '每页条数', 'require' => false, 'type' => 'numeric', 'default' => 10],
  24. ['name' => 'date', 'title' => '日期', 'require' => false, 'type' => 'numeric', 'default' => 10],
  25. ],
  26. ];
  27. return $list;
  28. }
  29. /**
  30. * 根据日期获取未处理数据
  31. *
  32. * @param [type] $arr
  33. * @return void
  34. * @author wj
  35. * @date 2022-08-02
  36. */
  37. public function getdatabydate($arr)
  38. {
  39. $result = $this->checkparam(__FUNCTION__, $arr);
  40. if (1 != $result['status']) {
  41. return $result;
  42. }
  43. $data = $result['data'];
  44. $date = $data['date'];
  45. $page = $data['page'];
  46. $size = $data['size'];
  47. $m_t = new tubemodel();
  48. $typelist = $m_t->gettesttypelist();
  49. $where = [
  50. ['oprtime', 'like', '%' . $date . '%'],
  51. ['detection_result', '=', 0],
  52. ];
  53. $size = 10;
  54. $count = $m_t->getList($where, 'count');
  55. if (empty($count)) {
  56. return backarr(0, "无数据");
  57. }
  58. $list = $m_t->getList($where, '*', $page, $size, 'id asc')->toArray();
  59. if (empty($list)) {
  60. return backarr(0, "无数据");
  61. }
  62. foreach ($list as $key => $value) {
  63. $testtype = $value['test_type'];
  64. $testtype = isset($typelist[$testtype]) ? $typelist[$testtype] : $testtype;
  65. $list[$key]['test_type_str'] = $testtype;
  66. }
  67. return backarr(1, "查询成功", $list);
  68. }
  69. }