diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index 0140f1f6b..7c6da3112 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -644,16 +644,79 @@ class FinancePromoteController extends AdminController //平台币内充弹框 public function insideCoinDetail($p = 1) { - $isgf = false;//是否事官方渠道 + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + //时间 + $istimeselect = false; + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $istimeselect = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]]; + } elseif (isset($_REQUEST['time_start'])) { + $istimeselect = ['GT', strtotime($_REQUEST['time_start'])]; + } elseif (isset($_REQUEST['time_end'])) { + $istimeselect = ['LT', strtotime($_REQUEST['time_end']) + 86399]; + } + + //是否是官方渠道 + $isgf = false; if ($_REQUEST['promote_id'] != '') { if($_REQUEST['promote_id'] == 0){ $isgf = true; } - $map['tab_spend.promote_id'] = $_REQUEST['promote_id']; + $map['s.promote_id'] = $_REQUEST['promote_id']; } + // + $senddata = []; + $count =0; + $total_cost = 0; if($isgf){ + $pmap['status']=1; + if($istimeselect){ + $pmap['create_time'] = $istimeselect; + } + $admininside = M("provide_user p","tab_") + ->field("order_number,user_account,amount,balance") + ->join("left join tab_user as u on u.id = p.user_id") + ->page($page, $row) + ->where($pmap) + ->select(); + foreach ($admininside as $k => $v) { + $temp = [ + "sn"=>$v['order_number'], + "op_type"=>"收入", + "op_sty"=>"后台发放玩家", + "" + ]; + # code... + } + $admincount = M("provide_user p","tab_")->field("sum(amount) amount,count(*) count")->where($pmap)->find(); + $count = $admincount["count"]?:0; + $total_cost = $admincount["amount"]?:0; + }else{ + if($istimeselect){ + $map['s.create_time']=$istimeselect; + } + $map['s.status']=1; + $map['s.source_id']=0; + $field= "num,sn,promote.balance_coin,account,s.type"; + $ininside = M("promote_coin s","tab_") + ->field($field) + ->where($map) + ->page($page, $row) + ->join("tab_promote promote ON s.promote_id = promote.id","left") + ->select(); + $ininsidecount = M("promote_coin s","tab_") + ->field("SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,count(*) count") + ->where($map) + ->find(); + $count = $ininsidecount["count"]?:0; + $total_cost = ($ininsidecount["pay_amount"]-$ininsidecount["back_amount"]); }