正在显示
1 个修改的文件
包含
4 行增加
和
5 行删除
@@ -31,12 +31,11 @@ class AdminFaultController extends AdminBaseController{ | @@ -31,12 +31,11 @@ class AdminFaultController extends AdminBaseController{ | ||
31 | 31 | ||
32 | public function index(){ | 32 | public function index(){ |
33 | $Order=new OrderModel(); | 33 | $Order=new OrderModel(); |
34 | - $data=$Order->alias('a') | ||
35 | - ->field('a.*,count(a.eq_name) as num,sum(a.time) as sumTime') | ||
36 | - ->join('equipment b','a.eq_name=b.name') | ||
37 | - ->group('a.eq_name') | 34 | + $data=Db::name('fault')->alias('a') |
35 | + ->field('eq_name') | ||
36 | + ->group('eq_name') | ||
38 | ->order('start_time','desc') | 37 | ->order('start_time','desc') |
39 | - ->paginate(10)->each(function ($item){ | 38 | + ->select()->each(function ($item){ |
40 | $item['average']=round($item['sumTime']/$item['num']); | 39 | $item['average']=round($item['sumTime']/$item['num']); |
41 | //计费故障次数 | 40 | //计费故障次数 |
42 | $item['fault_time']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>1])->count(); | 41 | $item['fault_time']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>1])->count(); |
-
请 注册 或 登录 后发表评论