|
|
|
@ -260,12 +260,17 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
$senddata = [];
|
|
|
|
|
//获取各会长的现金充值
|
|
|
|
|
$cash = self::promoteUserData([],$istimeselect);
|
|
|
|
|
$map=[];
|
|
|
|
|
$title = '';
|
|
|
|
|
self::setPromoteMap($map,"s.promote_id",$title);
|
|
|
|
|
$title .= "渠道统计";
|
|
|
|
|
$this->assign('title', $title);
|
|
|
|
|
|
|
|
|
|
$cash = self::promoteUserData($map,$istimeselect);
|
|
|
|
|
foreach($cash as $k=>$v){
|
|
|
|
|
$senddata[$v['promote_id']] = $v;
|
|
|
|
|
}
|
|
|
|
|
$inside = self::promoteUserData([],$istimeselect,"promote_coin");
|
|
|
|
|
$inside = self::promoteUserData($map,$istimeselect,"promote_coin");
|
|
|
|
|
|
|
|
|
|
foreach($inside as $k=>$v){
|
|
|
|
|
if(array_key_exists($v['promote_id'],$senddata)){
|
|
|
|
@ -350,17 +355,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
private function promoteUserData($map,$istimeselect,$type="spend")
|
|
|
|
|
{
|
|
|
|
|
// setPowerPromoteIds($map,"s.promote_id");
|
|
|
|
|
if ($_REQUEST['promote_id'] != '') {
|
|
|
|
|
if ($_REQUEST['promote_id'] == 0) {
|
|
|
|
|
$map['s.promote_id'] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
|
|
|
|
|
if ($promoter_ids) {
|
|
|
|
|
$map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['company_id'])) {
|
|
|
|
|
$map['promote.company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
}
|
|
|
|
@ -400,7 +394,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->group('promote_id')
|
|
|
|
|
->select();
|
|
|
|
|
}
|
|
|
|
|
# code...
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*游戏统计
|
|
|
|
@ -409,7 +402,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$page = intval($p);
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
|
$row = $_REQUEST['row'] ?? 10;
|
|
|
|
|
$title = '';
|
|
|
|
|
$map = [];
|
|
|
|
|
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')) );
|
|
|
|
@ -425,70 +417,13 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
|
|
|
$map['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
}
|
|
|
|
|
//公司判断
|
|
|
|
|
$pmap = false; //非特意推广员检索
|
|
|
|
|
$gfflg = true; //是否有官方
|
|
|
|
|
if (isset($_REQUEST['company_id'])) {
|
|
|
|
|
$pmap['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
//获取公司名称
|
|
|
|
|
if($pmap['company_id'] == 0){
|
|
|
|
|
$title .= "万盟天下科技-";
|
|
|
|
|
}else{
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
$title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['company_belong'])) {
|
|
|
|
|
$pmap['company_belong'] = $_REQUEST['company_belong'];
|
|
|
|
|
if($_REQUEST['company_belong'] == 0){
|
|
|
|
|
$title .= "内团-";
|
|
|
|
|
}else{
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
$title .= "外团-";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
$pmap = false; //取消非特异推广员检索
|
|
|
|
|
$title .= (get_promote_name($_REQUEST['promote_id'])."-");
|
|
|
|
|
if ($_REQUEST['promote_id'] != 0){
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($pmap){
|
|
|
|
|
$promoter_ids = D("Promote")->where($pmap)->field('id')->select();
|
|
|
|
|
if ($promoter_ids) {
|
|
|
|
|
if($gfflg){
|
|
|
|
|
$t_in = "0,".implode(',', array_column($promoter_ids, 'id'));
|
|
|
|
|
}else{
|
|
|
|
|
$t_in = implode(',', array_column($promoter_ids, 'id'));
|
|
|
|
|
}
|
|
|
|
|
$map['s.promote_id'] = ['in',$t_in];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否有推广员
|
|
|
|
|
$level = 1;
|
|
|
|
|
if ($_REQUEST['promote_id'] != '') {
|
|
|
|
|
if ($_REQUEST['promote_id'] != 0){
|
|
|
|
|
$level = M('promote', 'tab_')->field('level')->where(array('id' => $_REQUEST['promote_id']))->find()['level'];
|
|
|
|
|
}
|
|
|
|
|
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
|
|
|
|
|
$map['s.promote_id'] = $_REQUEST['promote_id'];
|
|
|
|
|
} else {
|
|
|
|
|
//判断收有公司
|
|
|
|
|
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
|
|
|
|
|
if ($promoter_ids) {
|
|
|
|
|
$map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取推广员
|
|
|
|
|
$title = '';
|
|
|
|
|
self::setPromoteMap($map,"s.promote_id",$title);
|
|
|
|
|
$title .= "游戏统计";
|
|
|
|
|
$this->assign('title', $title);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//游戏统计列表
|
|
|
|
|
$data =self::gameStatisticsData($map, $row, $p);
|
|
|
|
|
if(isset($_REQUEST['export'])){
|
|
|
|
@ -505,7 +440,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
if(!$value['game_name']) $value['game_name'] = "无";
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['export'])) {
|
|
|
|
|
data2csv($data,'游戏统计', array(
|
|
|
|
|
data2csv($data,$title, array(
|
|
|
|
|
"partner_name"=>"合作公司",
|
|
|
|
|
"game_name"=>"游戏",
|
|
|
|
|
"cash_count"=>"游戏现金金额",
|
|
|
|
@ -573,33 +508,16 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
|
|
|
$map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否有推广员
|
|
|
|
|
if ($_REQUEST['promote_id'] != '') {
|
|
|
|
|
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
|
|
|
|
|
$map['promote_id'] = $_REQUEST['promote_id'];
|
|
|
|
|
} else {
|
|
|
|
|
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
|
|
|
|
|
if ($promoter_ids) {
|
|
|
|
|
$map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I("root_id"))) {
|
|
|
|
|
$root_id = I("root_id");
|
|
|
|
|
$promote_id = $this->getPromoteList($root_id);
|
|
|
|
|
array_push($promote_id, $root_id);
|
|
|
|
|
//获取推广员
|
|
|
|
|
$title = '';
|
|
|
|
|
self::setPromoteMap($map,"promote_id",$title);
|
|
|
|
|
if (isset($_REQUEST['game_name'])){
|
|
|
|
|
$title .= ($_REQUEST['game_name']."-");
|
|
|
|
|
}
|
|
|
|
|
$title .= "游戏订单查看";
|
|
|
|
|
$this->assign('title', $title);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST['root_id']=='0') {
|
|
|
|
|
$map['promote_id'] = $_REQUEST['root_id'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$promote_id = implode(',',$promote_id);
|
|
|
|
|
if ($promote_id) {
|
|
|
|
|
$map['promote_id'] = ['in',$promote_id];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$page = intval($p);
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
@ -630,7 +548,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$data[$key]['pay_way'] = getPayType($value['pay_way']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['export'])) {
|
|
|
|
|
data2csv($data,'游戏订单查看', array(
|
|
|
|
|
data2csv($data,$title, array(
|
|
|
|
|
"pay_order_number"=>"支付订单号",
|
|
|
|
|
"pay_time"=>"充值时间",
|
|
|
|
|
"user_account"=>"玩家账号",
|
|
|
|
@ -968,5 +886,67 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$this->display();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function setPromoteMap(&$map,$field,&$title)
|
|
|
|
|
{
|
|
|
|
|
//公司判断
|
|
|
|
|
$pmap = false; //非特意推广员检索
|
|
|
|
|
$gfflg = true; //是否有官方
|
|
|
|
|
if (isset($_REQUEST['company_id'])) {
|
|
|
|
|
$pmap['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
//获取公司名称
|
|
|
|
|
if($pmap['company_id'] == 0){
|
|
|
|
|
$title .= "万盟天下科技-";
|
|
|
|
|
}else{
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
$title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['company_belong'])) {
|
|
|
|
|
$pmap['company_belong'] = $_REQUEST['company_belong'];
|
|
|
|
|
if($_REQUEST['company_belong'] == 0){
|
|
|
|
|
$title .= "内团-";
|
|
|
|
|
}else{
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
$title .= "外团-";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
$pmap = false; //取消非特异推广员检索
|
|
|
|
|
$title .= (get_promote_name($_REQUEST['promote_id'])."-");
|
|
|
|
|
if ($_REQUEST['promote_id'] != 0){
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($pmap){
|
|
|
|
|
$promoter_ids = D("Promote")->where($pmap)->field('id')->select();
|
|
|
|
|
if ($promoter_ids) {
|
|
|
|
|
if($gfflg){
|
|
|
|
|
$t_in = "0,".implode(',', array_column($promoter_ids, 'id'));
|
|
|
|
|
}else{
|
|
|
|
|
$t_in = implode(',', array_column($promoter_ids, 'id'));
|
|
|
|
|
}
|
|
|
|
|
$map[$field] = ['in',$t_in];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否有推广员
|
|
|
|
|
$level = 1;
|
|
|
|
|
if ($_REQUEST['promote_id'] != '') {
|
|
|
|
|
if ($_REQUEST['promote_id'] != 0){
|
|
|
|
|
$level = M('promote', 'tab_')->field('level')->where(array('id' => $_REQUEST['promote_id']))->find()['level'];
|
|
|
|
|
}
|
|
|
|
|
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
|
|
|
|
|
$map[$field] = $_REQUEST['promote_id'];
|
|
|
|
|
} else {
|
|
|
|
|
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
|
|
|
|
|
if ($promoter_ids) {
|
|
|
|
|
$map[$field] = ['in', implode(',', array_column($promoter_ids, 'id'))];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$_POST['promote_level'] = $level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|