|
@@ -513,27 +513,26 @@ class WebsiteService implements WebsiteServiceInterface
|
|
public function getWebsiteAdvertisement(array $data): array
|
|
public function getWebsiteAdvertisement(array $data): array
|
|
{
|
|
{
|
|
$where = [
|
|
$where = [
|
|
- 'website_id' => $data['website_id'],
|
|
|
|
'ad_place.status' => 1,
|
|
'ad_place.status' => 1,
|
|
- // 'ad.status' => 1,
|
|
|
|
];
|
|
];
|
|
if (isset($data['ad_tag']) && !empty($data['ad_tag'])) {
|
|
if (isset($data['ad_tag']) && !empty($data['ad_tag'])) {
|
|
$now = Carbon::now()->format('Y-m-d H:i:s'); // 获取当前时间
|
|
$now = Carbon::now()->format('Y-m-d H:i:s'); // 获取当前时间
|
|
- $where[] = ['ad_place.ad_tag', 'like', '%' . $data['ad_tag'] . '%'];
|
|
|
|
- $result = AdPlace::where($where)
|
|
|
|
- ->leftJoin("ad", function ($join) use ($now) {
|
|
|
|
- $join->on("ad.pid", "=", "ad_place.id")
|
|
|
|
- ->where('ad.status', 1)
|
|
|
|
- ->where('ad.fromtime', '<=', $now)
|
|
|
|
- ->where('ad.totime', '>=', $now);
|
|
|
|
- })
|
|
|
|
- ->select("ad_place.*", 'ad.*', "ad_place.id as ad_place_id", "ad.name as ad_name")
|
|
|
|
- ->get()->all();
|
|
|
|
- if (empty($result)) {
|
|
|
|
- return Result::error("此广告位不存在!", 0);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- return Result::error("请选择广告位!", 0);
|
|
|
|
|
|
+ $where[] = ['ad_place.ad_tag','like','%'.$data['ad_tag'].'%'];
|
|
|
|
+ // return Result::success($where);
|
|
|
|
+ $result = AdPlace::where($where)
|
|
|
|
+ ->leftJoin("ad", function ($join) use ($now) {
|
|
|
|
+ $join->on("ad.pid", "=", "ad_place.id")
|
|
|
|
+ ->where('ad.status', 1)
|
|
|
|
+ ->where('ad.fromtime', '<=', $now)
|
|
|
|
+ ->where('ad.totime', '>=', $now);
|
|
|
|
+ })
|
|
|
|
+ ->select("ad_place.*",'ad.*',"ad_place.id as ad_place_id","ad.name as ad_name")
|
|
|
|
+ ->get()->all();
|
|
|
|
+ if(empty($result)){
|
|
|
|
+ return Result::error("此广告位不存在!",0);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ return Result::error("请选择广告位!",0);
|
|
}
|
|
}
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
|
|
|
|
@@ -1482,13 +1481,17 @@ class WebsiteService implements WebsiteServiceInterface
|
|
if (isset($data['website_id']) && !empty($data['website_id'])) {
|
|
if (isset($data['website_id']) && !empty($data['website_id'])) {
|
|
$website = Website::where('id', $data['website_id'])->where('status', 1)->first();
|
|
$website = Website::where('id', $data['website_id'])->where('status', 1)->first();
|
|
if (empty($website)) {
|
|
if (empty($website)) {
|
|
- return Result::error("暂无该网站", 0);
|
|
|
|
|
|
+
|
|
|
|
+ return Result::error("暂无该网站",0);
|
|
}
|
|
}
|
|
$category = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$data['category_id'])->first();
|
|
$category = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$data['category_id'])->first();
|
|
if (empty($category)) {
|
|
if (empty($category)) {
|
|
return Result::error("暂无此导航",0);
|
|
return Result::error("暂无此导航",0);
|
|
}
|
|
}
|
|
$category['children_count'] = WebsiteCategory::where('website_id',$data['website_id'])->where('pid',$data['category_id'])->count();
|
|
$category['children_count'] = WebsiteCategory::where('website_id',$data['website_id'])->where('pid',$data['category_id'])->count();
|
|
|
|
+ $parent = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$category['pid'])->select('category_id as parent_id','alias as parent_name')->first();
|
|
|
|
+ $category['parent_id'] = $parent['parent_id']?? '';
|
|
|
|
+ $category['parent_name'] = $parent['parent_name']?? '';
|
|
return Result::success($category);
|
|
return Result::success($category);
|
|
}else{
|
|
}else{
|
|
return Result::error("参数错误",0);
|
|
return Result::error("参数错误",0);
|