|
|
@ -1496,35 +1496,6 @@ if (!function_exists('getOtherCategoryCategoryId')) { |
|
|
if (empty($siblingCates)) { |
|
|
if (empty($siblingCates)) { |
|
|
return []; |
|
|
return []; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 4. 查询每个分类下最新一条内容
|
|
|
|
|
|
$cateSubModel = new \app\model\CategorySubContent(); |
|
|
|
|
|
$subContentModel = new \app\model\SubContent(); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($siblingCates as &$cate) { |
|
|
|
|
|
$cateSubIds = $cateSubModel->where('category_id', $cate['id']) |
|
|
|
|
|
->where('seller_id', $sellerId) |
|
|
|
|
|
->column('sub_content_id'); |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($cateSubIds)) { |
|
|
|
|
|
$content = $subContentModel->whereIn('id', $cateSubIds) |
|
|
|
|
|
->where('seller_id', $sellerId) |
|
|
|
|
|
->where('is_del', 1) |
|
|
|
|
|
->with(['thumbnail' => function ($query) { |
|
|
|
|
|
$query->field('id,name,url,type'); |
|
|
|
|
|
}]) |
|
|
|
|
|
->field('id,title,description') |
|
|
|
|
|
->order('publish_time desc') |
|
|
|
|
|
->limit($limit) |
|
|
|
|
|
->select() |
|
|
|
|
|
->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
$cate['articles'] = $content; |
|
|
|
|
|
} else { |
|
|
|
|
|
$cate['articles'] = []; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $siblingCates; |
|
|
return $siblingCates; |
|
|
} catch (\Exception $e) { |
|
|
} catch (\Exception $e) { |
|
|
return []; |
|
|
return []; |
|
|
|