|
|
|
|
@ -88,16 +88,18 @@ class OrdersController extends CommonController
|
|
|
|
|
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
foreach($order_items as $order_item) {
|
|
|
|
|
if ($order_item->paid_at && $request->total != $order_item->total) {
|
|
|
|
|
foreach ($order_items as $order_item) {
|
|
|
|
|
if ($request->has("total") && $order_item->paid_at && $request->total != $order_item->total) {
|
|
|
|
|
return $this->error("子订单已扣款,不支持后台更改价格,请通过其他方法进行更改");
|
|
|
|
|
}
|
|
|
|
|
if ($order_item->total == 0 && $request->total != $order_item->total) {
|
|
|
|
|
if ($request->has("total") && $order_item->total == 0 && $request->total != $order_item->total) {
|
|
|
|
|
return $this->error("未服务子订单不支持后台更改价格,请通过其他方法进行更改");
|
|
|
|
|
}
|
|
|
|
|
$order_item->update([
|
|
|
|
|
"total" => $request->total
|
|
|
|
|
]);
|
|
|
|
|
if ($request->has("total")) {
|
|
|
|
|
$order_item->update([
|
|
|
|
|
"total" => $request->total
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
if ($request->factor_item) {
|
|
|
|
|
$factors = json_decode($order_item->factors, true);
|
|
|
|
|
foreach ($factors as &$factor) {
|
|
|
|
|
@ -114,10 +116,10 @@ class OrdersController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DB::commit();
|
|
|
|
|
return $this->success("处理成功".$total."条数据!");
|
|
|
|
|
return $this->success("处理成功" . $total . "条数据!");
|
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
return $this->error($exception->getMessage().$exception->getLine());
|
|
|
|
|
return $this->error($exception->getMessage() . $exception->getLine());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|