CartModel.php 580 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Author: luzheng.liu
  4. * Time: 2021/4/1 14:34
  5. */
  6. namespace app\api\model;
  7. use app\common\until\Until;
  8. class CartModel extends BaseModel {
  9. const NORMAL = 1;
  10. protected $table = 'cart';
  11. public function getCartList() {
  12. $rs = $this->alias('c')
  13. ->field('cp.product_id,cp.num,p.product_name,p.current_price')
  14. ->join('cart_product cp', 'cp.cart_id = c.id')
  15. ->join('product p','p.id = cp.product_id')
  16. ->where($this->getWhere())
  17. ->select();
  18. return Until::modelToArray($rs);
  19. }
  20. }