You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.6 KiB
PHP
105 lines
2.6 KiB
PHP
<?php
|
|
namespace Site\Controller;
|
|
|
|
use Think\Controller;
|
|
|
|
/**
|
|
* 游戏 控制器
|
|
* lwx
|
|
*/
|
|
class GameController extends BaseController {
|
|
|
|
const model_name = 'SiteGame';
|
|
|
|
public function index($p=1){
|
|
|
|
if (is_mobile_request()) {
|
|
|
|
$lists = D(self::model_name)->lists(1,'id,game_id,game_name,game_size,summary,sdk_version,download_number,game_icon,promote_id,game_source,game_dow_url');
|
|
$this->assign('lists',$lists['data']);
|
|
|
|
$this->assign('total',$lists['total']);
|
|
|
|
} else {
|
|
|
|
parent::page(D(self::model_name)->lists($p,'game_name,download_number,game_icon,game_source',21));
|
|
|
|
}
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
public function detail($name='',$source=1) {
|
|
|
|
$game = D(self::model_name)->detail($name,$source);
|
|
|
|
$this->other($game);
|
|
|
|
$this->assign('data',$game);
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
public function open($name='',$source=1,$p=0) {
|
|
|
|
$game = D(self::model_name)->base($name,$source);
|
|
|
|
$this->other($game);
|
|
$map['tab_site_server.game_id'] = array('in',$game['ids']);
|
|
parent::page(D('SiteServer')->all($p,$map,"tab_site_server.id,tab_site_server.server_name,tab_site_server.status,tab_site_server.start_time,tab_site_server.server_version",12));
|
|
$this->assign('data',$game);
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
public function gift($name='',$source=1,$p=0) {
|
|
|
|
$game = D(self::model_name)->base($name,$source);
|
|
|
|
$this->other($game);
|
|
parent::page(D('SiteGift')->all($p,['tab_site_gift.site_game_id'=>array('in',$game['ids']),'tab_site_gift.end_time'=>array(array('gt',time()),array('eq',0),'or')],'tab_site_gift.id,tab_site_gift.site_game_id,tab_site_gift.gift_name,tab_site_gift.gift_content,tab_site_gift.novice,tab_site_gift.giftbag_version,tab_site_gift.server_name,tab_site_gift.start_time,tab_site_gift.end_time',16));
|
|
$this->assign('data',$game);
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
public function other($game) {
|
|
|
|
if (is_mobile_request()) {
|
|
|
|
$this->assign('other',D(self::model_name)->limits(['game_type_id'=>$game['game_type_id'],'id'=>array('neq',$game['id'])],4));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function more($p=2) {
|
|
|
|
$lists = D(self::model_name)->lists($p,'id,game_id,game_name,game_size,summary,download_number,game_icon,game_source');
|
|
|
|
if ($lists['data']) {
|
|
|
|
echo json_encode(array('status'=>1,'info'=>'','list'=>$lists['data']));
|
|
|
|
} else {
|
|
|
|
echo json_encode(array('status'=>0,'info'=>''));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function setdownload($game_id,$promote_id){
|
|
if(empty($game_id))return '';
|
|
M('site_game','tab_')->where(array('id'=>$game_id,'promote_id'=>$promote_id))->setInc('download_number',1);
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} |