field( "mo.id,mo.msg_mono,mo.msg_img,mo.admin_id,mo.mono,mo.status,mo.time as cl_time,mo.admin_time as cl_admin_time,(select order_id from table_order where id = of.o_id) as order_id," . "mo.o_id,of.name,of.out_order_id,of.mobile,of.address,of.time,of.send_time,(SELECT title from table_express where id = of.exp_id) as exp_name,of.exp_number" ) ->alias("mo") ->join('order_info of', "mo.of_id=of.id") ->when(!empty($where), function ($query) use ($where) { //订单类型 if(is_numeric($where['aswStatus'])) { $query->where('mo.status',$where['aswStatus']); } //订单类型 if(is_numeric($where['sassid'])) { $query->where('mo.sassid',$where['sassid']); } //timeType[今日,昨日,最近7天,最近30天] if(!empty($where['timeType'])) { if($where['timeType'] == 'day') { $query->whereDay('mo.time'); } if($where['timeType'] == 'yesterday') { $query->whereDay('mo.time','yesterday'); } if($where['timeType'] == 'last7') { $query->whereTime('mo.time','-7 day'); } if($where['timeType'] == 'last30') { $query->whereTime('mo.time','-30 day'); } } }) ->order($desc) ->paginate(['list_rows' => $pageCount, 'page' => $page]) ->toArray(); return [$data['total'], $data['data']]; } }