项目列表

This commit is contained in:
2025-05-07 22:44:15 +08:00
parent 61acb0de5a
commit 60faecae99
2 changed files with 33 additions and 1 deletions

View File

@@ -33,4 +33,19 @@ class HomeController extends BaseController
'轮播图列表'
);
}
/**
* 项目列表
* @Method GET
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function projectList(): JsonResponse
{
return jok(
$this->service->projectList(),
'项目列表'
);
}
}

View File

@@ -27,7 +27,7 @@ class HomeService extends BaseService
}
/**
* 获取项目列表
* 获取精选项目
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
@@ -50,6 +50,23 @@ class HomeService extends BaseService
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function projectList(): array
{
$this->where[] = [ 'status', '=', 1 ];
$this->with = [
'frameworks:id,name',
'labels:id,name',
'category:id,name',
];
return $this->getPageList();
}
/**
* 获取轮播图
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function carousel(): array
{
$this->where[] = [ 'is_carousel', '=', 1 ];