Merge branch 'hotfix/fan_promote' of wmtx/platform into master

优化公会统计
master
廖金灵 4 years ago committed by Gogs
commit 420c3454fc

@ -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,

@ -72,26 +72,19 @@ class SpendController extends ThinkController
unset($_REQUEST['pay_game_status']);
}
$marketAdminId = I('market_admin_id', 0);
if ($marketAdminId) {
$map['market_admin_id'] = $marketAdminId;
}
$marketAdminId = 0;
$isMarketAdmin = isMarketAdmin();
if ($isMarketAdmin) {
$userAuth = session('user_auth');
$map['market_admin_id'] = $userAuth['uid'];
$marketAdminId = $userAuth['uid'];
} else {
$marketAdminId = I('market_admin_id', 0);
}
if ($marketAdminId > 0) {
$map['market_admin_id'] = $marketAdminId;
} else {
setPowerPromoteIds($map,'promote_id');
}
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
if (isset($_REQUEST['promote_id'])) {
$promoteId = intval($_REQUEST['promote_id']);

@ -406,7 +406,7 @@ class PromoteModel extends Model{
$where['level'] = $level;
$userAuth = session('user_auth');
setPowerPromoteIds($where,'id');
// setPowerPromoteIds($where,'id');
$offcialData = [0=>['id'=>0,'nickname'=>C('OFFICIEL_CHANNEL')]];

@ -194,7 +194,7 @@
<tr>
<th>推广公司</th>
<th>会长账号</th>
<th>所属市场专员</th>
<th>当前所属市场专员</th>
<th>团体类型</th>
<th>开发类型</th>
<th >游戏</th>

@ -183,7 +183,7 @@
<tr>
<th>推广公司</th>
<th>会长渠道</th>
<th>所属市场专员</th>
<th>当前所属市场专员</th>
<th>内外团</th>
<th>开发类型</th>
<th class="tooltip"><a class="paixu" data-order='cash_count'>

@ -174,7 +174,7 @@
<tr>
<th>推广公司</th>
<th>推广员账号</th>
<th>所属市场专员</th>
<th>当前所属市场专员</th>
<th>团体类型</th>
<th>开发类型</th>

Loading…
Cancel
Save