1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace app\index\model;
- class ProductOrderModel extends BaseModel
- {
- protected $table='order';
- protected $connection = 'db_mall';
- public function getProductOrder($where){
- $list = $this->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();
- }
- }
|