|
|
|
@ -253,7 +253,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$adminId = 0;
|
|
|
|
|
$havingPids = [];
|
|
|
|
|
// $havingPids = [];
|
|
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
|
|
if ($isMarketAdmin) {
|
|
|
|
|
$userAuth = session('user_auth');
|
|
|
|
@ -263,10 +263,10 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$adminId = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
/* if ($adminId > 0) {
|
|
|
|
|
$havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
|
|
|
|
|
$havingPids = count($havingPids) > 0 ? $havingPids : [0];
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
if($type == "spend"){
|
|
|
|
|
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
|
|
|
|
@ -275,6 +275,9 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
if($istimeselect){
|
|
|
|
|
$map['s.payed_time']=$istimeselect;
|
|
|
|
|
}
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$map['s.market_admin_id'] = $adminId;
|
|
|
|
|
}
|
|
|
|
|
$map['s.pay_status']=1;
|
|
|
|
|
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
|
|
|
|
|
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
|
|
|
|
@ -288,16 +291,16 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id","left")
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id","left")
|
|
|
|
|
->group('p_id');
|
|
|
|
|
if (count($havingPids) > 0) {
|
|
|
|
|
/* if (count($havingPids) > 0) {
|
|
|
|
|
$query->having('p_id in (' . implode(',', $havingPids) . ')');
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
return $query->select();
|
|
|
|
|
}else{
|
|
|
|
|
if($istimeselect){
|
|
|
|
|
$map['s.create_time']=$istimeselect;
|
|
|
|
|
}
|
|
|
|
|
$adminId = 0;
|
|
|
|
|
$havingPids = [];
|
|
|
|
|
// $havingPids = [];
|
|
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
|
|
if ($isMarketAdmin) {
|
|
|
|
|
$userAuth = session('user_auth');
|
|
|
|
@ -308,8 +311,9 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
|
|
|
|
|
$havingPids = count($havingPids) > 0 ? $havingPids : [0];
|
|
|
|
|
$map['promote.admin_id'] = $adminId;
|
|
|
|
|
// $havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
|
|
|
|
|
// $havingPids = count($havingPids) > 0 ? $havingPids : [0];
|
|
|
|
|
}
|
|
|
|
|
$map['s.status']=1;
|
|
|
|
|
$map['s.source_id']=0;
|
|
|
|
@ -322,9 +326,9 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id","left")
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id","left")
|
|
|
|
|
->group('p_id');
|
|
|
|
|
if (count($havingPids) > 0) {
|
|
|
|
|
/* if (count($havingPids) > 0) {
|
|
|
|
|
$query->having('p_id in (' . implode(',', $havingPids) . ')');
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
return $query->select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -517,13 +521,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id", "left")
|
|
|
|
|
->group('promote_id');
|
|
|
|
|
|
|
|
|
|
$havingPids = [];
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$topIds = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
|
|
|
|
|
$havingPids = getPromoteIdsByTopIds($topIds);
|
|
|
|
|
$havingPids = count($havingPids) > 0 ? $havingPids : [0];
|
|
|
|
|
$query->having('promote_id in (' . implode(',', $havingPids) . ')');
|
|
|
|
|
}
|
|
|
|
|
return $query->select();
|
|
|
|
|
}else{
|
|
|
|
|
if($istimeselect){
|
|
|
|
@ -544,9 +541,12 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$isMarketLeader = isMarketLeader();
|
|
|
|
|
if ($isMarketLeader) {
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$map['promote.admin_id'] = $adminId;
|
|
|
|
|
} elseif ($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_")
|
|
|
|
@ -556,13 +556,13 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id", "left")
|
|
|
|
|
->group('promote_id');
|
|
|
|
|
|
|
|
|
|
$havingPids = [];
|
|
|
|
|
/* $havingPids = [];
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$topIds = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
|
|
|
|
|
$havingPids = getPromoteIdsByTopIds($topIds);
|
|
|
|
|
$havingPids = count($havingPids) > 0 ? $havingPids : [0];
|
|
|
|
|
$query->having('promote_id in (' . implode(',', $havingPids) . ')');
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
return $query->select();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -857,6 +857,21 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
|
|
|
|
|
private function gameStatisticsData($map, $row = 0, $page = 1)
|
|
|
|
|
{
|
|
|
|
|
$adminId = 0;
|
|
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
|
|
if ($isMarketAdmin) {
|
|
|
|
|
$userAuth = session('user_auth');
|
|
|
|
|
$adminId = $userAuth['uid'];
|
|
|
|
|
} else {
|
|
|
|
|
if (!empty(I('admin_id'))) {
|
|
|
|
|
$adminId = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$map['s.market_admin_id'] = $adminId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map['s.pay_status']=1;
|
|
|
|
|
$query = M("spend","tab_")->alias("s")
|
|
|
|
|
->field("s.game_id,s.game_name,s.sdk_version,p.partner as partner_name,
|
|
|
|
@ -875,6 +890,17 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
if ($row != 0) {
|
|
|
|
|
$query = $query->page($page,$row);
|
|
|
|
|
}
|
|
|
|
|
$data = $query->select(false);
|
|
|
|
|
$data = M()
|
|
|
|
|
->table("(".$data.") a")
|
|
|
|
|
->field("a.*,IFNULL(promote.account,'官方渠道') account")
|
|
|
|
|
->join("tab_promote promote ON a.p_id = promote.id","left")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
private function totalGameStatisticsData($map, $join = true)
|
|
|
|
|
{
|
|
|
|
|
$adminId = 0;
|
|
|
|
|
$isMarketAdmin = isMarketAdmin();
|
|
|
|
|
if ($isMarketAdmin) {
|
|
|
|
@ -885,23 +911,11 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$adminId = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$havingPids = [];
|
|
|
|
|
|
|
|
|
|
if ($adminId > 0) {
|
|
|
|
|
$havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
|
|
|
|
|
$havingPids = count($havingPids) > 0 ? $havingPids : [0];
|
|
|
|
|
$query->having('p_id in (' . implode(',', $havingPids) . ')');
|
|
|
|
|
$map['s.market_admin_id'] = $adminId;
|
|
|
|
|
}
|
|
|
|
|
$data = $query->select(false);
|
|
|
|
|
$data = M()
|
|
|
|
|
->table("(".$data.") a")
|
|
|
|
|
->field("a.*,IFNULL(promote.account,'官方渠道') account")
|
|
|
|
|
->join("tab_promote promote ON a.p_id = promote.id","left")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
private function totalGameStatisticsData($map, $join = true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$query = M("spend","tab_")->alias("s")
|
|
|
|
|
->field("SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
|
|
|
|
|
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
|
|
|
|
|