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.

121 lines
5.0 KiB
PHTML

5 years ago
<?php
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class SpendController extends ThinkController {
const model_name = 'Spend';
public function lists(){
if(isset($_REQUEST['user_account'])){
5 years ago
$map['tab_spend.user_account']=array('like','%'.trim($_REQUEST['user_account']).'%');
5 years ago
unset($_REQUEST['user_account']);
}
if(isset($_REQUEST['spend_ip'])){
5 years ago
$map['tab_spend.spend_ip']=array('like','%'.trim($_REQUEST['spend_ip']).'%');
5 years ago
unset($_REQUEST['spend_ip']);
}
if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){
5 years ago
$map['tab_spend.pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1));
5 years ago
unset($_REQUEST['time-start']);unset($_REQUEST['time-end']);
}elseif(isset($_REQUEST['time-start'])){
5 years ago
$map['tab_spend.pay_time'] = ['GT',strtotime(I('time-start'))];
5 years ago
unset($_REQUEST['time-start']);
}elseif(isset($_REQUEST['time-end'])){
5 years ago
$map['tab_spend.pay_time'] = ['LT',strtotime(I('time-end'))+86399];
5 years ago
unset($_REQUEST['time-end']);
}
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
5 years ago
$map['tab_spend.pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
5 years ago
unset($_REQUEST['start']);unset($_REQUEST['end']);
}elseif(isset($_REQUEST['start'])){
5 years ago
$map['tab_spend.pay_time'] = ['GT',strtotime(I('start'))];
5 years ago
unset($_REQUEST['start']);
}elseif(isset($_REQUEST['end'])){
5 years ago
$map['tab_spend.pay_time'] = ['LT',strtotime(I('end'))+86399];
5 years ago
unset($_REQUEST['end']);
}
if(isset($_REQUEST['game_name'])){
if($_REQUEST['game_name']=='全部'){
unset($_REQUEST['game_name']);
}else{
5 years ago
$map['tab_spend.game_name']=$_REQUEST['game_name'];
5 years ago
unset($_REQUEST['game_name']);
}
}
if(isset($_REQUEST['server_name'])){
5 years ago
$map['tab_spend.server_name']=$_REQUEST['server_name'];
5 years ago
unset($_REQUEST['server_name']);
}
if(isset($_REQUEST['pay_order_number'])){
5 years ago
$map['tab_spend.pay_order_number']=array('like','%'.trim($_REQUEST['pay_order_number']).'%');
5 years ago
unset($_REQUEST['pay_order_number']);
}
if(isset($_REQUEST['pay_status'])){
5 years ago
$map['tab_spend.pay_status']=$_REQUEST['pay_status'];
5 years ago
unset($_REQUEST['pay_status']);
}
if(isset($_REQUEST['pay_way'])){
if($_REQUEST['pay_way']==2){
5 years ago
$map['tab_spend.pay_way']=['in','2,3,4'];
5 years ago
}else{
5 years ago
$map['tab_spend.pay_way']=$_REQUEST['pay_way'];
5 years ago
}
unset($_REQUEST['pay_way']);
}
if(isset($_REQUEST['pay_game_status'])){
5 years ago
$map['tab_spend.pay_game_status']=$_REQUEST['pay_game_status'];
5 years ago
unset($_REQUEST['pay_game_status']);
}
5 years ago
if(isset($_REQUEST['promote_id'])) {
5 years ago
if ($_REQUEST['promote_id'] == 0) {
$map['promote_id'] = 0;
} else {
5 years ago
$map['_complex'] = ['tp.chain'=>['like', "%/{$_REQUEST['promote_id']}/%"], 'tp.id'=>$_REQUEST['promote_id'], '_logic' => 'or'];
5 years ago
}
5 years ago
$tab_promote_join = "left join tab_promote as tp on tp.id = tab_spend.promote_id";
//unset($_REQUEST['promote_id']);
} else {
$tab_promote_join = false;
}
5 years ago
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$this->assign('userarpu_order',$data_order);
$this->assign('userarpu_order_type',$data_order_type);
$sort = $data_order==3?'desc':'asc';
$order = $data_order_type.' '.$sort;
} else {
$order = ' pay_time desc ';
}
$map1=$map;
$map1['pay_status']=1;
5 years ago
$total=null_to_0(D(self::model_name)->where($map1)->join($tab_promote_join)->sum('pay_amount'));
$ttotal=null_to_0(D(self::model_name)->where('pay_time'.total(1))->where(array('pay_status'=>1))->join($tab_promote_join)->sum('pay_amount'));
$ytotal=null_to_0(D(self::model_name)->where('pay_time'.total(5))->where(array('pay_status'=>1))->join($tab_promote_join)->sum('pay_amount'));
5 years ago
$this->assign('total',$total);
$this->assign('ttotal',$ttotal);
$this->assign('ytotal',$ytotal);
$this->meta_title = $this->m_title = '游戏充值';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Spend/lists','status'=>1])->find());
/*parent::lists(self::model_name,$_GET["p"],$map);*/
$data = D(self::model_name)->lists($_GET["p"], $map, $order);
$this->assign('list_data',$data['data']);
$this->assign('_page',$data['page']);
$this->display();
}
5 years ago
5 years ago
}