添加商学院详情获取

This commit is contained in:
wangxiaowei 2024-09-21 15:43:36 +08:00
parent 7796b00bd8
commit daba5bd2f2
2 changed files with 19 additions and 1 deletions

@ -35,7 +35,7 @@ class BusinessSchool extends Api
public function detail()
{
$id = $this->request->get('id');
$detail = ArticleLogic::detail($id);
$detail = BusinessSchoolLogic::detail($id);
return JsonServer::success('获取成功', $detail);
}
}

@ -8,6 +8,7 @@ use app\common\model\BusinessSchoolCategory;
class BusinessSchoolLogic extends Logic
{
// 获取分类
public static function category()
{
try {
@ -21,6 +22,7 @@ class BusinessSchoolLogic extends Logic
}
}
// 获取列表
public static function lists($get)
{
try {
@ -67,4 +69,20 @@ class BusinessSchoolLogic extends Logic
return ['error'=>$e->getMessage()];
}
}
// 获取详情
public static function detail($id)
{
$article = BusinessSchool::field('id, title, intro, create_time, visit, content')->where([
'id' => $id,
'del' => 0,
'is_show' => 1
])->findOrEmpty();
if($article->isEmpty()) {
$article = [];
}else{
$article = $article->toArray();
}
return $article;
}
}