<?php
// +----------------------------------------------------------------------
// | WANCMS游戏平台管理系统
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://www.wancms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 顽皮蛋 <shf_l@163.com> <http://www.wancms.com>
// +----------------------------------------------------------------------
// | 修改时间: 2015/12/15
// +----------------------------------------------------------------------
namespace Phonegame\Controller;
use Common\Controller\PhonegameController;
/**
 * 资讯中心控制器
 * @author 顽皮蛋 <shf_l@163.com>
 */
class NewsController extends PhonegameController{
	
	function index(){
		/**
		 *游戏新闻
		 *修改时间2016/01/12 10：54：01
		 *@author yu<thebestyu@126.com>
		 */
		
		$new=sp_sql_posts_paged_bycatid(65,"field:post_title,post_excerpt,post_date,tid,smeta;order:post_date desc;",6);
		$news=$new['posts'];
		$pager=$new['page'];
		$this->assign('new',$new);
		$this->assign('page',$pager);
		$this->assign ('news', $news);
		
		/*排行榜*/
		$games=M('m_game')
		->where('isdisplay=1')
		->order('downloadnum desc')
		->limit(10)
		->select();
		$this->assign('games',$games);
		$this->display($this->template.'/template1'.'/News'.'/index');
		}
	/*游戏活动*/
	function act(){
		$lists=sp_sql_posts_paged_bycatid(66,"field:post_title,post_excerpt,post_date,tid,smeta;order:post_date desc;",6);
		$list=$lists['posts'];
		$pager=$lists['page'];
		$this->assign('lists',$lists);
		$this->assign('page',$pager);
		$this->assign ('list', $list);
		
		/*排行榜*/
		$games=M('m_game')
		->where('isdisplay=1')
		->order('downloadnum desc')
		->limit(10)
		->select();
		$this->assign('games',$games);
		$this->display($this->template.'/template1'.'/News'.'/act');
		}
	/*游戏攻略*/
	function hot(){
		$hotarticle=sp_sql_posts_paged_bycatid(64,"field:post_title,post_excerpt,post_date,tid,smeta;order:post_date desc;",6);
		$posts=$hotarticle['posts'];
		$pager=$hotarticle['page'];
		$this->assign('posts',$posts);
		$this->assign('page',$pager);
		$this->assign ('hotarticle', $hotarticle);
		
		/*排行榜*/
		$games=M('m_game')
		->where('isdisplay=1')
		->order('downloadnum desc')
		->limit(10)
		->select();
		$this->assign('games',$games);
		$this->display($this->template.'/template1'.'/News'.'/hot');
		}
}