|
|
|
@ -91,6 +91,10 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$gfidlag =false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$isMarketLeader = isMarketLeader();
|
|
|
|
|
if ($isMarketLeader) {
|
|
|
|
|
$nwtflag = false;
|
|
|
|
|
}
|
|
|
|
|
// dd($gfidlag && $gfgs && $nwtflag);
|
|
|
|
|
if($gfidlag && $gfgs && $nwtflag){
|
|
|
|
|
//计算官方渠道
|
|
|
|
@ -228,7 +232,11 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['company_belong'])) {
|
|
|
|
|
$map['promote.company_belong'] = $_REQUEST['company_belong'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$isMarketLeader = isMarketLeader();
|
|
|
|
|
if ($isMarketLeader) {
|
|
|
|
|
$map['promote.admin_id'] = ['gt', 0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('develop_type'))) {
|
|
|
|
@ -455,12 +463,31 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$map['promote.company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
}
|
|
|
|
|
if ($type == "spend") {
|
|
|
|
|
$adminId = 0;
|
|
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
|
|
if ($isMarketAdmin) {
|
|
|
|
|
$userAuth = session('user_auth');
|
|
|
|
|
$adminId = $userAuth['uid'];
|
|
|
|
|
} else {
|
|
|
|
|
if (!empty(I('admin_id'))) {
|
|
|
|
|
$adminId = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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($istimeselect){
|
|
|
|
|
$map['s.pay_time']=$istimeselect;
|
|
|
|
|
}
|
|
|
|
|
$isMarketLeader = isMarketLeader();
|
|
|
|
|
if ($isMarketLeader) {
|
|
|
|
|
$map['s.market_admin_id'] = ['gt', 0];
|
|
|
|
|
$map['promote.admin_id'] = ['gt', 0];
|
|
|
|
|
}
|
|
|
|
|
if ($adminId) {
|
|
|
|
|
$map['s.market_admin_id'] = $adminId;
|
|
|
|
|
}
|
|
|
|
|
$map['s.pay_status']=1;
|
|
|
|
|
// dd($map);
|
|
|
|
|
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
|
|
|
|
@ -475,17 +502,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id", "left")
|
|
|
|
|
->group('promote_id');
|
|
|
|
|
|
|
|
|
|
$adminId = 0;
|
|
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
|
|
if ($isMarketAdmin) {
|
|
|
|
|
$userAuth = session('user_auth');
|
|
|
|
|
$adminId = $userAuth['uid'];
|
|
|
|
|
} else {
|
|
|
|
|
if (!empty(I('admin_id'))) {
|
|
|
|
|
$adminId = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$havingPids = [];
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$topIds = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
|
|
|
|
@ -500,14 +516,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
$map['s.status']=1;
|
|
|
|
|
$map['s.source_id']=0;
|
|
|
|
|
$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,
|
|
|
|
|
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong";
|
|
|
|
|
$query = M("promote_coin s","tab_")
|
|
|
|
|
->field($field)
|
|
|
|
|
->where($map)
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id","left")
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id", "left")
|
|
|
|
|
->group('promote_id');
|
|
|
|
|
|
|
|
|
|
$adminId = 0;
|
|
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
|
|
if ($isMarketAdmin) {
|
|
|
|
@ -518,6 +527,19 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$adminId = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$isMarketLeader = isMarketLeader();
|
|
|
|
|
if ($isMarketLeader) {
|
|
|
|
|
$map['promote.admin_id'] = ['gt', 0];
|
|
|
|
|
}
|
|
|
|
|
$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,
|
|
|
|
|
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong";
|
|
|
|
|
$query = M("promote_coin s","tab_")
|
|
|
|
|
->field($field)
|
|
|
|
|
->where($map)
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id","left")
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id", "left")
|
|
|
|
|
->group('promote_id');
|
|
|
|
|
|
|
|
|
|
$havingPids = [];
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
@ -554,6 +576,10 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
if (!empty(I('develop_type'))) {
|
|
|
|
|
$map['develop_type'] = I('develop_type');
|
|
|
|
|
}
|
|
|
|
|
$isMarketLeader = isMarketLeader();
|
|
|
|
|
if ($isMarketLeader) {
|
|
|
|
|
$map['promote.admin_id'] = ['gt', 0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取推广员
|
|
|
|
|
$title = '';
|
|
|
|
@ -681,6 +707,11 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$isMarketLeader = isMarketLeader();
|
|
|
|
|
if ($isMarketLeader) {
|
|
|
|
|
$map['market_admin_id'] = ['gt', 0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$map['market_admin_id'] = $adminId;
|
|
|
|
|
}
|
|
|
|
|