BuyCarModel.php 634 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace app\index\model;
  3. class BuyCarModel extends BaseModel
  4. {
  5. protected $table='buy_car';
  6. protected $connection = 'db_mall';
  7. /**
  8. * 购物车表联合产品表
  9. * @param $condition
  10. * @param $order
  11. * @return false|\PDOStatement|string|\think\Collection
  12. */
  13. public function getCarAndProductInfo($condition,$order='pro.category_id asc'){
  14. $list = $this->join('product pro','pro.product_id = buy_car.product_id','LEFT')
  15. ->field("buy_car.num as num,buy_car.id as buy_car_id,pro.*")
  16. ->where($condition)->order($order)->select();
  17. return $list;
  18. }
  19. }