275 lines
8.2 KiB
PHP
275 lines
8.2 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Order extends MY_Controller {
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->Func_model->check_session(true);
|
|
$this->load->model('admin/Order_model');
|
|
$this->load->model('admin/City_model');
|
|
$this->load->model('admin/Vacancy_model');
|
|
$this->load->model('admin/Ad_model');
|
|
}
|
|
|
|
/*
|
|
获取列表
|
|
*/
|
|
public function lst()
|
|
{
|
|
$pagecurrent = isset($_POST['pagecurrent'])?stripslashes($_POST['pagecurrent']):"";
|
|
|
|
$vid = isset($_POST['vid'])?stripslashes($_POST['vid']):"";
|
|
$uname = isset($_POST['uname'])?stripslashes($_POST['uname']):"";
|
|
$order_date = isset($_POST['order_date'])?stripslashes($_POST['order_date']):"";
|
|
$state = isset($_POST['state'])?stripslashes($_POST['state']):"";
|
|
$start_date = isset($_POST['start_date'])?stripslashes($_POST['start_date']):"";
|
|
$end_date = isset($_POST['end_date'])?stripslashes($_POST['end_date']):"";
|
|
|
|
if ($pagecurrent == "")
|
|
{
|
|
return false;
|
|
}else
|
|
{
|
|
$data = array();
|
|
$num = $this->Config_model->getPageNum();
|
|
|
|
$like = array("username" => $uname, "ordertime" => $order_date, "state" => $state, "starttime" => $start_date, "endtime" => $end_date);
|
|
|
|
if ($vid != "")
|
|
{
|
|
$where = array("vacancyid" => $vid);
|
|
|
|
}else
|
|
{
|
|
$where = array();
|
|
}
|
|
|
|
$msg = $this->Db_model->getSearchData("reserve",$where,$like,"id","DESC",((int)$pagecurrent-1)*$num,$num);
|
|
$this->Order_model->checkOrder($msg);
|
|
|
|
$data = $this->Db_model->getPage("reserve",$where,$like,$pagecurrent);
|
|
$msg = $this->Db_model->getSearchData("reserve",$where,$like,"id","DESC",((int)$pagecurrent-1)*$num,$num);
|
|
$len = count($data);
|
|
|
|
foreach ($msg as $row)
|
|
{
|
|
|
|
$data[$len][] = $this->Order_model->setOrderMsg($row);
|
|
}
|
|
if($data->adminstate==1){
|
|
$data->adminstate="aaa";
|
|
}else {
|
|
$data->adminstate="bbb";
|
|
}
|
|
$this->Func_model->toJsFunc("orderList",$this->Func_model->decodeUnicode($data));
|
|
return;
|
|
}
|
|
}
|
|
|
|
/*
|
|
修改订单状态
|
|
*/
|
|
public function setOrderState()
|
|
{
|
|
date_default_timezone_set("Asia/Shanghai");
|
|
$oid = isset($_POST['oid'])?stripslashes($_POST['oid']):"";
|
|
$ostate = isset($_POST['ostate'])?stripslashes($_POST['ostate']):"";
|
|
$days = isset($_POST['days'])?stripslashes($_POST['days']):1;
|
|
|
|
if ($oid == "" || $ostate == "")
|
|
{
|
|
return ;
|
|
}
|
|
|
|
$where = array('id' => $oid);
|
|
$infor = $this->Db_model->getSpecificData("reserve",$where);
|
|
$vid = $infor[0]->vacancyid;
|
|
$signid = $infor[0]->signid;
|
|
|
|
$this->Order_model->setState($oid, $ostate);
|
|
|
|
if ($ostate == 2 || $ostate == 3)
|
|
{
|
|
//退钱 / 到期
|
|
$len = $this->Vacancy_model->updateOrder($vid, $oid, "remove");
|
|
if ($len == 0)
|
|
{
|
|
$this->Vacancy_model->setState($vid, 0);
|
|
$this->Ad_model->setFree($signid, 1);
|
|
}
|
|
}
|
|
else if ($ostate == 1)
|
|
{
|
|
//投放
|
|
$_start = date("m/d/Y");
|
|
$_end = date("m/d/Y",strtotime('+'.$days.' day'));
|
|
$tmp = array('starttime' => $_start, 'endtime' => $_end);
|
|
$this->Vacancy_model->setState($vid, 1);
|
|
$this->Ad_model->setFreeState($signid, 1);
|
|
$this->Order_model->resetTime($oid, $tmp);
|
|
}
|
|
|
|
$this->lst();
|
|
|
|
//$where = array('id' => $oid);
|
|
//$infor = $this->Db_model->getSpecificData("reserve",$where);
|
|
//$data = $this->Order_model->setOrderMsg($infor[0]);
|
|
|
|
//$this->Func_model->toJsFunc("updateOrder",$this->Func_model->decodeUnicode($data));
|
|
}
|
|
/*
|
|
* 查询下拉
|
|
* */
|
|
public function addPre(){
|
|
// $data = $this->Order_model->ProvinceMsg();
|
|
$id= isset($_POST['signidR'])?$_POST['signidR']:"";
|
|
/* $where = array('id' => $provi);
|
|
$msg= $this->Db_model->getSearchData("advertisement",$where,null,null,null,null,null);
|
|
$data['vacancy'] = $this->Vacancy_model->getVacancy($msg[0].id,0); */
|
|
|
|
|
|
if ($id == "")
|
|
return ;
|
|
|
|
$where = array('signid' => $id);
|
|
$infor = $this->Db_model->getSpecificData("vacancy",$where);
|
|
|
|
if (count($infor) <= 0)
|
|
return ;
|
|
|
|
$this->Order_model->checkOrder($infor);
|
|
|
|
$where = array('id' => $id);
|
|
$infor = $this->Db_model->getSpecificData("advertisement",$where);
|
|
$data = $this->Ad_model->setAdMsg($infor[0]);
|
|
|
|
$data['photo'] = $this->Ad_model->getPhoto($id);
|
|
$data['empty'] = $this->Vacancy_model->getVacancy($id,0);
|
|
$data['buy'] = $this->Vacancy_model->getVacancy($id,1);
|
|
// if($provi=='Q'){
|
|
// $where = array('signid' => 1);
|
|
// }
|
|
// $like == array('number' => "HM-0003",NULL,null);
|
|
// $provi= array("number" => $provi, null, null, null, null);
|
|
// $msg = $this->Db_model->getSearchData("vacancy",$where,null,null,null,null,null);
|
|
$this->Func_model->toJsFunc("orderPerv",$this->Func_model->decodeUnicode($data));
|
|
return;
|
|
}
|
|
/*
|
|
* 查询下拉
|
|
* */
|
|
public function addProvince(){
|
|
// $data = $this->Order_model->ProvinceMsg();
|
|
$pro= isset($_POST['provinces'])?$_POST['provinces']:"";
|
|
//$where = array('number' => "HM-0003");
|
|
$like = array("number" => $pro, null, null, null, null);
|
|
//$like == array('number' => "HM-0003",NULL,null);
|
|
$msg = $this->Db_model->getSearchData("advertisement",null,$like,null,null,null,null);
|
|
$this->Func_model->toJsFunc("orderPer",$this->Func_model->decodeUnicode($msg));
|
|
return;
|
|
}
|
|
/*
|
|
* 添加
|
|
* */
|
|
|
|
public function addOrder()
|
|
{
|
|
|
|
$data = $this->Order_model->reserveMsg();
|
|
$signidrese= isset($_POST['signids'])?$_POST['signids']:"";
|
|
$vacancyidrese= isset($_POST['vacancyidv'])?$_POST['vacancyidv']:"";
|
|
$this->Db_model->insertData("reserve",$data);
|
|
$this->Func_model->toJsFunc("disOrder","");
|
|
$this->Ad_model->setFreeState($signidrese, 1);
|
|
$this->Ad_model->setVacancyState($vacancyidrese, 1);
|
|
$this->Func_model->setAlert($this->Config_model->msg[0]);
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
删除广告
|
|
*/
|
|
public function delAd()
|
|
{
|
|
$oid = isset($_POST['oid'])?stripslashes($_POST['oid']):"";
|
|
if ($oid== "")
|
|
return ;
|
|
$where = array('id' => $oid);
|
|
$infor =$this->Db_model->getSpecificData("reserve",$where);
|
|
$vid = $infor[0]->vacancyid;
|
|
$signid = $infor[0]->signid;
|
|
$this->Vacancy_model->setState($vid,0);
|
|
$this->Ad_model->setFree($signid,1);
|
|
$this->Db_model->delData("reserve",$where);
|
|
$this->Func_model->toJsFunc("disOrder","");
|
|
$this->Func_model->setAlert($this->Config_model->msg[0]);
|
|
}
|
|
/*
|
|
广告信息
|
|
*/
|
|
// public function adInfor()
|
|
// {
|
|
// $id = isset($_POST['adid'])?$_POST['adid']:"";
|
|
//
|
|
// if ($id == "")
|
|
// return ;
|
|
//
|
|
// $where = array('id' => $id);
|
|
// $infor = $this->Db_model->getSpecificData("advertisement",$where);
|
|
//
|
|
// $data = $this->Ad_model->setAdMsg($infor[0]);
|
|
// $data['citylist'] = $this->City_model->getCity();
|
|
// $this->Func_model->toJsFunc("adInfor",$this->Func_model->decodeUnicode($data));
|
|
// }
|
|
|
|
/*
|
|
编辑广告信息
|
|
*/
|
|
// public function editAd()
|
|
// {
|
|
// $id = isset($_POST['adid'])?$_POST['adid']:"";
|
|
// $data['cityid'] = isset($_POST['cityid'])?$_POST['cityid']:"";
|
|
// $data['areaid'] = isset($_POST['areaid'])?$_POST['areaid']:"";
|
|
// $data['communityid'] = isset($_POST['communityid'])?$_POST['communityid']:"";
|
|
//
|
|
// $data['number'] = isset($_POST['number'])?$_POST['number']:"";
|
|
// $data['free'] = isset($_POST['vacancy'])?$_POST['vacancy']:"";
|
|
// $data['size'] = isset($_POST['size'])?$_POST['size']:"";
|
|
//
|
|
// $where = array('number' => $data['number']);
|
|
// $infor = $this->Db_model->getSpecificData("advertisement",$where);
|
|
// if (count($infor) > 0)
|
|
// {
|
|
// if ((int)$infor[0]->id != (int)$id)
|
|
// {
|
|
// $this->Func_model->setTip("number_tip",$this->Config_model->msg[7]);
|
|
// return;
|
|
// }
|
|
// }
|
|
//
|
|
// if ($_FILES['file']['name'] != "")
|
|
// {
|
|
// $msg = $this->Func_model->do_upload("file", $this->Config_model->fileMsg);
|
|
// $data['img'] = $msg['file_name'];
|
|
// }
|
|
//
|
|
// $where = array('id' => $id);
|
|
// $this->Db_model->updateData("advertisement",$data,$where);
|
|
//
|
|
// $this->Func_model->toJsFunc("editAd","");
|
|
// $this->Func_model->setAlert($this->Config_model->msg[0]);
|
|
// }
|
|
|
|
/*
|
|
所有广告牌信息
|
|
*/
|
|
// public function getAd()
|
|
// {
|
|
// $data = $this->Ad_model->getAd();
|
|
// $this->Func_model->toJsFunc("setAd",$this->Func_model->decodeUnicode($data));
|
|
// }
|
|
}
|