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.
181 lines
7.8 KiB
PHTML
181 lines
7.8 KiB
PHTML
5 years ago
|
<?php
|
||
|
namespace Mobile\Controller;
|
||
|
use Think\Controller;
|
||
|
use User\Api\SuserApi;
|
||
|
|
||
|
/**
|
||
|
* 首页
|
||
|
*/
|
||
|
class InvitationController extends BaseController {
|
||
|
|
||
|
public function index(){
|
||
|
|
||
|
$this->assign('mate_title',"邀请好友");$member = new SuserApi;
|
||
|
$data = A('Share')->get_share_url($member->login_info('account'));
|
||
|
if($this->islogin()){
|
||
|
$invitaionData = A('Share')->get_user_invite_info($member->login_info("user_id"));
|
||
|
$islogin = 1;
|
||
|
}
|
||
|
$invitaionData['invite_num'] = empty($invitaionData['invite_num'])?0:$invitaionData['invite_num'];
|
||
|
$invitaionData['award_coin'] = empty($invitaionData['award_coin'])?0:$invitaionData['award_coin'];
|
||
|
$this->assign("data",$invitaionData);
|
||
|
$this->assign("islogin",$islogin);
|
||
|
$this->assign('url',$data);
|
||
|
$this->display();
|
||
|
}
|
||
|
|
||
|
|
||
|
public function discountgamelist(){
|
||
|
$page = $page ? $page : 1; //默认显示第一页数据
|
||
|
$row = C('LIST_ROWS');
|
||
|
$name = I('post.name');
|
||
|
$model = M('Game','tab_');
|
||
|
|
||
|
$promote_id = empty(PROMOTE_ID) ? 0 : PROMOTE_ID;
|
||
|
if(UID>0) {
|
||
|
if($promote_id>0) {
|
||
|
$rebate_join = " and (r.promote_id = -1 or r.promote_id = -2) ";
|
||
|
$pw_join =" and (pw.promote_id = -1 or pw.promote_id = -2) ";
|
||
|
} else {
|
||
|
$rebate_join = " and (r.promote_id = -1 or r.promote_id = 0) ";
|
||
|
$pw_join =" and (pw.promote_id = -1 or pw.promote_id = 0) ";
|
||
|
}
|
||
|
} else {
|
||
|
$rebate_join = " and r.promote_id = -1";
|
||
|
$pw_join =" and pw.promote_id = -1 ";
|
||
|
}
|
||
|
$time = NOW_TIME;
|
||
|
if(is_mobile_request()){
|
||
|
$devices = get_devices_type();
|
||
|
$where['g.sdk_version'] = array('like','%'.$devices.'%');
|
||
|
}
|
||
|
$where['g.game_status'] = 1;
|
||
|
$where['g.display_site'] = ['like','%'. DISPLAY_SITE .'%'];
|
||
|
$where['g.apply_status'] = 1;
|
||
|
$where['g.online_status'] = 1;
|
||
|
//$where['bind_recharge_discount'] = [['gt',0],['lt',10]];
|
||
|
if(trim($name)){
|
||
|
$where['g.relation_game_name'] = ['like','%'.$name.'%'];
|
||
|
}
|
||
|
$data = $model
|
||
|
->alias('g')
|
||
|
->field('g.id,g.relation_game_id,g.game_name,g.relation_game_name,g.icon,g.dow_num,g.marking,g.game_size,g.game_score,g.dow_status,g.features,g.and_dow_address,g.ios_dow_address,g.add_game_address,g.ios_game_address,g.bind_recharge_discount as discount,s.pack_name,IFNULL(r.ratio,0) as ratio,IFNULL(pw.continue_discount,-1) as continue_discount,IFNULL(pw.first_discount,-1) as first_discount,IFNULL(pw.promote_status,-1) as promote_status,IFNULL(pw.cont_status,-1) as cont_status')
|
||
|
//游戏原包
|
||
|
->join("left join tab_game_source as s on s.game_id = g.id")
|
||
|
//折扣
|
||
|
->join("left join tab_rebate r on r.game_id = g.id {$rebate_join} and r.starttime < {$time} and (endtime = 0 or endtime > {$time})")
|
||
|
->join("left join tab_promote_welfare as pw on (pw.status=2 {$pw_join} and (pw.promote_status=1 or pw.cont_status=1) and pw.game_id = g.id) ")
|
||
|
->where($where)
|
||
|
->page($page, $row)
|
||
|
->order('g.sort desc')
|
||
|
->having('(discount=10 and(continue_discount>0 or first_discount>0)) or (discount<10) or ratio>0')
|
||
|
//->group("g.relation_game_id")
|
||
|
->select();
|
||
|
foreach ($data as $key => $val){
|
||
|
$data[$key]['icon'] = get_cover($val['icon'],'path');
|
||
|
$data[$key]['game_score'] = round($val['game_score'] / 2);
|
||
|
if(!is_mobile_request()){
|
||
|
$data[$key]['relation_game_name'] = $val['game_name'];
|
||
|
}
|
||
|
}
|
||
|
$this->assign('data',$data);
|
||
|
$this->assign('page',$page);
|
||
|
$this->assign('name',$name);
|
||
|
$this->assign('mate_title',"折扣专区");
|
||
|
$this->display();
|
||
|
}
|
||
|
|
||
|
|
||
|
public function discountgamelist2(){
|
||
|
$page = $page ? $page : 1; //默认显示第一页数据
|
||
|
$row = C('LIST_ROWS');
|
||
|
$name = I('post.name');
|
||
|
$model = M('Game','tab_');
|
||
|
|
||
|
$promote_id = empty(PROMOTE_ID) ? 0 : PROMOTE_ID;
|
||
|
$rebate_join = "and (r.promote_id = {$promote_id} or r.promote_id = -1)";
|
||
|
$time = NOW_TIME;
|
||
|
if(is_mobile_request()){
|
||
|
$devices = get_devices_type();
|
||
|
$where['g.sdk_version'] = array('like','%'.$devices.'%');
|
||
|
}
|
||
|
$where['g.game_status'] = 1;
|
||
|
$where['g.display_site'] = ['like','%'. DISPLAY_SITE .'%'];
|
||
|
$where['g.apply_status'] = 1;
|
||
|
$where['g.online_status'] = 1;
|
||
|
$where['bind_recharge_discount'] = [['gt',0],['lt',10]];
|
||
|
if(trim($name)){
|
||
|
$where['g.relation_game_name'] = ['like','%'.$name.'%'];
|
||
|
}
|
||
|
$data = $model
|
||
|
->alias('g')
|
||
|
->field('g.id,g.relation_game_id,g.game_name,g.relation_game_name,g.icon,g.dow_num,g.marking,g.game_size,g.game_score,g.dow_status,g.features,g.and_dow_address,g.ios_dow_address,g.add_game_address,g.ios_game_address,g.bind_recharge_discount as discount,s.pack_name,IFNULL(r.ratio,0) as ratio')
|
||
|
//游戏原包
|
||
|
->join("left join tab_game_source as s on s.game_id = g.id")
|
||
|
//折扣
|
||
|
->join("left join tab_rebate r on r.game_id = g.id {$rebate_join} and r.starttime < {$time} and endtime = 0 or endtime > {$time}")
|
||
|
->where($where)
|
||
|
->page($page, $row)
|
||
|
->order('g.sort desc')
|
||
|
//->group("g.relation_game_id")
|
||
|
->select();
|
||
|
foreach ($data as $key => $val){
|
||
|
$data[$key]['icon'] = get_cover($val['icon'],'path');
|
||
|
$data[$key]['game_score'] = round($val['game_score'] / 2);
|
||
|
if(!is_mobile_request()){
|
||
|
$data[$key]['relation_game_name'] = $val['game_name'];
|
||
|
}
|
||
|
}
|
||
|
$this->assign('data',$data);
|
||
|
$this->assign('page',$page);
|
||
|
$this->assign('name',$name);
|
||
|
$this->assign('mate_title',"折扣专区");
|
||
|
$this->display();
|
||
|
}
|
||
|
|
||
|
|
||
|
public function ajaxlists() {
|
||
|
$p = I('post.p');
|
||
|
$status = 0;
|
||
|
$row = C('LIST_ROWS');
|
||
|
$name = I('post.name');
|
||
|
$model = M('Game','tab_');
|
||
|
|
||
|
$promote_id = empty(PROMOTE_ID) ? 0 : PROMOTE_ID;
|
||
|
$rebate_join = "and (r.promote_id = {$promote_id} or r.promote_id = -1)";
|
||
|
$time = NOW_TIME;
|
||
|
if(is_mobile_request()){
|
||
|
$devices = get_devices_type();
|
||
|
$where['g.sdk_version'] = array('like','%'.$devices.'%');
|
||
|
}
|
||
|
$where['g.game_status'] = 1;
|
||
|
$where['g.display_site'] = ['like','%'. DISPLAY_SITE .'%'];
|
||
|
$where['g.apply_status'] = 1;
|
||
|
$where['g.online_status'] = 1;
|
||
|
$where['bind_recharge_discount'] = [['gt',0],['lt',10]];
|
||
|
if(trim($name)){
|
||
|
$where['g.relation_game_name'] = ['like','%'.$name.'%'];
|
||
|
}
|
||
|
|
||
|
$data = $model
|
||
|
->alias('g')
|
||
|
->field('g.id,g.relation_game_id,g.relation_game_name,g.icon,g.dow_num,g.marking,g.game_size,g.game_score,g.dow_status,g.features,g.and_dow_address,g.ios_dow_address,g.add_game_address,g.ios_game_address,g.bind_recharge_discount as discount,s.pack_name,IFNULL(r.ratio,0) as ratio')
|
||
|
//游戏原包
|
||
|
->join("left join tab_game_source as s on s.game_id = g.id")
|
||
|
//折扣
|
||
|
->join("left join tab_rebate r on r.game_id = g.id {$rebate_join} and r.starttime < {$time} and endtime = 0 or endtime > {$time}")
|
||
|
->where($where)
|
||
|
->page($p, $row)
|
||
|
->order('g.sort desc')
|
||
|
// ->group("g.relation_game_id")
|
||
|
->select();
|
||
|
foreach ($data as $key => $val){
|
||
|
$data[$key]['icon'] = get_cover($val['icon'],'path');
|
||
|
$data[$key]['game_score'] = round($val['game_score'] / 2);
|
||
|
}
|
||
|
|
||
|
if (!empty($data) && is_array($data)) {$status=1;}
|
||
|
|
||
|
echo json_encode(array('status'=>$status,'page'=>$p,'data'=>$data));
|
||
|
}
|
||
|
}
|