From 0cf9ed3c16fc278c47126fd370da41c31c56f23f Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 1 Dec 2023 10:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=95=B0=E6=8D=AE=E9=A1=B5tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Information.php | 2 + application/index/controller/Device.php | 40 +++++++ application/index/view/device/index.html | 26 +++++ .../view/device/receiving_information.html | 103 ++++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 application/index/view/device/receiving_information.html diff --git a/application/api/controller/Information.php b/application/api/controller/Information.php index 2f2f170..e8f67c2 100644 --- a/application/api/controller/Information.php +++ b/application/api/controller/Information.php @@ -5,6 +5,7 @@ namespace app\api\controller; use think\Db; use think\exception\ValidateException; use think\Loader; +use think\Log; use think\Request; use think\db\exception\DataNotFoundException; use think\db\exception\ModelNotFoundException; @@ -28,6 +29,7 @@ class Information extends Base try { + Log::info('xiaowangbeizhu'.json_encode($param)); $InformationValidate = Loader::validate('InformationValidate'); if(!$InformationValidate->check($param)){ throw new ValidateException($InformationValidate->getError()); diff --git a/application/index/controller/Device.php b/application/index/controller/Device.php index f00da35..7401fc9 100644 --- a/application/index/controller/Device.php +++ b/application/index/controller/Device.php @@ -65,4 +65,44 @@ class Device extends Base return json($list); } + /** + * 设备接收信息页面 + * @return mixed + */ + public function receivingInformation() + { + $receive = Request::instance()->get(); + $this->assign('deviceId',$receive['deviceId']); + return $this->fetch(); + } + + /** + * 设备接收信息页面数据接口 + * @return Json + * @throws DataNotFoundException + * @throws DbException + * @throws Exception + * @throws ModelNotFoundException + */ + public function receivingInformationList() { + $receive = Request::instance()->get(); + + $page = input("get.page") ? input("get.page") : 1; + $page = intval($page); + $limit = input("get.limit") ? input("get.limit") : 1; + $limit = intval($limit); + $start = $limit * ($page - 1); + $where['deviceId'] = $receive['deviceId'] ?: 0; + $result = Db::table("bs_device_receiving_information")->where($where)->order('id desc')->limit($start, $limit)->select(); + $num = Db::table("bs_device_receiving_information")->where($where)->count(); + foreach ($result as &$item) { + if ($item['timestamp']) $item['timestamp'] = date("Y-m-d H:i:s",substr($item['timestamp'],0,10)); + } + $list["msg"] = ""; + $list["code"] = 0; + $list["count"] = $num; + $list["data"] = $result; + + return json($list); + } } \ No newline at end of file diff --git a/application/index/view/device/index.html b/application/index/view/device/index.html index f0da2f6..9d4d720 100644 --- a/application/index/view/device/index.html +++ b/application/index/view/device/index.html @@ -76,6 +76,12 @@ + + + + + + +