105 lines
2.9 KiB
PHP
Raw Normal View History

2025-05-20 16:33:23 +08:00
<?php
namespace app\api\controller\home;
use app\common\model\home\RecruitmentInformation as RecruitmentInformationModel;
use app\common\model\home\RecruitmentInformationCate;
/**
* 招聘信息接口
*/
class RecruitmentInformation extends Base
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* @var \app\common\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);
}
/**
* @ApiTitle( 招聘信息分类)
* @ApiSummary(招聘信息分类)
* @ApiMethod(GET)
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiReturn({
*
*})
*/
public function cate()
{
$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); //条数
try{
//当前申请状态
$res = RecruitmentInformationCate::allList($page, $limit);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
}