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