|
|
|
@ -9,29 +9,33 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
//排序
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
//时间
|
|
|
|
|
$istimeselect = false;
|
|
|
|
|
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
|
|
|
|
|
$pmap['create_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
|
|
|
|
|
$istimeselect = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
|
|
|
|
|
} elseif (isset($_REQUEST['time_start'])) {
|
|
|
|
|
$pmap['create_time'] = ['GT', strtotime($_REQUEST['time_start'])];
|
|
|
|
|
$istimeselect = ['GT', strtotime($_REQUEST['time_start'])];
|
|
|
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
|
|
|
$pmap['create_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
$istimeselect = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$senddata = [];
|
|
|
|
|
//获取各会长的现金充值
|
|
|
|
|
$cash = self::getJoinPromoteData(array("pay_way"=>array("GT",0)));
|
|
|
|
|
$cash = self::getJoinPromoteData(array("pay_way"=>array("GT",0)),$istimeselect);
|
|
|
|
|
foreach($cash as $k=>$v){
|
|
|
|
|
$v['cash_count'] = $v['pay_amount'];
|
|
|
|
|
unset($v['pay_amount']);
|
|
|
|
|
$senddata[$v['p_id']] = $v;
|
|
|
|
|
}
|
|
|
|
|
//平台币直充支出
|
|
|
|
|
$balance = self::getJoinPromoteData(array("pay_way"=>array("EQ",0)));
|
|
|
|
|
$balance = self::getJoinPromoteData(array("pay_way"=>array("EQ",0)),$istimeselect);
|
|
|
|
|
foreach($balance as $k=>$v){
|
|
|
|
|
if(array_key_exists($v['p_id'],$senddata)){
|
|
|
|
|
$senddata[$v['p_id']]['balance_coin_count']= $v['pay_amount'];
|
|
|
|
@ -42,7 +46,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
//平台币内充
|
|
|
|
|
$bind = self::getJoinPromoteData(array("pay_way"=>array("LT",0)));
|
|
|
|
|
$bind = self::getJoinPromoteData(array("pay_way"=>array("LT",0)),$istimeselect);
|
|
|
|
|
foreach($bind as $k=>$v){
|
|
|
|
|
if(array_key_exists($v['p_id'],$senddata)){
|
|
|
|
|
$senddata[$v['p_id']]['bind_coin_count']= $v['pay_amount'];
|
|
|
|
@ -53,7 +57,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
//内冲
|
|
|
|
|
$inside = self::getJoinPromoteData([],"promote_coin");
|
|
|
|
|
$inside = self::getJoinPromoteData([],$istimeselect,"promote_coin");
|
|
|
|
|
foreach($inside as $k=>$v){
|
|
|
|
|
if(array_key_exists($v['p_id'],$senddata)){
|
|
|
|
|
$senddata[$v['p_id']]['inside_cash_count']= $v['pay_amount'];
|
|
|
|
@ -65,6 +69,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){
|
|
|
|
|
$pmap['status']=1;
|
|
|
|
|
$pmap['create_time'] = $istimeselect;
|
|
|
|
|
|
|
|
|
|
$admininside = M("provide_user p","tab_")->field("sum(amount) amount")->where($pmap)->find();
|
|
|
|
|
if($admininside['amount'] >0){
|
|
|
|
@ -101,7 +106,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$this->display();
|
|
|
|
|
# code...
|
|
|
|
|
}
|
|
|
|
|
private function getJoinPromoteData($map,$type="spend")
|
|
|
|
|
private function getJoinPromoteData($map,$istimeselect,$type="spend")
|
|
|
|
|
{
|
|
|
|
|
if ($_REQUEST['promote_id'] != '') {
|
|
|
|
|
if ($_REQUEST['promote_id'] == 0) {
|
|
|
|
@ -113,19 +118,14 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($type == "spend"){
|
|
|
|
|
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
|
|
|
|
|
$map["s.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
|
|
|
|
|
$map['s.pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
|
|
|
|
|
} elseif (isset($_REQUEST['time_start'])) {
|
|
|
|
|
$map['s.pay_time'] = ['GT', strtotime($_REQUEST['time_start'])];
|
|
|
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
|
|
|
$maps['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
if($istimeselect){
|
|
|
|
|
$map['s.pay_time']=$istimeselect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$map['s.pay_status']=1;
|
|
|
|
|
$field= "sum(pay_amount) pay_amount,IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,IFNULL(company_id,0) company_id,company_name";
|
|
|
|
|
return M()
|
|
|
|
@ -137,12 +137,8 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->group('p_id')
|
|
|
|
|
->select();
|
|
|
|
|
}else{
|
|
|
|
|
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
|
|
|
|
|
$map['s.create_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
|
|
|
|
|
} elseif (isset($_REQUEST['time_start'])) {
|
|
|
|
|
$map['s.create_time'] = ['GT', strtotime($_REQUEST['time_start'])];
|
|
|
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
|
|
|
$maps['s.create_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
if($istimeselect){
|
|
|
|
|
$map['s.create_time']=$istimeselect;
|
|
|
|
|
}
|
|
|
|
|
$map['s.status']=1;
|
|
|
|
|
$map['s.source_id']=0;
|
|
|
|
@ -157,6 +153,9 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//渠道查看
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|