<?php
|
|
|
class job_controller extends company
|
{
|
|
function index_action()
|
{
|
|
$this -> public_action();
|
$this -> company_satic();
|
|
$jobM = $this->MODEL('job');
|
|
$StatisM = $this->MODEL('statis');
|
$suid = $this->spid ? $this->spid : $this->uid;
|
$statis = $StatisM -> getInfo($suid, array('usertype' => '2'));
|
$this->yunset('statis', $statis);
|
|
$urlarr = array('c' => 'job', 'page' => '{{page}}');
|
|
$uid = $this->uid;
|
|
$where['uid'] = $uid;
|
|
$partM = $this -> MODEL('part');
|
$this->yunset('partNum', $partM->getpartJobNum($where));
|
$ltjobM = $this -> MODEL('lietoujob');
|
$this->yunset('ltjobNum', $ltjobM->getLtjobNum($where));
|
|
// 关键字刷选
|
if ($_GET['keyword']) {
|
|
$where['name'] = array('like', trim($_GET['keyword']));
|
$urlarr['keyword'] = $_GET['keyword'];
|
}
|
// 职位状态 0:待审核职位 1:招聘中的职位 3:未通过职位 4:已下架职位 5:所有职位
|
if($_GET['type']==2){
|
$urlarr['type'] = $_GET['type'];
|
}
|
if ($_GET['w'] == 4) {
|
|
$where['status'] = '1';
|
$urlarr['w'] = $_GET['w'];
|
} elseif ($_GET["w"] == 1) {
|
|
$where['status'] = '0';
|
$where['state'] = '1';
|
$urlarr['w'] = $_GET['w'];
|
} elseif ($_GET["w"] == 5) {
|
|
$urlarr['w'] = $_GET['w'];
|
} else {
|
|
$where['state'] = $_GET['w'];
|
$urlarr['w'] = $_GET['w'];
|
}
|
|
$pageurl = Url('member', $urlarr);
|
|
$pageM = $this->MODEL('page');
|
$pages = $pageM->pageList('company_job', $where, $pageurl, $_GET['page'], $this->config['sy_listnum']);
|
if ($pages['total'] > 0) {
|
if ($_GET['order']) {
|
|
$where['orderby'] = $_GET['t'].','.$_GET['order'];
|
$urlarr['order'] = $_GET['order'];
|
$urlarr['t'] = $_GET['t'];
|
} else {
|
|
$where['orderby'] = array('lastupdate,desc','id,desc');
|
}
|
|
$where['limit'] = $pages['limit'];
|
$List = $jobM -> getList($where, array('sqjobnum' => 'yes', 'reserve' => 1));
|
|
$this->yunset('rows', $List['list']);
|
}
|
|
// 统计各状态职位数量
|
// 职位状态 0:待审核职位 1:招聘中的职位 3:未通过职位 4:已下架职位 5:所有职位
|
|
$swhere['com_id'] = $uid;
|
$audit = $jobM->getList($swhere, array('field' => "`status`,`state`"));
|
|
$w0 = $w1 = $w2 = $w3 = $w4 = $w5 = 0;
|
|
if (is_array($audit['list'])) {
|
foreach ($audit['list'] as $value) {
|
|
if ($value['state'] == '0') {
|
$w0 += 1;
|
}
|
if ($value['status'] == '0' && $value['state'] == '1') {
|
$w1 += 1;
|
}
|
|
if ($value['state'] == '3') {
|
$w3 += 1;
|
}
|
if ($value['status'] == '1') {
|
$w4 += 1;
|
}
|
$w5 += 1;
|
}
|
}
|
|
$this->yunset(array(
|
'w0' => $w0,
|
'w1' => $w1,
|
'w3' => $w3,
|
'w4' => $w4,
|
'w5' => $w5
|
));
|
$this -> yunset('audit', $w0);
|
|
$this->yunset('jobNum', $w5);
|
|
$this -> yunset('i_know_job', !empty($_COOKIE['i_know_job_' . $this->uid]) ? 1 : 0);
|
|
if (intval($_GET['w']) == 1) {
|
|
$WhbM = $this->MODEL('whb');
|
|
$syJobHb = $WhbM->getWhbList(array('type' => 1, 'isopen' => 1));
|
|
$this->yunset('hbNum', count($syJobHb));
|
if(!empty($syJobHb)){
|
$hbids = array();
|
foreach ($syJobHb as $hk => $hv) {
|
$hbids[] = $hv['id'];
|
}
|
$this->yunset('hbids', $hbids);
|
}
|
|
$type = $_GET['type'];
|
$this->yunset('type', $type);
|
$this->com_tpl('joblist');
|
} else {
|
|
$this->com_tpl('job');
|
}
|
}
|
|
function opera_action()
|
{
|
$this->job();
|
}
|
|
// 刷新职位方法,套餐处理集合到comtc.model.php类里面
|
function refresh_job_action()
|
{
|
if ($_POST) {
|
|
$comtcM = $this->MODEL('comtc');
|
|
$_POST['spid'] = $this->spid;
|
$_POST['uid'] = $this->uid;
|
$_POST['usertype'] = $this->usertype;
|
$_POST['port'] = 1;
|
|
$return = $comtcM->refresh_job($_POST);
|
|
if ($return['status'] == 1) {// 职位刷新成功
|
|
echo json_encode(array(
|
'error' => 1,
|
'msg' => $return['msg']
|
));
|
} else if ($return['status'] == 2) {
|
|
echo json_encode(array(
|
'error' => 2,
|
'pro' => $return['pro'],
|
'online' => $return['online'],
|
'integral' => $return['integral'],
|
'jifen' => $return['jifen'],
|
'price' => $return['price']
|
));
|
} else {// 职位刷新失败
|
|
echo json_encode(array(
|
'error' => 3,
|
'msg' => $return['msg'],
|
'url' => $return['url']
|
));
|
}
|
} else {
|
echo json_encode(array(
|
'error' => 3,
|
'msg' => '参数错误,请重试!'
|
));
|
}
|
}
|
|
/**
|
* 点击知道了,缓存1天
|
*/
|
function i_know_action()
|
{
|
$opt = $_POST['opt'];
|
$time = time();
|
$this->cookie->setCookie('i_know_' . $opt . '_' . $this->uid, 1,$time + strtotime(date('Y-m-d 23:59:59')) - $time);
|
}
|
|
/**
|
* 职位推广套餐 查询
|
*/
|
function jobPromote_action()
|
{
|
$uid = $this->uid;
|
$type = intval($_POST['type']);
|
//预留职位自动刷新
|
if ($type != 5){
|
|
$jobM = $this->MODEL('job');
|
$return = $jobM->jobPromote($uid, array('type' => $type, 'spid' => $this->spid));
|
}else{
|
|
if($this->config['job_auto'] == 0){
|
|
$return = array('status' => 1);
|
}else{
|
|
$return = array('status'=>2);
|
}
|
}
|
|
echo json_encode($return);
|
die();
|
}
|
|
function setJobPromote_action()
|
{
|
if ($_POST) {
|
|
$jobM = $this->MODEL('job');
|
|
$_POST['uid'] = $this->uid;
|
$_POST['spid'] = $this->spid;
|
$_POST['username'] = $this->username;
|
$_POST['usertype'] = $this->usertype;
|
|
$return = $jobM->setJobPromote($_POST['jobid'], $_POST);
|
|
echo json_encode($return);
|
die();
|
}
|
}
|
|
function closeJobPromote_action()
|
{
|
if ($_POST) {
|
|
$jobM = $this->MODEL('job');
|
|
$_POST['uid'] = $this->uid;
|
$_POST['spid'] = $this->spid;
|
$_POST['username'] = $this->username;
|
$_POST['usertype'] = $this->usertype;
|
|
$return = $jobM->closeJobPromote($_POST['jobid'], $_POST);
|
|
echo json_encode($return);
|
die();
|
}
|
}
|
|
/**
|
* 职位竞争力
|
*/
|
function compete_action()
|
{
|
|
if ($_POST['id']) {
|
|
$competeM = $this->MODEL('compete');
|
|
$List = $competeM->comJob($this->uid, (int) $_POST['id'], 2);
|
|
if($List['errcode'] != '1'){
|
echo $List['errcode'];
|
}else{
|
$this->yunset('List', $List);
|
|
$this->com_tpl('compete');
|
}
|
|
}
|
}
|
|
/**
|
* 预约刷新
|
*/
|
function reserveUp_action()
|
{
|
|
if ($_POST) {
|
|
$jobM = $this->MODEL('job');
|
|
$data = array(
|
|
'job_id' => $_POST['job_id'],
|
'end_time' => strtotime($_POST['end_time']),
|
'interval' => $_POST['interval'],
|
'status' => $_POST['status'],
|
's_time' => $_POST['s_time'],
|
'e_time' => $_POST['e_time']
|
);
|
$return = $jobM->reserveUpJob($data, array('uid' => $this->uid));
|
|
echo json_encode($return);
|
die;
|
} else {
|
|
echo json_encode(array('error' => 0, 'msg' => '参数错误'));
|
die;
|
}
|
}
|
}
|
?>
|