From 6af2eb430c6b318493a3d36d093f4dc78da7d48d Mon Sep 17 00:00:00 2001 From: weizong song Date: Thu, 11 Mar 2021 00:40:23 +0800 Subject: [PATCH] up --- app/Http/Controllers/Customer/OrdersController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/Customer/OrdersController.php b/app/Http/Controllers/Customer/OrdersController.php index 8ed3996..a43566d 100644 --- a/app/Http/Controllers/Customer/OrdersController.php +++ b/app/Http/Controllers/Customer/OrdersController.php @@ -50,6 +50,8 @@ class OrdersController extends CommonController }]) ->where("project_id", $id) ->select("id", "name", "project_id") + ->addSelect(DB::raw("select * from (select sum(max_price) as max_total,product_id from (select max(price) as max_price,product.id as product_id from product inner join factor on factor.product_id = product.id inner join factor_items on factor.id = factor_items.factor_id group by factor_items.factor_id) as a group by a.product_id) as b")) + ->leftJoin("b","product.id","=","b.product_id") ->orderBy("myindex") ->first(); return response()->json($product->toArray());