添加商学院分类获取
This commit is contained in:
parent
9f52af49ee
commit
d809be4dbd
41
app/api/controller/BusinessSchool.php
Executable file
41
app/api/controller/BusinessSchool.php
Executable file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\BusinessSchoolLogic;
|
||||
use app\common\basics\Api;
|
||||
use app\common\server\JsonServer;
|
||||
|
||||
class BusinessSchool extends Api
|
||||
{
|
||||
// 文章分类
|
||||
public function category()
|
||||
{
|
||||
$lists = BusinessSchoolLogic::category();
|
||||
return JsonServer::success('获取成功', $lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Notes: 文章列表
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$get['page_no'] = $this->page_no;
|
||||
$get['page_size'] = $this->page_size;
|
||||
$lists = ArticleLogic::lists($get);
|
||||
return JsonServer::success('获取成功', $lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Notes: 文章详细
|
||||
* @Author: 张无忌
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$detail = ArticleLogic::detail($id);
|
||||
return JsonServer::success('获取成功', $detail);
|
||||
}
|
||||
}
|
||||
25
app/api/logic/BusinessSchoolLogic.php
Normal file
25
app/api/logic/BusinessSchoolLogic.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\logic;
|
||||
|
||||
use app\common\basics\Logic;
|
||||
use app\common\model\BusinessSchool;
|
||||
use app\common\model\BusinessSchoolCategory;
|
||||
|
||||
class BusinessSchoolLogic extends Logic
|
||||
{
|
||||
public static function category()
|
||||
{
|
||||
try {
|
||||
$model = new BusinessSchoolCategory();
|
||||
return $model->field(['id', 'name'])
|
||||
->where([
|
||||
['del', '=', 0],
|
||||
['is_show', '=', 1]
|
||||
])->order('order asc')->select()->toArray();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return ['error'=>$e->getMessage()];
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user