|
@@ -213,17 +213,40 @@ class Patrol extends Index
|
|
|
->order('a.id desc')
|
|
|
->limit(20)
|
|
|
->select();
|
|
|
- $lists = $lists?$lists:[];
|
|
|
+
|
|
|
+ $img = Db::name('patrol_record')
|
|
|
+ ->alias('a')
|
|
|
+ ->join('patrol_task t','a.patrol_task_id = t.id')
|
|
|
+ ->join('address b','a.patrol_addr_id = b.id')
|
|
|
+ ->field('a.images,b.title as address')
|
|
|
+ ->where('a.images','<>','')
|
|
|
+ ->where('a.org_id',$this->orgId)
|
|
|
+ ->limit(20)
|
|
|
+ ->order('a.id desc')
|
|
|
+ ->select();
|
|
|
+
|
|
|
$imgs = [];
|
|
|
+ $key = array_rand($img,3);
|
|
|
+
|
|
|
+ foreach ($key as $k=>$v){
|
|
|
+ $images = explode(',',$img[$v]['images']);
|
|
|
+ $imgs[] = [
|
|
|
+ 'img'=>$images[0],
|
|
|
+ 'title' => $img[$v]['address'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ $lists = $lists?$lists:[];
|
|
|
+ // $imgs = [];
|
|
|
$record = [];
|
|
|
foreach ($lists as $k=>$v){
|
|
|
- $img = $v['images']?(explode(',',$v['images']))[0]:'';
|
|
|
- if($img && count($imgs) < 3){
|
|
|
- $imgs[] = [
|
|
|
- 'title' => $v['address'],
|
|
|
- 'img' => $img
|
|
|
- ];
|
|
|
- }
|
|
|
+// $img = $v['images']?(explode(',',$v['images']))[0]:'';
|
|
|
+// if($img && count($imgs) < 3){
|
|
|
+// $imgs[] = [
|
|
|
+// 'title' => $v['address'],
|
|
|
+// 'img' => $img
|
|
|
+// ];
|
|
|
+// }
|
|
|
|
|
|
$record[] = [$v['address'],$v['create_time'],$v['name'],$v['content']];
|
|
|
}
|
|
@@ -242,9 +265,8 @@ class Patrol extends Index
|
|
|
->where('pr.patrol_mode',1)
|
|
|
->where('pr.create_yyyymmdd','<=',$curDay)
|
|
|
->where('pr.create_yyyymmdd','>=',$start)
|
|
|
- ->field('a.id,a.title')
|
|
|
+ ->field('a.id,a.title,patrol_addr_id')
|
|
|
->group('pr.patrol_addr_id')
|
|
|
- ->distinct(true)
|
|
|
->select();
|
|
|
$titles = [];
|
|
|
$y1 = [];
|
|
@@ -254,6 +276,7 @@ class Patrol extends Index
|
|
|
$count1 = Db::name('patrol_record')
|
|
|
->where('org_id',$this->orgId)
|
|
|
->where('patrol_mode',1)
|
|
|
+ ->where('patrol_addr_id',$v['patrol_addr_id'])
|
|
|
->where('create_yyyymmdd','=',$curDay)
|
|
|
->count();
|
|
|
$y1[] = $count1;
|
|
@@ -262,6 +285,7 @@ class Patrol extends Index
|
|
|
->where('org_id',$this->orgId)
|
|
|
->where('patrol_mode',1)
|
|
|
->where('is_normal',1)
|
|
|
+ ->where('patrol_addr_id',$v['patrol_addr_id'])
|
|
|
->where('create_yyyymmdd','<=',$curDay)
|
|
|
->where('create_yyyymmdd','>=',$start)
|
|
|
->count();
|