wangsaitao 7 月之前
父节点
当前提交
592acda67e
共有 2 个文件被更改,包括 14 次插入5 次删除
  1. 12 4
      application/api/controller/screen/Daily.php
  2. 2 1
      application/api/controller/screen/Patrol.php

+ 12 - 4
application/api/controller/screen/Daily.php

@@ -191,10 +191,11 @@ class Daily extends Index
             $addr = Db::name('daily_record')
                 ->alias('dr')
                 ->join('daily d','d.id=dr.daily_id')
+                ->join('address ad','d.address_id=ad.id')
                 ->where('dr.org_id',$this->orgId)
                 ->where('dr.user_id',$v['id'])
                 ->where('dr.create_yyyymmdd',$curday)
-                ->value('d.title');
+                ->value('ad.title');
 
             $slist[$k][] = '<span style="color: #2A88F7">'.$v['real_name'].'</span>';
 
@@ -220,10 +221,11 @@ class Daily extends Index
             $addr = Db::name('daily_record')
                 ->alias('dr')
                 ->join('daily d','d.id=dr.daily_id')
+                ->join('address ad','d.address_id=ad.id')
                 ->where('dr.org_id',$this->orgId)
                 ->where('dr.user_id',$v['id'])
                 ->where('dr.create_yyyymmdd',$curday)
-                ->value('d.title');
+                ->value('ad.title');
 
             $slist2[$k][] = '<span style="color: #2DF8F5">'.$v['real_name'].'</span>';
 
@@ -252,7 +254,7 @@ class Daily extends Index
         $map[] = ['enable', '=', 1];
         $map[] = ['org_id', '=', $this->orgId];
         $map[] = ['del', '=', 0];
-        $lists = Db::name('daily')->where($map)->field('id,title')->order('id desc')->select();
+        $lists = Db::name('daily')->where($map)->field('id,title,address_id')->order('id desc')->select();
         $hours = model('Daily')->getTimeDaily($this->orgId);
         foreach ($lists as $k=>$v){
             $m = [];
@@ -261,6 +263,9 @@ class Daily extends Index
             $m[] = ['create_time','>=',$hours['start']];
             $m[] = ['create_time','<',$hours['end']];
             $count = Db::name('daily_record')->where($m)->count();
+            $lists[$k]['title'] = $v['address_id']>0?Db::name('address')
+                ->where('id',$v['address_id'])
+                ->value('title'):"";
             $lists[$k]['count'] = $count;
 
         }
@@ -276,7 +281,10 @@ class Daily extends Index
             ->select();
         $data = [];
         foreach ($list as $k=>$v){
-            $data[$k][] = Db::name('daily')->where('id',$v['daily_id'])->value('title');
+            $addrid = Db::name('daily')->where('id',$v['daily_id'])
+                ->value('address_id');
+            $data[$k][] = $addrid>0?Db::name('address')
+                ->where('id',$addrid)->value('title'):"";
             $data[$k][] = Db::name('user')->where('id',$v['user_id'])->value('real_name');
             $data[$k][] = date('m-d H:i:s',strtotime($v['create_time']));
         }

+ 2 - 1
application/api/controller/screen/Patrol.php

@@ -123,8 +123,8 @@ class Patrol extends Index
             ->where('patrol_mode',$mode)
             ->where('org_id',$this->orgId)
             ->order('id desc')
+            ->limit(100)
             ->select();
-
         $data = [];
         foreach ($lists as $k=>$v){
             $addrForm = Db::name('patrol_addr_form')
@@ -159,6 +159,7 @@ class Patrol extends Index
             ->where('is_normal',1)
             ->where('patrol_mode',$mode)
             ->order('id desc')
+            ->limit(100)
             ->select();
         $data = [];
         foreach ($lists as $k=>$v){