<?php
// +----------------------------------------------------------------------
// | WANCMS游戏平台管理系统
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://www.wancms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 顽皮蛋 <shf_l@163.com> <http://www.wancms.com>
// +----------------------------------------------------------------------
// | 修改时间: 2015/05/26
// +----------------------------------------------------------------------
namespace Phonegame\Controller;
use Common\Controller\PhonegameController; 
/**
 * 首页控制器
 * @author 顽皮蛋 <shf_l@163.com>
 */
class IndexController extends PhonegameController {
	
   /**
     * 首页
     * @author 顽皮蛋 <shf_l@163.com>
     */
	public function index() {
    	/*推荐游戏*/
		/**
		 *修改时间2016/01/11 13：56：01
		 *@author yu<thebestyu@126.com>
		 */

		$map['status'] = "1";
		$map['ishot'] = "1";
		$tjgame = M('m_game')->where($map)->order('downloadnum desc')->limit('3')->select();

    	/*热门游戏*/
		$hmap['status'] = "1";
		$hotgame = M('m_game')->where($hmap)->order('downloadnum desc')->limit('10')->getField('id,pic1,gametype,gamename,android_url_image,android_url,downloadnum');

		$this->assign ('tjgame', $tjgame);
        $this->assign ('hotgame', $hotgame);
    	$type  = array('1'=>'休闲益智','2'=>'网络游戏','3'=>'体育竞速','4'=>'角色扮演','5'=>'飞行射击','6'=>'策略经营','7'=>'卡片棋牌','8'=>'动作冒险');
		$lan  = array('1'=>'中文','0'=>'英文');
		$this->assign ('lan',$lan);
    	$this->assign ('type', $type);
		/*热门攻略*/
		/**
		 *修改时间2016/01/11 13：18：01
		 *@author yu<thebestyu@126.com>
		 */
		$hotarticle=sp_sql_posts("cid:64;field:post_title,post_excerpt,tid,smeta;order:post_date desc;limit:6;"); 
		$this->assign ('hotarticle', $hotarticle);
    	/*更多游戏*/
        $moremap['isdisplay'] = "1";
        $morelist  = M('m_game')->where($moremap)->order('listorder desc')->limit('12')->getField('id,pic3,gamename');
    	$this->assign ('morelist', $morelist);
        /*合作伙伴*/
        $adlist=  M('links')->where(array('webid'=>0,'link_status'=>1))->order('listorder desc')->limit('6')->select();
    	$this->assign ('adlist', $adlist);

    	/*资讯中心、平台公告*/
        $news = sp_sql_posts("cid:62;field:post_title,post_excerpt,tid,object_id,post_modified;order:post_date desc;limit:6;"); 
    	$tip = sp_sql_posts("cid:63;field:post_title,post_excerpt,tid,object_id,post_modified;order:post_date desc;limit:10;"); 
        $this->assign ('news', $news);
        $this->assign ('tip', $tip);
        $this->display($this->template.'/template1'.'/Index'.'/index');
    }

}


