201 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			201 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace app\adminapi\controller\home;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use app\common\controller\AdminApi;
							 | 
						||
| 
								 | 
							
								use app\adminapi\model\home\RecruitmentInformation as RecruitmentInformationModel;
							 | 
						||
| 
								 | 
							
								use app\adminapi\model\home\RecruitmentInformationCate;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 招聘信息管理
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								class RecruitmentInformation extends AdminApi
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @var \app\adminapi\model\home\RecruitmentInformation
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    protected $model = null;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public function _initialize()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        parent::_initialize();
							 | 
						||
| 
								 | 
							
								        $this->model = new RecruitmentInformationModel;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle( 招聘信息列表)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(招聘信息列表)
							 | 
						||
| 
								 | 
							
								     * @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 = "recommend", type = "string",required=false,description = "置顶:0=否,1=是")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "cate_id", type = "int",required=false,description = "职位分类id")
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function index()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $user_id = 0;
							 | 
						||
| 
								 | 
							
								        $user = $this->auth->getUser();//登录用户
							 | 
						||
| 
								 | 
							
								        if($user)$user_id = $user['id'];
							 | 
						||
| 
								 | 
							
								        $page  =  $this->request->get('page/d', 0); //页数
							 | 
						||
| 
								 | 
							
								        $limit =  $this->request->get('limit/d', 0); //条数
							 | 
						||
| 
								 | 
							
								        $keywords =  $this->request->get('keywords/s', ''); //搜索关键字
							 | 
						||
| 
								 | 
							
								        $recommend =  $this->request->get('recommend/s', ''); //搜索关键字
							 | 
						||
| 
								 | 
							
								//        $params =[];
							 | 
						||
| 
								 | 
							
								        $cate_id =  $this->request->get('cate_id/s', ''); //搜索关键字
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//        $type =  $this->request->get('type/s', ''); //筛选学员和教练单
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            //当前申请状态
							 | 
						||
| 
								 | 
							
								            $res = $this->model::allList($page, $limit,$keywords,$recommend,$cate_id,[]);
							 | 
						||
| 
								 | 
							
								//             var_dump($this->model->getLastSql());
							 | 
						||
| 
								 | 
							
								        }catch (\Exception $e){
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $this->success('查询成功', $res);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 查看招聘信息详情
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @ApiMethod (GET)
							 | 
						||
| 
								 | 
							
								     * @ApiParams (name="id", type="string", required=true, description="ID")
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function detail()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $admin_id = $this->auth->id;
							 | 
						||
| 
								 | 
							
								        $id = $this->request->get('id/d');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            $menulist = $this->model->detail($id,$show_field=[],$except_field=[]);
							 | 
						||
| 
								 | 
							
								        } catch (\Exception $e) {
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->success('查询成功', $menulist);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 删除招聘信息
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @ApiMethod (POST)
							 | 
						||
| 
								 | 
							
								     * @ApiParams (name="ids", type="string", required=true, description="要删除的ids")
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function del()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								//        $admin_id = $this->auth->id;
							 | 
						||
| 
								 | 
							
								        $ids = $this->request->post('ids/s');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            $menulist = $this->model->del($ids,true);
							 | 
						||
| 
								 | 
							
								        } catch (\Exception $e) {
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->success('删除成功', $menulist);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle(添加招聘信息)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(添加招聘信息)
							 | 
						||
| 
								 | 
							
								     * @ApiMethod(POST)
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "name", type = "int",required=true,description = "职位名称")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "recommend", type = "string",required=false,description = "置顶:0=否,1=是")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "cate_id", type = "int",required=false,description = "职位分类id")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "weigh", type = "string",required=false,description = "权重")
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function add(){
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//        $user_id = 73;
							 | 
						||
| 
								 | 
							
								//        $user = $this->auth->getUser();//登录用户
							 | 
						||
| 
								 | 
							
								//        if($user)$user_id = $user['id'];
							 | 
						||
| 
								 | 
							
								        $params = [];
							 | 
						||
| 
								 | 
							
								//        $params["user_id"]  = $user_id; //老师id
							 | 
						||
| 
								 | 
							
								        $params["name"] =  $this->request->post('name/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $params["recommend"] =  $this->request->post('recommend/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $params["cate_id"] =  $this->request->post('cate_id/s', ''); //老师id
							 | 
						||
| 
								 | 
							
								        $params["weigh"] =  $this->request->post('weigh/s', ''); //老师id
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            $res = $this->model->add($params,true);
							 | 
						||
| 
								 | 
							
								        }catch (\Throwable $e){
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $this->success('添加成功', $res);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle(编辑招聘信息)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(编辑招聘信息)
							 | 
						||
| 
								 | 
							
								     * @ApiMethod(POST)
							 | 
						||
| 
								 | 
							
								     * @ApiRoute    (/adminapi/home.recruitment_information/edit/ids/{ids})
							 | 
						||
| 
								 | 
							
								     * @ApiParams (name="ids", type="string", required=true, description="需要编辑的id")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "name", type = "int",required=true,description = "职位名称")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "recommend", type = "string",required=false,description = "置顶:0=否,1=是")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "cate_id", type = "int",required=false,description = "职位分类id")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "weigh", type = "string",required=false,description = "权重")
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function edit($ids = null){
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//        $user_id = 73;
							 | 
						||
| 
								 | 
							
								//        $user = $this->auth->getUser();//登录用户
							 | 
						||
| 
								 | 
							
								//        if($user)$user_id = $user['id'];
							 | 
						||
| 
								 | 
							
								        $params = [];
							 | 
						||
| 
								 | 
							
								//        $params["user_id"]  = $user_id; //老师id
							 | 
						||
| 
								 | 
							
								        $params["name"] =  $this->request->post('name/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $params["recommend"] =  $this->request->post('recommend/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $params["cate_id"] =  $this->request->post('cate_id/s', ''); //老师id
							 | 
						||
| 
								 | 
							
								        $params["weigh"] =  $this->request->post('weigh/s', ''); //老师id
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            $res = $this->model->edit($ids,$params,true);
							 | 
						||
| 
								 | 
							
								        }catch (\Throwable $e){
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $this->success('编辑成功', $res);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |