@ -594,20 +594,18 @@ class PlatformController extends ThinkController
$map1['promote_id'] = $map['promote_id'] = array('egt', 0);
$map1['promote_id'] = $map['promote_id'] = array('egt', 0);
$spend = M('Spend', 'tab_');
$spend = M('Spend', 'tab_');
if (!empty($_REQUEST['timestart']) & & !empty($_REQUEST['timeend'])) {
if (!empty($_REQUEST['timestart']) & & !empty($_REQUEST['timeend'])) {
$map['create_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)];
$map['pay_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)];
$pay_time = " between " . strtotime($_REQUEST['timestart']) . " and " . (strtotime($_REQUEST['timeend']) + 86399) . " ";
unset($_REQUEST['timestart']);
unset($_REQUEST['timestart']);
unset($_REQUEST['timeend']);
unset($_REQUEST['timeend']);
} elseif (!empty($_REQUEST['timestart']) & & empty($_REQUEST['timeend'])) {
} elseif (!empty($_REQUEST['timestart']) & & empty($_REQUEST['timeend'])) {
$map['create_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())];
$map['pay_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())];
$pay_time = " between " . strtotime($_REQUEST['timestart']) . " and " . time() . " ";
unset($_REQUEST['timestart']);
unset($_REQUEST['timestart']);
} elseif (empty($_REQUEST['timestart']) & & !empty($_REQUEST['timeend'])) {
} elseif (empty($_REQUEST['timestart']) & & !empty($_REQUEST['timeend'])) {
$map['create_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399];
$map['pay_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399];
$pay_time = " between 0 and " . (strtotime($_REQUEST['timeend']) + 86399) . " ";
unset($_REQUEST['timeend']);
unset($_REQUEST['timeend']);
} else {
} 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;
$map1['pay_status'] = $map['pay_status'] = 1;
$today = total(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'];
$pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->where($promote_map2)->find()['acount'];
// var_dump( $promote);
// 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();
$data =array();
for ($i=0; $i < count ( $ promote ) ; $ i + + ) {
for ($i=0; $i < count ( $ promote ) ; $ i + + ) {
# code...
# code...
@ -645,30 +654,29 @@ class PlatformController extends ThinkController
$map['server_name'] = $_REQUEST['server_id'];
$map['server_name'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
unset($_REQUEST['server_id']);
}
}
}
$dbdata = $spend
$dbdata = $spend
->field('
->field('floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count')
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($map)
->where("pay_time".$pay_time)
->find();
->find();
$dbdata['promote_account'] = $promote[$i]['account'];
$tmap = $map;
$dbdata['promote_id'] = $promote[$i]['id'];
if(isset($map['pay_time'])){
} else {
$tmap['pay_time'] = ['between', array($tmin,$tmonth[1][1])];
$dbdata = $spend
}
$tdbdata = $spend
->field('
->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 ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
->where($map)
->where($tmap)
->where("pay_time".$pay_time)
->find();
->find();
$dbdata['today']= $tdbdata['today'];
$dbdata['week']= $tdbdata['week'];
$dbdata['mounth']= $tdbdata['mounth'];
$dbdata['promote_account'] = $promote[$i]['account'];
$dbdata['promote_account'] = $promote[$i]['account'];
$dbdata['promote_id'] = $promote[$i]['id'];
$dbdata['promote_id'] = $promote[$i]['id'];
}
$data[] = $dbdata;
$data[] = $dbdata;
}
}
$count = count($data);
$count = count($data);