💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
多个条件并行查询 ~~~ //已完成 $where1 = [ 'user_id' => ['in',$childUserIdArr], 'prom_type' => ['<',5], 'order_status' => 4 ]; //待收货 $where2 = [ 'user_id' => ['in',$childUserIdArr], 'prom_type' => ['<',5], 'order_status' => 1 , 'shipping_status' => 1 ]; //待发货 $where3 = [ 'user_id' => ['in',$childUserIdArr], 'prom_type' => ['<',5], 'order_status' => ['in',[0,1]] , 'shipping_status' => ['neq',1] , 'pay_status' => 1 , ]; $totalAmount = $orderModel ->whereOr(function ($query) use ($where1){ $query->where($where1); }) ->whereOr(function ($query) use ($where2){ $query->where($where2); }) ->whereOr(function ($query) use ($where3){ $query->where($where3); }) ->sum('total_amount'); 生成的sql:SELECT * FROM `tp_order` WHERE ( `user_id` IN (4,3,2,11,10,9,8,7,6,5) AND `prom_type` < 5 AND `order_status` = 4 ) OR ( `user_id` IN (4,3,2,11,10,9,8,7,6,5) AND `prom_type` < 5 AND `order_status` = 1 AND `shipping_status` = 1 ) OR ( `user_id` IN (4,3,2,11,10,9,8,7,6,5) AND `prom_type` < 5 AND `order_status` IN (0,1) AND `shipping_status` <> 1 AND `pay_status` = 1 ) ~~~