|
|
@@ -1042,4 +1042,41 @@ class OrderService implements OrderServiceInterface
|
|
|
}
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
+ public function checkWebsiteOrder(array $data): array
|
|
|
+ {
|
|
|
+ $websiteid = $data['website_id'] ?? 0;
|
|
|
+
|
|
|
+ //取出id来
|
|
|
+ $order_id = Order::where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->pluck('id');
|
|
|
+ var_dump($order_id == false, '----------2---------');
|
|
|
+ var_dump($order_id->isEmpty(), '---------3----------');
|
|
|
+ if ($order_id->isEmpty()) {
|
|
|
+ return Result::error("无正在进行的订单");
|
|
|
+ }
|
|
|
+ return Result::success($order_id);
|
|
|
+ }
|
|
|
+ public function batchDelWebsiteOrder(array $data): array
|
|
|
+ {
|
|
|
+ // 批量删除订单
|
|
|
+ $orderIds = $data['ids'] ?? [];
|
|
|
+ if (empty($orderIds)) {
|
|
|
+ return Result::error("没有选择订单");
|
|
|
+ }
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ // 删除订单
|
|
|
+ Order::whereIn('id', $orderIds)->delete();
|
|
|
+ // 删除订单广告
|
|
|
+ OrderAd::whereIn('order_id', $orderIds)->delete();
|
|
|
+ // 删除广告
|
|
|
+ Ad::whereIn('order_id', $orderIds)->delete();
|
|
|
+ Db::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("操作失败:" . $e->getMessage());
|
|
|
+ }
|
|
|
+ return Result::success("操作成功");
|
|
|
+ }
|
|
|
}
|