From f0d298c04285c1d85d1721e63167c5baa31c1b12 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 19 Feb 2020 14:56:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=AC=E4=BC=9A=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=A2=E4=BD=93=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 25 ++++++ .../FinancePromoteController.class.php | 80 ++++++++++--------- .../View/FinancePromote/gameStatistics.html | 16 +++- .../Admin/View/FinancePromote/index.html | 11 +-- 4 files changed, 86 insertions(+), 46 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index bf22be7ba..0858173e2 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2173,4 +2173,29 @@ function a_array_unique($array){ return $out; } + /** + * 获取团体归属类型 + * @author chenzhi 20200219 + * $id 不传返回所有类型列表 + * 传入ID 返回对应的团体类型 + */ + function getCompanyBlong($id = -1) + { + $data = array( + ["id"=>0,'name'=>"内团"], + ["id"=>1,'name'=>"外团"], + ["id"=>2,'name'=>"外团-分发"], + ["id"=>3,'name'=>"无"] + ); + if($id > -1){ + foreach($data as $k=>$v){ + if($v['id'] == $id){ + return $v['name']; + break; + } + } + }else{ + return $data; + } + } ?> diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index fa1a40ea6..5f98c6d27 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -110,11 +110,7 @@ class FinancePromoteController extends AdminController "inside_cash_count"=>0, ); foreach($senddata as $k=>$v){ - if ($v['company_belong']==1) { - $v['company_belong']='外团'; - } else { - $v['company_belong']='内团'; - } + $v['company_belong'] = getCompanyBlong($v['company_belong']); if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME; if(empty($v['p_id'])) $v['p_id']= "0"; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; @@ -209,7 +205,7 @@ class FinancePromoteController extends AdminController SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count, 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,promote.company_belong"; + IFNULL(company_id,0) company_id,company_name,IFNULL(promote.company_belong,0) company_belong"; return M() ->table("tab_spend s") ->field($field) @@ -226,7 +222,7 @@ class FinancePromoteController extends AdminController $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(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='', s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id, - IFNULL(company_id,0) company_id,company_name,promote.company_belong"; + IFNULL(company_id,0) company_id,company_name,IFNULL(promote.company_belong,0) company_belong"; return M("promote_coin s","tab_") ->field($field) ->where($map) @@ -308,7 +304,7 @@ class FinancePromoteController extends AdminController ); foreach($senddata as $k=>$v){ - $v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团'; + $v['company_belong'] = getCompanyBlong($v['company_belong']); if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME; if(empty($v['promote_account'])) $v['promote_account']= "官方渠道"; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; @@ -363,7 +359,7 @@ class FinancePromoteController extends AdminController $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, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count, - IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,promote.company_belong"; + IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong"; return M() ->table("tab_spend s") ->field($field) @@ -379,7 +375,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,promote.company_belong"; + IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong"; return M("promote_coin s","tab_") ->field($field) ->where($map) @@ -414,7 +410,8 @@ class FinancePromoteController extends AdminController //获取推广员 $title = ''; - self::setPromoteMap($map,"s.promote_id",$title); + self::setPromoteMap($map,"s.promote_id",$title,false); + // dd($map); $title .= "游戏统计"; $this->assign('title', $title); @@ -430,14 +427,14 @@ class FinancePromoteController extends AdminController $value['balance_coin_count']?:0; $value['inside_cash_count']?:0; $value['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; - if(!$value['partner_name']) $value['partner_name'] = "无"; + $value['company_belong'] =getCompanyBlong($value['company_belong']); if(!$value['game_name']) $value['game_name'] = "无"; } if (isset($_REQUEST['export'])) { data2csv($data,$title, array( "company_name"=>"推广公司", "account"=>"会长账号", - "partner_name"=>"合作公司", + "company_belong"=>"团体类型", "game_name"=>"游戏", "cash_count"=>"游戏现金金额", "balance_coin_count"=>"平台币直充支出", @@ -590,7 +587,7 @@ class FinancePromoteController extends AdminController SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count, 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_name,'{$this->COMPANY_NAME}') company_name") + IFNULL(company_name,'{$this->COMPANY_NAME}') company_name,IFNULL(promote.company_belong,0) company_belong") ->join('LEFT JOIN tab_game as g ON s.game_id=g.id') ->join("tab_promote promote ON s.promote_id = promote.id","left") ->join("tab_promote_company company ON promote.company_id = company.id","left") @@ -877,7 +874,7 @@ class FinancePromoteController extends AdminController $this->display(); } - private function setPromoteMap(&$map,$field,&$title) + private function setPromoteMap(&$map,$field,&$title,$ptype = true) { //公司判断 $pmap = false; //非特意推广员检索 @@ -895,23 +892,24 @@ class FinancePromoteController extends AdminController } if (isset($_REQUEST['company_belong'])) { $pmap['company_belong'] = $_REQUEST['company_belong']; - if($_REQUEST['company_belong'] == 0){ - $title .= "内团-"; - }else{ - $gfflg = false; - $title .= "外团-"; - } + $title .= (getCompanyBlong($_REQUEST['company_belong'])."-"); } if (isset($_REQUEST['promote_id'])) { - $pmap = false; //取消非特异推广员检索 + if($ptype){ + $pmap = false;//取消非特异推广员检索 + }else{ + $pmap['id'] = $_REQUEST['promote_id']; + } + $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')); @@ -923,22 +921,30 @@ class FinancePromoteController extends AdminController $map[$field] = ['in',"-1"]; } } - //判断是否有推广员 - $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'))]; + // if($ptype){ + //判断是否有推广员 + $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 { + if ($ptype) { + $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); + }else{ + unset($pmap['id']); + $promoter_ids = D("Promote")->where($pmap)->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; + $_POST['promote_level'] = $level; + // } + } } \ No newline at end of file diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html index 25a873721..f5afffa72 100644 --- a/Application/Admin/View/FinancePromote/gameStatistics.html +++ b/Application/Admin/View/FinancePromote/gameStatistics.html @@ -112,13 +112,21 @@ -
+ +
+
- + -
- + + + +
From 061d7373fbf0ba3e64bbe922f7eff265dbc47b5f Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 19 Feb 2020 15:03:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=86=85=E5=A4=96=E5=9B=A2=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=86=85=E5=9B=A2=E5=88=86=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/QueryController.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index b24605372..28112d1a6 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1653,7 +1653,12 @@ class QueryController extends ThinkController $data[$key]['highquality'] = number_format(($value['pay_amount'] - $initNum - $data[$key]['upstream']-$data[$key]['downstream']) * (1-0.0672),2,'.',''); - $data[$key]['company_belong'] = $data[$key]['company_belong']?'外团':'内团'; + if (!$data[$key]['company_belong']) { + $data[$key]['company_belong'] = getCompanyBlong(0); + } else { + $data[$key]['company_belong'] = getCompanyBlong($data[$key]['company_belong']); + } + $data[$key]['company_relation'] = $data[$key]['company_relation']?'只维护':'自主开发及维护'; }