From 73a1ec923b1ce0d83398d25318c86f6d96744319 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Thu, 14 Dec 2023 16:34:50 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=A4=A7=E5=B1=8F-=E6=BA=AF=E6=BA=90?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E6=99=BA=E8=83=BD=E9=A2=84=E8=AD=A6=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/dataview/LandController.php | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 app/api/controller/dataview/LandController.php diff --git a/app/api/controller/dataview/LandController.php b/app/api/controller/dataview/LandController.php new file mode 100644 index 00000000..ace9150b --- /dev/null +++ b/app/api/controller/dataview/LandController.php @@ -0,0 +1,58 @@ +areaCode = $this->request->param('areaCode', ''); + $this->streetCode = $this->request->param('streetCode', ''); + if ($this->areaCode == '') { + throw new ValidateException('未获取到位置信息'); + } + } + + + // 溯源产品统计 + public function plantProductCount() + { + $list = LandPlant::alias('lp')->join('land l', 'l.id=lp.land_id')->field('lp.kind,lp.qr_code') + ->where(function ($query) { + if ($this->streetCode != '') { + $query->where('l.town_code', $this->streetCode); + } else { + $query->where('l.county_code', $this->areaCode); + } + })->limit(30)->select(); + return $this->success('成功', compact('list')); + } + + // 智能预警数据 + public function landCollectionList() + { + $list = LandCollection::alias('lc') + ->field('lc.*,l.title') + ->join('land l', 'l.id=lc.land_id') + ->where(function ($query) { + if ($this->streetCode != '') { + $query->where('l.town_code', $this->streetCode); + } else { + $query->where('l.county_code', $this->areaCode); + } + })->limit(30)->select(); + return $this->success('成功', compact('list')); + } +} \ No newline at end of file