|
@@ -507,75 +507,6 @@ class OrderService implements OrderServiceInterface
|
|
|
// }
|
|
|
// //数组
|
|
|
|
|
|
- // $start = Carbon::parse($data['starttime']);
|
|
|
- // $end = Carbon::parse($data['endtime']);
|
|
|
- // $status = [
|
|
|
- // 0 => '1',
|
|
|
- // 1 => '4',
|
|
|
- // 2 => '6',
|
|
|
- // ];
|
|
|
- // //订单状态:1:通过;2:驳回;3:撤回;4:修改;5:过期;6:待审核;7:结束
|
|
|
- // $ads = Ad::where('fromtime', '<=', $start)->where('totime', '>=', $end)->select('pid')->get()->all();
|
|
|
- // $orderads = OrderAd::where('fromtime', '<=', $start)->where('totime', '>=', $end)->whereIn('status', $status)->select('pid')->get()->all();
|
|
|
- // $ads = array_column($ads, 'pid');
|
|
|
- // $orderads = array_column($orderads, 'pid');
|
|
|
- // $pids = array_merge($ads, $orderads);
|
|
|
- // var_dump($pids, '-----------1-------------');
|
|
|
- // //取出pid
|
|
|
- // $ad_pids = array_unique($pids);
|
|
|
- // var_dump($ad_pids, '----------3------------');
|
|
|
-
|
|
|
- // $placeids = AdPlace::whereNotIn('id', $ad_pids)->where($where)->select('id')->get()->all();
|
|
|
- // $ad_pids = array_column($placeids, 'id');
|
|
|
- // $rep = AdPlace::where($where)
|
|
|
- // ->whereIn('ad_place.id', $ad_pids)
|
|
|
- // ->where('ad_place.website_id', $data['website_id'])
|
|
|
- // ->leftJoin('website', 'ad_place.website_id', 'website.id')
|
|
|
- // ->leftJoin('ad_size', 'ad_place.ad_size_id', 'ad_size.id')
|
|
|
- // ->select('ad_place.*', 'website.website_name', 'website.id', 'ad_size.*')
|
|
|
- // ->selectSub('website.id', 'webid')
|
|
|
- // ->selectSub('ad_place.id', 'pid')
|
|
|
- // ->selectSub('ad_size.width', 'size_width')
|
|
|
- // ->selectSub('ad_size.height', 'size_height')
|
|
|
- // ->orderBy("website.id", "asc")
|
|
|
- // ->limit($data['pageSize'])
|
|
|
- // ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- // ->get();
|
|
|
- // $count = AdPlace::where($where)->where('ad_place.website_id', $data['website_id'])->whereIn('ad_place.id', $ad_pids)->count();
|
|
|
- // $startTime = strtotime($data['starttime']);
|
|
|
- // $endTime = strtotime($data['endtime']);
|
|
|
- // $time = ($endTime - $startTime) / (24 * 60 * 60);
|
|
|
- // $roundedValue = round($time, 2);
|
|
|
- // $days = number_format($roundedValue, 2, '.', '');
|
|
|
- // $result = [
|
|
|
- // 'rows' => $rep->toArray(),
|
|
|
- // 'count' => $count,
|
|
|
- // 'days' => $days,
|
|
|
- // ];
|
|
|
- // return Result::success($result);
|
|
|
-
|
|
|
- // //ad_size_id 必选改可选
|
|
|
- // //单选
|
|
|
- // if (isset($data['ad_size_id']) && is_string($data['ad_size_id'])) {
|
|
|
- // $where = [
|
|
|
- // 'ad_place.ad_size_id' => $data['ad_size_id'],
|
|
|
- // ];
|
|
|
- // }
|
|
|
- // //如果有website_id
|
|
|
- // if (!isset($data['ad_size_id'])) {
|
|
|
- // // $adsiteids = AdPlace::where('website_id', $data['website_id'])->select('id')->get()->all();
|
|
|
- // // $ad_pids = array_column($adsiteids, 'id');
|
|
|
- // // // $where = [
|
|
|
- // // // 'ad_place.ad_size_id' => $data['ad_size_id'],
|
|
|
- // // // ];
|
|
|
- // // var_dump($ad_pids, 'p--------------3-------');
|
|
|
- // // // $where[] = ['ad_place.id', 'in', $ad_pids];
|
|
|
- // // $where = [
|
|
|
- // // 'ad_place.website_id' => $data['website_id'],
|
|
|
- // // ];
|
|
|
- // }
|
|
|
- // //数组
|
|
|
-
|
|
|
// $start = Carbon::parse($data['starttime']);
|
|
|
// $end = Carbon::parse($data['endtime']);
|
|
|
// $status = [
|
|
@@ -604,8 +535,7 @@ class OrderService implements OrderServiceInterface
|
|
|
// $websiteIds = array_column($placeids, 'website_id');
|
|
|
// $website_id = array_unique($websiteIds);
|
|
|
// $rep = Website::whereIn('id', $website_id)->get();
|
|
|
-
|
|
|
- // $count = Website::whereIn('id', $website_id)->count();
|
|
|
+ // $count = Website::whereIn('id', $website_id)->count();
|
|
|
// //若不存在网站id参数直接返回符合条件的广告位相关联的网站名称
|
|
|
// } else {
|
|
|
// $place_id = [];
|
|
@@ -628,7 +558,6 @@ class OrderService implements OrderServiceInterface
|
|
|
// ->get();
|
|
|
// $count = AdPlace::where($where)->where('ad_place.website_id', $data['website_id'])->count();
|
|
|
// //若存在网站id,关联查询是需要添加website_id条件查询
|
|
|
-
|
|
|
// }
|
|
|
// } else {
|
|
|
// //若不存在有时间冲突的广告位则所有符合图片尺寸的广告位皆可以使用,只需要判断是否存在网站id参数即可
|
|
@@ -1032,4 +961,17 @@ class OrderService implements OrderServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取广告位的尺寸
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function getAdSize(): array
|
|
|
+ {
|
|
|
+ $result = AdSize::get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无数据");
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
}
|