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

order

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