<?php
namespace app\client\logic;

use app\common\logic\baselogic;
use app\common\model\tubemodel;

/**
 * 登记记录表
 *
 * @author wj
 * @date 2022-07-22
 */
class tubelogic extends baselogic
{

    /**
     * 设置请求数据规则
     * 20220107
     * wj
     */
    protected function setrules()
    {
        $list = [
            'gettodaydata' => [
                ['name' => 'page', 'title' => '当前页数', 'require' => false, 'type' => 'numeric', 'default' => 1],
                ['name' => 'size', 'title' => '每页条数', 'require' => false, 'type' => 'numeric', 'default' => 10],
                ['name' => 'date', 'title' => '日期', 'require' => false, 'type' => 'numeric', 'default' => 10],
            ],
        ];
        return $list;
    }
    /**
     * 根据日期获取未处理数据
     *
     * @param  [type] $arr
     * @return void
     * @author wj
     * @date 2022-08-02
     */
    public function getdatabydate($arr)
    {
        $result = $this->checkparam(__FUNCTION__, $arr);
        if (1 != $result['status']) {
            return $result;
        }
        $data = $result['data'];
        $date = $data['date'];
        $page = $data['page'];
        $size = $data['size'];
        $m_t = new tubemodel();
        $typelist = $m_t->gettesttypelist();
        $where = ['create_date' => ['like', '%' . $date . '%'], 'detection_result' => 0];
        $size = 10;
        $count = $m_t->getList($where, 'count');
        if (empty($count)) {
            return backarr(0, "无数据");
        }
        $list = $m_t->getList($where, '*', $page, $size, 'id asc')->toArray();
        if (empty($list)) {
            return backarr(0, "无数据");
        }
        return backarr(1, "查询成功", $list);
    }
}
