<?php
/**
 * Copy Right IJH.CC
 * Each engineer has a duty to keep the code elegant
 * $Id: tenders.ctl.php 2335 2013-12-18 17:15:56Z youyi $
 */

class Ctl_tenders extends Ctl 
{
	
	public function index()
	{
		$this->tmpl = 'mobile:tenders.html';	
	}

	public function save()
	{
		if(!$contact = $this->GP('contact')){
			$this->err->add('联系人不能为空', 211);
		}else if(!$mobile = $this->GP('mobile')){
			$this->err->add('联系电话不能为空', 212);
		}else{
			$data = array('name'=>$contact, 'mobile'=>$mobile, 'city_id'=>$this->request['city_id']);
			$data['client_ip'] = __IP;
			$data['dateline'] = __CFG::TIME;
            if($id = K::M('tenders/tenders')->create($data)){
                $this->err->add('恭喜您发布招标成功！');
            }			
		}
	}
}