作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

... ... @@ -31,12 +31,11 @@ class AdminFaultController extends AdminBaseController{
public function index(){
$Order=new OrderModel();
$data=$Order->alias('a')
->field('a.*,count(a.eq_name) as num,sum(a.time) as sumTime')
->join('equipment b','a.eq_name=b.name')
->group('a.eq_name')
$data=Db::name('fault')->alias('a')
->field('eq_name')
->group('eq_name')
->order('start_time','desc')
->paginate(10)->each(function ($item){
->select()->each(function ($item){
$item['average']=round($item['sumTime']/$item['num']);
//计费故障次数
$item['fault_time']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>1])->count();
... ...