You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
236 lines
7.0 KiB
236 lines
7.0 KiB
<?php
|
|
|
|
|
|
namespace app\admin\controller\job;
|
|
|
|
|
|
use app\admin\logic\job\JobCateLogic;
|
|
use app\admin\logic\job\JobIndustryLogic;
|
|
use app\admin\logic\job\JobLogic;
|
|
use app\admin\logic\job\JobSalaryLogic;
|
|
use app\common\basics\AdminBase;
|
|
use app\common\server\AreaServer;
|
|
use app\common\server\JsonServer;
|
|
|
|
class Job extends AdminBase
|
|
{
|
|
/**
|
|
* @NOTES: 帮助分类列表
|
|
* @author: 张无忌
|
|
*/
|
|
public function lists()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$get = $this->request->get();
|
|
$lists = JobLogic::lists($get);
|
|
return JsonServer::success("获取成功", $lists);
|
|
}
|
|
|
|
return view('', [
|
|
'cates' => JobCateLogic::getCate(),
|
|
'industrys' => JobIndustryLogic::getIndustry(),
|
|
'salarys' => JobSalaryLogic::getSalary(),
|
|
'education' => JobLogic::getEducation(),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @NOTES: 添加帮助类
|
|
* @author: 张无忌
|
|
*/
|
|
public function add()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$res = JobLogic::add($post);
|
|
if ($res === false) {
|
|
$error = JobLogic::getError() ?: '新增失败';
|
|
return JsonServer::error($error);
|
|
}
|
|
return JsonServer::success('新增成功');
|
|
}
|
|
|
|
|
|
return view('', [
|
|
'cates' => JobCateLogic::getCate(),
|
|
'industrys' => JobIndustryLogic::getIndustry(),
|
|
'salarys' => JobSalaryLogic::getSalary(),
|
|
'educations' => JobLogic::getEducation(),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @NOTES: 编辑帮助分类
|
|
* @author: 张无忌
|
|
*/
|
|
public function edit()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$res = JobLogic::edit($post);
|
|
if ($res === false) {
|
|
$error = JobLogic::getError() ?: '编辑失败';
|
|
return JsonServer::error($error);
|
|
}
|
|
return JsonServer::success('编辑成功');
|
|
}
|
|
|
|
|
|
$id = $this->request->get('id');
|
|
$detail = JobLogic::detail($id);
|
|
$category2 = [];
|
|
$salary2 = [];
|
|
$industry2 = [];
|
|
if($detail['cate_id']>0){
|
|
$category2 = JobCateLogic::getCate($detail['cate_id']);
|
|
}
|
|
if($detail['industry_id']>0){
|
|
$industry2 = JobIndustryLogic::getIndustry($detail['industry_id']);
|
|
}
|
|
if($detail['salary_id']>0){
|
|
$salary2 = JobSalaryLogic::getSalary($detail['salary_id']);
|
|
}
|
|
return view('', [
|
|
'detail' => $detail,
|
|
'cates' => JobCateLogic::getCate(),
|
|
'industrys' => JobIndustryLogic::getIndustry(),
|
|
'salarys' => JobSalaryLogic::getSalary(),
|
|
'educations' => JobLogic::getEducation(),
|
|
'cate2' => $category2,
|
|
'industry2' => $industry2,
|
|
'salary2' => $salary2,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @NOTES: 删除帮助分类
|
|
* @author: 张无忌
|
|
*/
|
|
public function del()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$id = $this->request->post('id');
|
|
$res = JobLogic::del($id);
|
|
if ($res === false) {
|
|
$error = JobLogic::getError() ?: '删除失败';
|
|
return JsonServer::error($error);
|
|
}
|
|
return JsonServer::success('删除成功');
|
|
}
|
|
|
|
return JsonServer::error('异常');
|
|
}
|
|
|
|
/**
|
|
* @Notes: 隐藏帮助分类
|
|
* @Author: 张无忌
|
|
*/
|
|
public function hide()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$id = $this->request->post('id');
|
|
$res = JobLogic::hide($id);
|
|
if ($res === false) {
|
|
$error = JobLogic::getError() ?: '操作失败';
|
|
return JsonServer::error($error);
|
|
}
|
|
return JsonServer::success('操作成功');
|
|
}
|
|
|
|
return JsonServer::success('异常');
|
|
}
|
|
|
|
/**
|
|
* @notes 审核文章
|
|
* @return \think\response\Json|\think\response\View
|
|
* @author 段誉
|
|
* @date 2022/5/10 17:45
|
|
*/
|
|
public function audit()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$result = JobLogic::audit($post);
|
|
if (false === $result) {
|
|
return JsonServer::error(JobLogic::getError() ?: '操作失败');
|
|
}
|
|
return JsonServer::success('编辑成功');
|
|
}
|
|
$id = $this->request->get('id');
|
|
$detail = JobLogic::detail($id);
|
|
$category2 = [];
|
|
$salary2 = [];
|
|
$industry2 = [];
|
|
$education2 = [];
|
|
if($detail['cate_id']>0){
|
|
$category2 = JobCateLogic::detail($detail['cate_id']);
|
|
}
|
|
if($detail['industry_id']>0){
|
|
$industry2 = JobIndustryLogic::detail($detail['industry_id']);
|
|
}
|
|
if($detail['salary_id']>0){
|
|
$salary2 = JobSalaryLogic::detail($detail['salary_id']);
|
|
}
|
|
if($detail['education']>0){
|
|
$education2 = JobLogic::getEducation($detail['education']);
|
|
}
|
|
$detail['address'] = $detail['province_id']?AreaServer::getAddress([
|
|
$detail['province_id'],
|
|
$detail['city_id'],
|
|
$detail['district_id']]):'';
|
|
|
|
$detail['cate_name'] = $category2['name'];
|
|
$detail['industry_name'] =$industry2['name'];
|
|
$detail['salary_name'] = $salary2['value'];
|
|
$detail['education_name'] = $education2['name'];
|
|
|
|
return view('', [
|
|
'detail' => $detail
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @NOTES: 编辑帮助分类
|
|
* @author: 张无忌
|
|
*/
|
|
public function detail()
|
|
{
|
|
$id = $this->request->get('id');
|
|
$detail = JobLogic::detail($id);
|
|
$category2 = [];
|
|
$salary2 = [];
|
|
$industry2 = [];
|
|
$education2 = [];
|
|
if($detail['cate_id']>0){
|
|
$category2 = JobCateLogic::detail($detail['cate_id']);
|
|
}
|
|
if($detail['industry_id']>0){
|
|
$industry2 = JobIndustryLogic::detail($detail['industry_id']);
|
|
}
|
|
if($detail['salary_id']>0){
|
|
$salary2 = JobSalaryLogic::detail($detail['salary_id']);
|
|
}
|
|
if($detail['education']>0){
|
|
$education2 = JobLogic::getEducation($detail['education']);
|
|
}
|
|
$detail['address'] = $detail['province_id']?AreaServer::getAddress([
|
|
$detail['province_id'],
|
|
$detail['city_id'],
|
|
$detail['district_id']]):'';
|
|
|
|
$detail['cate_name'] = $category2['name'];
|
|
$detail['industry_name'] =$industry2['name'];
|
|
$detail['salary_name'] = $salary2['value'];
|
|
$detail['education_name'] = $education2['name'];
|
|
|
|
return view('', [
|
|
'detail' => $detail,
|
|
'cates' => JobCateLogic::getCate(),
|
|
'industrys' => JobIndustryLogic::getIndustry(),
|
|
'salarys' => JobSalaryLogic::getSalary(),
|
|
'educations' => JobLogic::getEducation(),
|
|
|
|
]);
|
|
}
|
|
|
|
}
|
|
|