where($where)->select(); if(!$list){ return []; } foreach($list as &$item){ $productOrderDetailModel = new ProductOrderDetailModel(); $productOrderDetail = $productOrderDetailModel->field('order_detail.*,product.product_name')->join("product","product.product_id = order_detail.product_id",'left')->where(['order_no'=>$item['order_no']])->select(); $item['detail'] = $productOrderDetail; } return $list; } /** * 求条件下的订单数量 * @param $where * @return int|string */ public function getProductOrderCount($where){ return $this->where($where)->count(); } }