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

order

@@ -30,9 +30,9 @@ class AdminAllStatisticsController extends AdminBaseController{ @@ -30,9 +30,9 @@ class AdminAllStatisticsController extends AdminBaseController{
30 public function index(){ 30 public function index(){
31 $Order=new OrderModel(); 31 $Order=new OrderModel();
32 $data=$Order->alias('a') 32 $data=$Order->alias('a')
33 - ->field('a.*,b.serial_number,b.hospital,count(a.mac_address) as num,sum(a.time) as sumTime')  
34 - ->join('equipment b','a.mac_address=b.mac_address')  
35 - ->group('a.mac_address') 33 + ->field('a.*,b.serial_number,b.hospital,count(a.eq_name) as num,sum(a.time) as sumTime')
  34 + ->join('equipment b','a.eq_name=b.name')
  35 + ->group('a.eq_name')
36 ->order('start_time','desc') 36 ->order('start_time','desc')
37 ->paginate(10)->each(function ($item){ 37 ->paginate(10)->each(function ($item){
38 $item['average']=round($item['sumTime']/$item['num']); 38 $item['average']=round($item['sumTime']/$item['num']);
@@ -45,7 +45,7 @@ class AdminOrderController extends AdminBaseController{ @@ -45,7 +45,7 @@ class AdminOrderController extends AdminBaseController{
45 $Order=new OrderModel(); 45 $Order=new OrderModel();
46 $data=$Order->alias('a') 46 $data=$Order->alias('a')
47 ->field('a.*,b.serial_number,b.hospital') 47 ->field('a.*,b.serial_number,b.hospital')
48 - ->join('equipment b','a.mac_address=b.mac_address') 48 + ->join('equipment b','a.eq_name=b.name')
49 ->where($where) 49 ->where($where)
50 ->order('start_time','desc') 50 ->order('start_time','desc')
51 ->paginate(10); 51 ->paginate(10);