| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 | <?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\UserInfo;use Cas\Module\User;use Cas\Dao\BackUser;/** * "平台相关" - "公告" * * @author lihuanchun * 页面: 公告列表    doPageList * 页面: 查看&修改 公告   doPageShow * 事件: 创建公告   doReqCreate * 事件: 修改公告   doReqUp    * 事件: 删除公告   doReqDel      */class Bulletin extends Controller {		private $objDPlatformBulletin;	private $operatorData;		/**	 *  初始化	 */	public function __construct() {		header ( "Content-Type: text/html; charset=utf-8" );		$this->operatorData = $this->getUser ();		$this->objDPlatformBulletin = new PlatformBulletin();	}		/**	 * 默认	 */	public function doDefault() {			}		/**	 * 页面: 公告列表  & 创建公告	 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Bulletin&a=PageList	 */	public function doPageList(){				$page = Request::varGetInt ( 'page', 1 );		$size = 20;		$offset = ($page - 1) * $size;		$limit = "{$offset},{$size}";		$condition = array();		$total_num = $this->objDPlatformBulletin->totals ( $condition );		$url_tpl = Request::schemeDomain () . "?c=Admin_Platform_Bulletin&a=PageList";		$url_tpl .= "&page={page}";		$objPage = new Page ( $total_num, $url_tpl, $page, $size );		$page_html = $objPage->html ();				$order = 'id desc';		$ids = $this->objDPlatformBulletin -> findIdsBy($condition , $limit, $order );		$bulletinsData = $this->objDPlatformBulletin->gets($ids);				$uids = array();		foreach($bulletinsData as $key=>$data){			$uids[$data['operator_uid']] = $data['operator_uid'];		}				$objDUserInfo = new UserInfo();		$thisPageUserData = $objDUserInfo -> gets($ids);				$this->tpl = 'admin/platform/blletin_list';		$title = '公告设置';		$this->setOutput('title', $title);		$this->setOutput('menu_active', array('name' => 'bulletin', 'item' => '')); //激活菜单		$this->addNavMenu($title);		$this->addNavMenu('平台设置');		$this->setOutput ( 'page_html', $page_html ); // 分页Html		$this->setOutput ( 'bulletinsData', $bulletinsData ); // 当前公告列表数据		$this->setOutput ( 'thisPageUserData', $thisPageUserData );//当前页面用户ID 		$this->setOutput ('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据		$this->setOutput('isSuperadmin', $this->isSuperadmin());			}		/**	 * 页面: 查看&修改 公告	 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Bulletin&a=PageShow&bulletin_id=nn	 * 参数:bulletin_id 公告id	 */	public function doPageShow(){		$objBackUser = new BackUser();				$objUser = new User();		$bulletin_id = Request::g('bulletin_id');		$bulletinData = $this->objDPlatformBulletin->get($bulletin_id);		$bulletinData['userData']  = $objBackUser->get($bulletinData['operator_uid']);								$this->tpl = 'admin/platform/blletin_show';		$title = '公告内容';		$this->setOutput('title', $title);		$this->setOutput('menu_active', array('name' => 'bulletin', 'item' => '')); //激活菜单		$this->addNavMenu($title);		$this->addNavMenu('平台设置');		$this->setOutput ( 'bulletinData', $bulletinData ); // 当前公告内容				$this->setOutput ('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据	}		/**	 * 页面: 修改 公告	 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Bulletin&a=PageUp&bulletin_id=nn	 * 参数:bulletin_id 公告id	 */	public function doPageUp(){			$bulletin_id = Request::g('bulletin_id');		$bulletinData = $this->objDPlatformBulletin->get($bulletin_id);				$this->tpl = 'admin/platform/blletin_up';		$title = '公告设置';		$this->setOutput('title', $title);		$this->setOutput('menu_active', array('name' => 'platformset', 'item' => 'bulletin')); //激活菜单		$this->addNavMenu($title);		$this->addNavMenu('平台设置');		$this->setOutput ( 'bulletinData', $bulletinData ); // 当前公告内容				$this->setOutput ('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据	}			/**	 * 事件:创建公告	 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Bulletin&a=ReqCreate	 * 参数:见方法内	 */	public function doReqCreate(){		$title = Request::p('title');		$content = Request::p('content', null);		$operator_uid = $this->operatorData['uid'];				$info = array(				'title' => $title,				'content' => $content,				'operator_uid' => $operator_uid		);				$this->objDPlatformBulletin->add($info);				$this->ajax_success_exit('添加成功');	}		/**	 * 事件: 修改公告	 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Bulletin&a=ReqUp	 * 参数:见方法内	 */	public function doReqUp(){				$bulletin_id = Request::p('bulletin_id');		$title = Request::p('title');		$content = Request::p('content', null);		$operator_uid = $this->operatorData['uid'];				$info = array(				'title' => $title,				'content' => $content,				'operator_uid' => $operator_uid		);		$this->objDPlatformBulletin->modify($info, array('id' =>$bulletin_id ));				$this->ajax_success_exit('修改成功');			}		/**	 * 事件: 删除公告	 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Bulletin&a=ReqDel	 * 参数:见方法内	 */	public function doReqDel(){				$bulletin_id = Request::p('bulletin_id');				$this->objDPlatformBulletin->delete(array('id' =>$bulletin_id ));				# TODO 根据前端自定义返回结果或跳转		header ( "Location: " . Request::schemeDomain () . "/?c=Admin_Platform_Bulletin&a=PageList" );		exit();			}					public function display() {		return $this->render ();	}}	
 |