165 lines
3.9 KiB
PHP
165 lines
3.9 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Vacancy extends MY_Controller {
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->Func_model->check_session(true);
|
|
$this->load->model('admin/Vacancy_model');
|
|
$this->load->model('admin/City_model');
|
|
$this->load->model('admin/Ad_model');
|
|
}
|
|
|
|
/*
|
|
获取广告位列表
|
|
*/
|
|
public function lst()
|
|
{
|
|
$pagecurrent = isset($_POST['pagecurrent'])?stripslashes($_POST['pagecurrent']):"";
|
|
$id = isset($_POST['adid'])?$_POST['adid']:"";
|
|
$vacancynumber = isset($_POST['vacancynumber'])?$_POST['vacancynumber']:"";
|
|
|
|
if ($pagecurrent == "")
|
|
{
|
|
return false;
|
|
}else
|
|
{
|
|
$data = array();
|
|
$num = $this->Config_model->getPageNum();
|
|
|
|
$like = array("number" => $vacancynumber);
|
|
$where = array("signid" => $id);
|
|
|
|
$data = $this->Db_model->getPage("vacancy",$where,$like,$pagecurrent);
|
|
$msg = $this->Db_model->getSearchData("vacancy",$where,$like,"id","DESC",((int)$pagecurrent-1)*$num,$num);
|
|
$len = count($data);
|
|
|
|
foreach ($msg as $row)
|
|
{
|
|
$data[$len][] = $this->Vacancy_model->setVacancyMsg($row);
|
|
}
|
|
|
|
$this->Func_model->toJsFunc("vacancyList",$this->Func_model->decodeUnicode($data));
|
|
return;
|
|
}
|
|
}
|
|
|
|
/*
|
|
增加广告位
|
|
*/
|
|
public function addVacancy()
|
|
{
|
|
$data = $this->Vacancy_model->receiveVacancyMsg();
|
|
|
|
/*$where = array('number' => $data['number']);
|
|
$infor = $this->Db_model->getSpecificData("Vacancy",$where);
|
|
if (count($infor) > 0)
|
|
{
|
|
$this->Func_model->setTip("number_tip",$this->Config_model->msg[7]);
|
|
return;
|
|
}*/
|
|
|
|
$this->Db_model->insertData("vacancy",$data);
|
|
$this->Ad_model->setFree($data['signid']);
|
|
|
|
$this->Func_model->toJsFunc("disVacancy","");
|
|
$this->Func_model->setAlert($this->Config_model->msg[0]);
|
|
}
|
|
|
|
/*
|
|
开启 / 关闭 广告位
|
|
*/
|
|
public function openVacancy()
|
|
{
|
|
$adid = isset($_POST['adid'])?$_POST['adid']:"";
|
|
$vid = isset($_POST['vid'])?$_POST['vid']:"";
|
|
$state = isset($_POST['state'])?$_POST['state']:"";
|
|
|
|
$_state = 0;
|
|
|
|
if ($adid == "")
|
|
return ;
|
|
|
|
if ($state == 0)
|
|
{
|
|
$this->Ad_model->setFree($adid,-1);
|
|
$_state = 2;
|
|
}else if ($state == 2)
|
|
{
|
|
$this->Ad_model->setFree($adid);
|
|
}
|
|
$this->Vacancy_model->setState($vid,$_state);
|
|
$this->Func_model->toJsFunc("openVacancy",$_state);
|
|
$this->Func_model->setAlert($this->Config_model->msg[0]);
|
|
}
|
|
|
|
|
|
/*
|
|
删除广告位
|
|
*/
|
|
public function delVacancy()
|
|
{
|
|
$id = isset($_POST['id'])?$_POST['id']:"";
|
|
$adid = isset($_POST['adid'])?$_POST['adid']:"";
|
|
|
|
if ($id == "")
|
|
return ;
|
|
|
|
$where = array('id' => $id);
|
|
$this->Db_model->delData("vacancy",$where);
|
|
|
|
$this->Ad_model->setFree($adid,-1);
|
|
|
|
$this->Func_model->toJsFunc("disVacancy","");
|
|
$this->Func_model->setAlert($this->Config_model->msg[0]);
|
|
}
|
|
|
|
/*
|
|
广告位信息
|
|
*/
|
|
public function vacancyInfor()
|
|
{
|
|
$id = isset($_POST['id'])?$_POST['id']:"";
|
|
|
|
if ($id == "")
|
|
return ;
|
|
|
|
$where = array('id' => $id);
|
|
$infor = $this->Db_model->getSpecificData("vacancy",$where);
|
|
|
|
$data = $this->Vacancy_model->setVacancyMsg($infor[0]);
|
|
$this->Func_model->toJsFunc("vacancyInfor",$this->Func_model->decodeUnicode($data));
|
|
}
|
|
|
|
/*
|
|
编辑广告位信息
|
|
*/
|
|
public function editVacancy()
|
|
{
|
|
$id = isset($_POST['vid'])?$_POST['vid']:"";
|
|
$data['number'] = isset($_POST['vnumber'])?$_POST['vnumber']:"";
|
|
$data['cost'] = isset($_POST['vcost'])?$_POST['vcost']:"";
|
|
$data['design'] = isset($_POST['vdesign'])?$_POST['vdesign']:"";
|
|
|
|
$where = array('number' => $data['number']);
|
|
$infor = $this->Db_model->getSpecificData("vacancy",$where);
|
|
|
|
if (count($infor) > 0)
|
|
{
|
|
if ((int)$infor[0]->id != (int)$id)
|
|
{
|
|
$this->Func_model->setTip("number_tip",$this->Config_model->msg[7]);
|
|
return;
|
|
}
|
|
}
|
|
|
|
$where = array('id' => $id);
|
|
$this->Db_model->updateData("vacancy",$data,$where);
|
|
|
|
$this->Func_model->toJsFunc("editVacancy","");
|
|
$this->Func_model->setAlert($this->Config_model->msg[0]);
|
|
}
|
|
}
|