190 lines
5.3 KiB
PHP
190 lines
5.3 KiB
PHP
<?php
|
|
|
|
namespace app\adminapi\controller\home;
|
|
|
|
use app\common\controller\AdminApi;
|
|
use app\adminapi\model\home\RecruitmentInformationCate as RecruitmentInformationCateModel;
|
|
|
|
|
|
|
|
/**
|
|
* 招聘分类管理
|
|
*/
|
|
class RecruitmentInformationCate extends AdminApi
|
|
{
|
|
protected $model = null;
|
|
|
|
/**
|
|
* 初始化操作
|
|
* @access protected
|
|
*/
|
|
public function _initialize()
|
|
{
|
|
$this->model = new RecruitmentInformationCateModel;
|
|
parent::_initialize();
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @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 = "status", type = "string",required=true,description = "状态:1=上架,2=下架")
|
|
* @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); //条数
|
|
$params = [];
|
|
|
|
$params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
|
|
$params["status"] = $this->request->get('status/s', ''); //搜索关键字
|
|
// $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);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 查看招聘分类详情
|
|
*
|
|
* @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 = "status", type = "string",required=true,description = "状态:1=上架,2=下架")
|
|
* @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["status"] = $this->request->post('status/s', ''); //课程标签
|
|
|
|
$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_cate/edit/ids/{ids})
|
|
* @ApiParams (name="ids", type="string", required=true, description="需要编辑的id")
|
|
* @ApiParams(name = "name", type = "int",required=true,description = "类目名")
|
|
* @ApiParams(name = "status", type = "string",required=true,description = "状态:1=上架,2=下架")
|
|
* @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["status"] = $this->request->post('status/s', ''); //课程标签
|
|
|
|
$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);
|
|
}
|
|
|
|
|
|
|
|
|
|
} |