From 85b821081fa4fe96723fc84e735fe237ef4316e9 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 26 Dec 2019 17:39:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A8=E5=B9=BF=E5=91=98?= =?UTF-8?q?=E5=85=85=E5=80=BC=E7=BB=9F=E8=AE=A1=E4=BB=8A=E6=97=A5=E6=9C=AC?= =?UTF-8?q?=E5=91=A8=E6=9C=AC=E6=9C=88=E4=B8=8D=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PlatformController.class.php | 76 ++++++++++--------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index 6e4a63871..f31938318 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -594,20 +594,18 @@ class PlatformController extends ThinkController $map1['promote_id'] = $map['promote_id'] = array('egt', 0); $spend = M('Spend', 'tab_'); if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { - $map['create_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)]; - $pay_time = " between " . strtotime($_REQUEST['timestart']) . " and " . (strtotime($_REQUEST['timeend']) + 86399) . " "; + $map['pay_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)]; unset($_REQUEST['timestart']); unset($_REQUEST['timeend']); } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { - $map['create_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())]; - $pay_time = " between " . strtotime($_REQUEST['timestart']) . " and " . time() . " "; + $map['pay_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())]; unset($_REQUEST['timestart']); } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { - $map['create_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; - $pay_time = " between 0 and " . (strtotime($_REQUEST['timeend']) + 86399) . " "; + $map['pay_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; unset($_REQUEST['timeend']); } else { - $pay_time = " between 0 and " . time(); + $map['pay_time'] = ['between', array(0, time())]; + // $pay_time = " between 0 and " . time(); } $map1['pay_status'] = $map['pay_status'] = 1; $today = total(1); @@ -628,6 +626,17 @@ class PlatformController extends ThinkController $pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->where($promote_map2)->find()['acount']; // var_dump( $promote); + $tweek = total(2,false); + $tmonth = total(3,false); + //获取最小 + $tmin = 0; + if($tweek[1][0] < $tmonth[1][0]){ + $tmin = $tweek[1][0]; + }else{ + $tmin = $tmonth[1][0]; + } + + $data =array(); for ($i=0; $i < count($promote); $i++) { # code... @@ -645,30 +654,29 @@ class PlatformController extends ThinkController $map['server_name'] = $_REQUEST['server_id']; unset($_REQUEST['server_id']); } - $dbdata = $spend - ->field(' - floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count, - floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today, - floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week, - floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth') - ->where($map) - ->where("pay_time".$pay_time) - ->find(); - $dbdata['promote_account'] = $promote[$i]['account']; - $dbdata['promote_id'] = $promote[$i]['id']; - } else { - $dbdata = $spend - ->field(' - floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count, - floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today, - floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week, - floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth') - ->where($map) - ->where("pay_time".$pay_time) - ->find(); - $dbdata['promote_account'] = $promote[$i]['account']; - $dbdata['promote_id'] = $promote[$i]['id']; + } + $dbdata = $spend + ->field('floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count') + ->where($map) + ->find(); + $tmap = $map; + if(isset($map['pay_time'])){ + $tmap['pay_time'] = ['between', array($tmin,$tmonth[1][1])]; } + $tdbdata = $spend + ->field(' + floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today, + floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week, + floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth') + ->where($tmap) + ->find(); + $dbdata['today']= $tdbdata['today']; + $dbdata['week']= $tdbdata['week']; + $dbdata['mounth']= $tdbdata['mounth']; + + $dbdata['promote_account'] = $promote[$i]['account']; + $dbdata['promote_id'] = $promote[$i]['id']; + $data[] = $dbdata; } $count = count($data); @@ -812,10 +820,10 @@ class PlatformController extends ThinkController $data[$key]['today']=$adata['today']==''?0:$adata['today']; $data[$key]['week']=$adata['week']==''?0:$adata['week']; $data[$key]['mounth']=$adata['mounth']==''?0:$adata['mounth']; */ -// if ($data[$key]['promote_id'] == '0') { -// unset($data[$key]); -// } - } + // if ($data[$key]['promote_id'] == '0') { + // unset($data[$key]); + // } + } $total = $this->data_total($data); $this->assign('total', $total); if ($_REQUEST['data_order'] != '') {