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 @@ + + + + + + +
+ +
+
+
+ + + + + \ No newline at end of file