|
@@ -516,7 +516,14 @@ class WebsiteService implements WebsiteServiceInterface
|
|
->where('ad.fromtime', '<=', $now)
|
|
->where('ad.fromtime', '<=', $now)
|
|
->where('ad.totime', '>=', $now);
|
|
->where('ad.totime', '>=', $now);
|
|
})
|
|
})
|
|
- ->select("ad_place.*",'ad.*',"ad_place.id as ad_place_id","ad.name as ad_name")
|
|
|
|
|
|
+ ->select(
|
|
|
|
+ 'ad_place.name as place_name',
|
|
|
|
+ 'ad_place.thumb',
|
|
|
|
+ 'ad_place.ad_tag',
|
|
|
|
+ 'ad.name as ad_name',
|
|
|
|
+ 'ad.image_src',
|
|
|
|
+ 'ad.image_url',
|
|
|
|
+ 'ad.image_alt')
|
|
->get()->all();
|
|
->get()->all();
|
|
if(empty($result)){
|
|
if(empty($result)){
|
|
return Result::error("此广告位不存在!",0);
|
|
return Result::error("此广告位不存在!",0);
|
|
@@ -2045,6 +2052,7 @@ class WebsiteService implements WebsiteServiceInterface
|
|
* */
|
|
* */
|
|
public function getWebsiteParentCategory(array $data): array
|
|
public function getWebsiteParentCategory(array $data): array
|
|
{
|
|
{
|
|
|
|
+ // return Result::success($data);
|
|
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();
|
|
}
|
|
}
|
|
@@ -2056,19 +2064,8 @@ class WebsiteService implements WebsiteServiceInterface
|
|
// 因此,需要先调用 `get()` 方法获取查询结果集合,再使用 `map` 方法进行处理。
|
|
// 因此,需要先调用 `get()` 方法获取查询结果集合,再使用 `map` 方法进行处理。
|
|
$category['parent'] = WebsiteCategory::where('website_id', $data['website_id'])
|
|
$category['parent'] = WebsiteCategory::where('website_id', $data['website_id'])
|
|
->where('pid', 0)
|
|
->where('pid', 0)
|
|
- ->select('aLIas_pinyin', 'category_id', 'alias')
|
|
|
|
|
|
+ ->selectRaw("category_id as cid, alias as name, CONCAT('/', '', aLIas_pinyin, '/') as path")
|
|
->get() // 添加 get() 方法获取结果集合
|
|
->get() // 添加 get() 方法获取结果集合
|
|
- ->map(function ($item) {
|
|
|
|
- $result = [
|
|
|
|
- 'name' => $item->alias,
|
|
|
|
- 'cid' => $item->category_id
|
|
|
|
- ];
|
|
|
|
- if (!empty($item->aLIas_pinyin)) {
|
|
|
|
- $result['path'] = "/{$item->aLIas_pinyin}/";
|
|
|
|
- }
|
|
|
|
- return $result;
|
|
|
|
- })
|
|
|
|
- ->values()
|
|
|
|
->all();
|
|
->all();
|
|
// } else if($data['id'] == 1){
|
|
// } else if($data['id'] == 1){
|
|
// 不使用 with 方法,直接查询父级栏目需要的字段
|
|
// 不使用 with 方法,直接查询父级栏目需要的字段
|
|
@@ -2094,21 +2091,6 @@ class WebsiteService implements WebsiteServiceInterface
|
|
return $result;
|
|
return $result;
|
|
})->values()->all();
|
|
})->values()->all();
|
|
// }else if($data['id'] == 2){
|
|
// }else if($data['id'] == 2){
|
|
- $foot = FooterCategory::where('website_id', $data['website_id'])
|
|
|
|
- ->get();
|
|
|
|
- $category['foot'] = $foot->map(function ($item) {
|
|
|
|
- $name = $item->name;
|
|
|
|
- $id = $item->id;
|
|
|
|
- $alias_pinyin = $item->name_pinyin;
|
|
|
|
- $result = [
|
|
|
|
- 'name' => $name,
|
|
|
|
- 'cid' => $id
|
|
|
|
- ];
|
|
|
|
- if (!empty($alias_pinyin)) {
|
|
|
|
- $result['path'] = "/{$alias_pinyin}/";
|
|
|
|
- }
|
|
|
|
- return $result;
|
|
|
|
- })->values()->all();
|
|
|
|
// }else{
|
|
// }else{
|
|
// return Result::error("请输入正确的id", 0);
|
|
// return Result::error("请输入正确的id", 0);
|
|
// }
|
|
// }
|