diff --git a/app/Models/Orders.php b/app/Models/Orders.php index c161e43..ae602e4 100755 --- a/app/Models/Orders.php +++ b/app/Models/Orders.php @@ -396,8 +396,9 @@ class Orders extends SoftDeletesModel //价格运算 $factors = (new Orders())->requestFactorsToOrderFactors(); + $product = (new Project())->find($bed->project_id)->products->first(); foreach ($paramedics as $paramedic) { - $product_item = ProductItems::where("patient_quantity", "<=", $paramedic->ongoing_orders_count + 1)->orderBy("patient_quantity", "desc")->first(); + $product_item = ProductItems::where("product_id", $product->id)->where("patient_quantity", "<=", $paramedic->ongoing_orders_count + 1)->orderBy("patient_quantity", "desc")->first(); $price = $paramedic->levelInProject->price + $product_item->price; foreach ($factors as $factor) { $price += $factor["price"]; @@ -418,7 +419,7 @@ class Orders extends SoftDeletesModel $recharge = Recharge::where("order_id", $this->id) ->whereNotNull("paid_at") ->whereIn("payment", ["weixin", "alipay"]) - ->where("money",">=",$amount) + ->where("money", ">=", $amount) ->doesntHave("refunds") ->orderBy("id", "desc") ->first();