2024-11-07 18:11:08 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\api\controller\school;
|
|
|
|
|
|
|
|
|
|
use app\common\model\school\classes\Teacher as Teachermodel;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 教师接口
|
|
|
|
|
*/
|
|
|
|
|
class Teacher extends Base
|
|
|
|
|
{
|
2024-11-16 18:01:16 +08:00
|
|
|
|
protected $noNeedLogin = ["detail",'people','spec',"teacher_list"];
|
2024-11-07 18:11:08 +08:00
|
|
|
|
protected $noNeedRight = '*';
|
|
|
|
|
|
|
|
|
|
protected $model = null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 初始化操作
|
|
|
|
|
* @access protected
|
|
|
|
|
*/
|
|
|
|
|
protected function _initialize()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$this->model = new Teachermodel;
|
|
|
|
|
parent::_initialize();
|
|
|
|
|
|
|
|
|
|
//判断登录用户是否是员工
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ApiTitle( 老师详情)
|
|
|
|
|
* @ApiSummary(老师详情)
|
|
|
|
|
* @ApiRoute(/api/school/teacher/detail)
|
|
|
|
|
* @ApiMethod(GET)
|
|
|
|
|
* @ApiParams(name = "id", type = "int",required=true,description = "老师id")
|
|
|
|
|
* @ApiReturn({
|
|
|
|
|
*
|
|
|
|
|
*})
|
|
|
|
|
*/
|
|
|
|
|
public function detail(){
|
|
|
|
|
$id = $this->request->get('id/d','');
|
|
|
|
|
|
|
|
|
|
if(empty($id)){
|
|
|
|
|
$this->error(__('缺少必要参数'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$res = $this->model->detail($id);
|
|
|
|
|
} catch (\Exception $e){
|
|
|
|
|
// Log::log($e->getMessage());
|
|
|
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
|
|
|
}
|
|
|
|
|
$this->success('获取成功', ['detail' => $res]);
|
|
|
|
|
}
|
2024-11-16 18:01:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ApiTitle( 老师或专家列表(取决于搜索条件))
|
|
|
|
|
* @ApiSummary(老师或专家列表(取决于搜索条件))
|
|
|
|
|
* @ApiRoute(/api/school/teacher/teacher_list)
|
|
|
|
|
* @ApiMethod(GET)
|
|
|
|
|
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
|
|
|
|
|
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
|
|
|
|
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
|
|
|
|
* @ApiParams(name = "status", type = "string",required=false,description = "查展示专家请传1,非专家也查请传0")
|
|
|
|
|
* @ApiParams(name = "recommend", type = "string",required=false,description = "平台首页推荐:0=否,1=是")
|
|
|
|
|
* @ApiParams(name = "shop_id", type = "string",required=false,description = "机构店铺id")
|
|
|
|
|
* @ApiParams(name = "user_id", type = "string",required=false,description = "教师用户id")
|
|
|
|
|
* @ApiReturn({
|
|
|
|
|
*
|
|
|
|
|
*})
|
|
|
|
|
*/
|
|
|
|
|
public function teacher_list()
|
|
|
|
|
{
|
|
|
|
|
$user_id = 0;
|
|
|
|
|
$user = $this->auth->getUser();//登录用户
|
|
|
|
|
if($user)$user_id = $user['id'];
|
|
|
|
|
$params=[];
|
|
|
|
|
$page = $this->request->get('page/d', 0); //页数
|
|
|
|
|
$limit = $this->request->get('limit/d', 0); //条数
|
|
|
|
|
$params['keywords'] = $this->request->get('keywords/s', ''); //搜索关键字
|
|
|
|
|
$params['status'] = $this->request->get('status/s', ''); //搜索关键字
|
|
|
|
|
$params['recommend'] = $this->request->get('recommend/s', ''); //搜索关键字
|
|
|
|
|
$params['shop_id'] = $this->request->get('shop_id/d', ''); //搜索关键字
|
|
|
|
|
$params['user_id'] = $this->request->get('user_id/d', ''); //搜索关键字
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
//当前申请状态
|
|
|
|
|
$res = $this->model::allList($page, $limit,$params);
|
|
|
|
|
// if($user_id =='670153'){
|
|
|
|
|
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
|
|
|
|
// }
|
|
|
|
|
}catch (\Exception $e){
|
|
|
|
|
|
|
|
|
|
$this->error($e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
$this->success('查询成功', $res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-11-07 18:11:08 +08:00
|
|
|
|
}
|
|
|
|
|
|