<?php

namespace app\controller\admin\system;

use app\BaseController;
use app\entity\SysRequestRecord;
use app\service\CurdService;
use think\db\exception\DbException;
use think\response\Json;

class RequestRecordController extends BaseController
{
    /**
     * 分页查询请求日志记录
     * @return Json
     * @throws DbException
     */
    public function page(): Json
    {
        $model = SysRequestRecord::withSearch(['createTime'], [
            'createTime' => [
                $this->request->get('createTimeStart/s', ''),
                $this->request->get('createTimeEnd/s', '')
            ],
        ]);

        $paginate = CurdService::getPaginate($this->request, $model);

        return $this->writeSuccess('ok', $paginate);
    }
}