diff --git a/Application/Admin/Controller/DepositController.class.php b/Application/Admin/Controller/DepositController.class.php index b386cddb7..181ef0ba5 100644 --- a/Application/Admin/Controller/DepositController.class.php +++ b/Application/Admin/Controller/DepositController.class.php @@ -10,7 +10,7 @@ use User\Api\UserApi as UserApi; class DepositController extends ThinkController { const model_name = 'Deposit'; - public function lists(){ + public function lists($p = 1){ if(isset($_REQUEST['user_account'])){ $map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%'); unset($_REQUEST['user_account']); @@ -38,16 +38,10 @@ class DepositController extends ThinkController { }else if(isset($_REQUEST['promote_id']) && $_REQUEST['promote_id']==0){ $map['promote_id']=array('elt',0); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); }elseif(isset($_REQUEST['promote_name'])&&$_REQUEST['promote_id']==-1){ $map['promote_id']=get_promote_id($_REQUEST['promote_name']); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); }else{ $map['promote_id']=$_REQUEST['promote_id']; - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); @@ -94,6 +88,47 @@ class DepositController extends ThinkController { $map1=$map; $map1['pay_status']=1; + + if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + $map1['order_status'] = 1; + unset($map1['pay_status']); + if ($map['pay_status']) { + $map['order_status']=$map['pay_status']; + } + + $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); + $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); + $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); + $this->assign('total',$total); + $this->assign('ttotal',$ttotal); + $this->assign('ytotal',$ytotal); + + $data = D('coin_pay_order') + /* 查询指定字段,不指定则查询所有字段 */ + ->field('*,order_status as pay_status') + // 查询条件 + ->where($map) + /* 默认通过id逆序排列 */ + ->order("id desc") + /* 数据分页 */ + ->page($page, $row) + /* 执行查询 */ + ->select(); + + /* 查询记录总数 */ + $count = D('coin_pay_order')->where($map)->count(); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign('list_data', $data); + $this->meta_title = '平台币充值列表'; + $this->display('lists');die(); + } + $total=null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); $ttotal=null_to_0(D(self::model_name)->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); $ytotal=null_to_0(D(self::model_name)->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); @@ -105,6 +140,7 @@ class DepositController extends ThinkController { $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Deposit/lists','status'=>1])->find()); $this->assign("is_admin",is_administrator()); + parent::lists(self::model_name,$_GET["p"],$map); } diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 1fa5726cf..cb51513f8 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1235,16 +1235,10 @@ class ExportController extends Controller } else if (isset($_REQUEST['promote_id']) && $_REQUEST['promote_id'] == 0) { $map['promote_id'] = array('elt', 0); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } elseif (isset($_REQUEST['promote_name']) && $_REQUEST['promote_id'] == -1) { $map['promote_id'] = get_promote_id($_REQUEST['promote_name']); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } else { $map['promote_id'] = $_REQUEST['promote_id']; - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) { $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1)); @@ -1266,30 +1260,70 @@ class ExportController extends Controller } $map1 = $map; $map1['pay_status'] = 1; - $total = D('Deposit')->where($map1)->sum('pay_amount'); - if (isset($map['pay_status']) && $map['pay_status'] == 0) { - $total = sprintf("%.2f", 0); + + if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') { + + $map1['order_status'] = 1; + unset($map1['pay_status']); + if ($map['pay_status']) { + $map['order_status']=$map['pay_status']; + } + + $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); + + if (isset($map['pay_status']) && $map['pay_status'] == 0) { + $total = sprintf("%.2f", 0); + } else { + $total = sprintf("%.2f", $total); + } + $xlsCell = array( + array('pay_order_number', "订单号"), + array('promote_account', L('Subordinate_channel')), + array('pay_amount', "充值平台币"), + array('pay_way', "充值方式", 'get_pay_way', '*'), + array('create_time', "充值时间"), + array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), + array('', "共计充值{$total}"), + ); + $xlsData = D('coin_pay_order') + /* 查询指定字段,不指定则查询所有字段 */ + ->field('*,order_status as pay_status') + // 查询条件 + ->where($map) + /* 默认通过id逆序排列 */ + ->order("id desc") + /* 执行查询 */ + ->select(); +// var_dump($xlsData);die(); + foreach ($xlsData as $key => $value) { + $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); + } } else { - $total = sprintf("%.2f", $total); - } + $total = D('Deposit')->where($map1)->sum('pay_amount'); + if (isset($map['pay_status']) && $map['pay_status'] == 0) { + $total = sprintf("%.2f", 0); + } else { + $total = sprintf("%.2f", $total); + } - $xlsCell = array( - array('pay_order_number', "订单号"), - array('user_account', "玩家账号"), - array('promote_account', L('Subordinate_channel')), - array('pay_amount', "充值平台币"), - array('pay_way', "充值方式", 'get_pay_way', '*'), - array('pay_ip', "充值ip"), - array('create_time', "充值时间"), - array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), - array('', "共计充值{$total}"), - ); - $xlsData = D('Deposit') - ->where($map) - ->order('id DESC') - ->select(); - foreach ($xlsData as $key => $value) { - $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); + $xlsCell = array( + array('pay_order_number', "订单号"), + array('user_account', "玩家账号"), + array('promote_account', L('Subordinate_channel')), + array('pay_amount', "充值平台币"), + array('pay_way', "充值方式", 'get_pay_way', '*'), + array('pay_ip', "充值ip"), + array('create_time', "充值时间"), + array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), + array('', "共计充值{$total}"), + ); + $xlsData = D('Deposit') + ->where($map) + ->order('id DESC') + ->select(); + foreach ($xlsData as $key => $value) { + $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); + } } // dd($xlsData); break; diff --git a/Application/Admin/View/Deposit/lists.html b/Application/Admin/View/Deposit/lists.html index 2f11a20f0..fa8e433dd 100644 --- a/Application/Admin/View/Deposit/lists.html +++ b/Application/Admin/View/Deposit/lists.html @@ -78,21 +78,21 @@ - - - - - - - - - - - - - - - +