|
@@ -615,23 +615,33 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
|
|
|
public function getWebsiteModelCategory(array $data): array
|
|
|
{
|
|
|
- $website_id = [
|
|
|
- 'website_id' => $data['website_id'],
|
|
|
+ $website_id=[
|
|
|
+ 'website_category.website_id' => $data['website_id']
|
|
|
];
|
|
|
- $placeid = $data['placeid'] - 1;
|
|
|
- $pid = [
|
|
|
- 'pid' => $data['pid'],
|
|
|
+ $placeid=$data['placeid']-1;
|
|
|
+ $pid=[
|
|
|
+ 'website_category.pid' => $data['pid'],
|
|
|
];
|
|
|
+ var_dump( "=======",$pid);
|
|
|
$num = $data['num'];
|
|
|
- $result = WebsiteCategory::where($website_id)->where($pid)->withCount(['children' => function ($query) use ($website_id) {
|
|
|
+ // return Result::success($data);
|
|
|
+ $result=WebsiteCategory::where($website_id)
|
|
|
+ ->leftJoin("category",'website_category.category_id','category.id')
|
|
|
+ ->select('website_category.*','category.is_url','category.web_url')
|
|
|
+ ->where($pid)
|
|
|
+ ->withCount(['children' => function ($query) use ($website_id) {
|
|
|
$query->where($website_id);
|
|
|
- }])->orderBy('sort')->offset($placeid)->limit($num)->get();
|
|
|
-
|
|
|
- if (!empty($result)) {
|
|
|
- return Result::success($result);
|
|
|
- } else {
|
|
|
- return Result::error("本网站暂无栏目", 0);
|
|
|
- }
|
|
|
+ }])
|
|
|
+ ->orderBy('website_category.sort')
|
|
|
+
|
|
|
+ ->offset($placeid)
|
|
|
+ ->limit($num)->get();
|
|
|
+ return Result::success($result);
|
|
|
+ if(!empty($result)){
|
|
|
+ return Result::success($result);
|
|
|
+ }else{
|
|
|
+ return Result::error("本网站暂无栏目",0);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|