laravel 连表查询 多表查询 leftjoin

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_25861247/article/details/87693188
// start查找订单中是特殊商品的 返现返现时间不是一年而是是自己控制的
   $speceal_order=\App\BaseOrderModel::leftjoin('ys_sub_order','ys_sub_order.base_id','=','ys_base_order.id')
     ->leftjoin('ys_order_goods','ys_sub_order.id','=','ys_order_goods.sub_id')
     ->leftjoin('ys_goods','ys_goods.id','=','ys_order_goods.goods_id')
     ->leftjoin('ys_goods_class','ys_goods_class.id','=','ys_goods.class_id')
      ->where('ys_base_order.state',1)
      ->where('ys_sub_order.receive_state',1)
      ->where('ys_sub_order.all_rebate','>',0)
      ->where('ys_sub_order.back_state',0)
      ->groupBy('ys_base_order.user_id')
       ->select('ys_order_goods.*','ys_goods.class_id','ys_goods_class.first_id')
       ->get();

       @file_put_contents($path.'/speceal_order.txt', print_r($speceal_order,true));
展开阅读全文

没有更多推荐了,返回首页