| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 | <?phpnamespace Cas\Controller\Admin\Platform;use Cas\Module\Lottery;use Cas\Dao\PlatformBulletin;use KIF\Core\Request;use Cas\Dao\LotteryEvents;use Cas\Controller\Admin\Controller;use KIF\Page\Page;use Cas\Dao\Platform;/** * "平台相关" - "列表"[平台相关信息] * * @author lihuanchun *         页面: "平台信息"列表 doPageList *         页面: 查看&修改 "平台信息" doPageShow *         事件: 创建"平台信息" doReqCreate *         事件: 修改"平台信息" doReqUp *         事件: 删除"平台信息" doReqDel   */class Index extends Controller {	private $objDPlatform;	private $operatorData;		/**	 *  初始化	 */	public function __construct() {		header ( "Content-Type: text/html; charset=utf-8" );		$this->operatorData = $this->getUser ();		$this->objDPlatform = new Platform ();	}		/**	 * 默认	 */	public function doDefault() {	}		/**	 * 页面: "平台信息"列表	 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Index&a=PageList	 */	public function doPageList() {		$page = Request::varGetInt ( 'page', 1 );		$size = 10;		$offset = ($page - 1) * $size;		$limit = "{$offset},{$size}";		$condition = array ();		$total_num = $this->objDPlatform->totals ( $condition );		$url_tpl = Request::schemeDomain () . "?c=Admin_Platform_Index&a=PageList";		$url_tpl .= "&page={page}";		$objPage = new Page ( $total_num, $url_tpl, $page, $size );		$page_html = $objPage->html ();				$order = 'id desc';		$ids = $this->objDPlatform->findIdsBy ( $condition, $limit, $order );		$platformData = $this->objDPlatform->gets ( $ids );				$this->tpl = 'admin/platform/list';		$title = '平台列表';		$this->setOutput('title', $title);		$this->setOutput('menu_active', array('name' => 'platformlist', 'item' => 'list')); //激活菜单		$this->addNavMenu('平台设置');		$this->addNavMenu($title);				$this->setOutput('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据		$this->setOutput ( 'page_html', $page_html ); // 分页Html		$this->setOutput ( 'platformData', $platformData ); // 当前"平台信息"列表数据	}		/**	 * 页面: 查看&修改 "平台信息"	 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Index&a=PageShow&id=nn	 * 参数:id "平台信息"id	 */	public function doPageShow() {		$id = Request::g ( 'id' );				$platformData = $this->objDPlatform->get ( $id );				$this->tpl = 'admin/platform/edit';		$title = '编辑平台信息';		$this->setOutput('title', $title);		$this->setOutput('menu_active', array('name' => 'platformset', 'item' => 'list')); //激活菜单		$this->addNavMenu('平台设置');		$this->addNavMenu('平台列表', Request::schemeDomain() . '/?c=Admin_Platform_index&a=PageList');		$this->addNavMenu($title);				$this->setOutput('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据				$this->setOutput ( 'platformData', $platformData ); // 当前"平台信息"内容	}		/**	 * 事件:创建"平台信息"	 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Index&a=ReqCreate	 * 参数:见方法内	 */	public function doReqCreate() {		$tableInfo = $_POST;		$operator_uid = $this->operatorData ['uid'];				$info = array_merge($tableInfo, array(			'operator_uid' => $operator_uid		));				$tmpResult = $this->objDPlatform->thisAdd ( $info );		if (!$tmpResult) {			$this->ajax_fail_exit('添加新列表失败');		}				$this->ajax_success_exit();	}		/**	 * 事件: 修改"平台信息"	 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Index&a=ReqUp	 * 参数:见方法内	 */	public function doReqUp() {		$tableInfo = $_POST;				$id = $tableInfo['id'];		unset($tableInfo['id']);				$operator_uid = $this->operatorData ['uid'];				$info = array_merge($tableInfo, array(			'operator_uid' => $operator_uid		));		$tmpResult = $this->objDPlatform->modify ( $info, array (				'id' => $id 		) );				if (!$tmpResult->isSuccess()) {			$this->ajax_fail_exit($tmpResult->getData());		}				$this->ajax_success_exit();	}		/**	 * 事件: 删除"平台信息"	 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Index&a=ReqDel	 * 参数:见方法内	 */	public function doReqDel() {		$id = Request::p ( 'id' );				$this->objDPlatform->delete ( array (				'id' => $id 		) );				// TODO 根据前端自定义返回结果或跳转		header ( "Location: " . Request::schemeDomain () . "/?c=Admin_Platform_Index&a=PageList" );		exit ();	}	public function display() {		return $this->render ();	}}	
 |