diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index 2b254b6a2..4226625a6 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -5,28 +5,158 @@ class FinancePromoteController extends AdminController public function _initialize(Type $var = null) { parent::_initialize(); - echo "
";
+        // echo "
";
     }
     public function index()
     {
-
+        if ($_REQUEST['data_order'] != '') {
+            $data_order = reset(explode(',', $_REQUEST['data_order']));
+            $data_order_type = end(explode(',', $_REQUEST['data_order']));
+            $this->assign('userarpu_order', $data_order);
+            $this->assign('userarpu_order_type', $data_order_type);
+        }
+        if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
+            $pmap['create_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
+        } elseif (isset($_REQUEST['time_start'])) {
+            $pmap['create_time'] = ['GT', strtotime($_REQUEST['time_start'])];
+        } elseif (isset($_REQUEST['time_end'])) {
+            $pmap['create_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
+        }
+        $senddata = [];
         //获取各会长的现金充值
-        $map = ["spend.pay_status"=>1];
-        $map['pay_way'] = array("GT",0);
-        
-        $field = "spend.promote_id,spend.promote_account,sum(pay_amount) pay_amount";
-        $spendRes = M()
-        ->table("tab_spend spend")
-        ->field($field)
-        ->where($map)
-        ->join("tab_promote promote ON spend.promote_id = promote.id","left")
-        ->group('spend.promote_id')
-        ->select();
-        dump($spendRes);die();
+        $cash = self::getJoinPromoteData(array("pay_way"=>array("GT",0)));
+        foreach($cash as $k=>$v){
+            $v['cash_count'] =  $v['pay_amount'];
+            unset($v['pay_amount']);
+            $senddata[$v['p_id']] = $v;
+        }
+        //平台币直充支出
+        $balance = self::getJoinPromoteData(array("pay_way"=>array("EQ",0)));
+        foreach($balance as $k=>$v){
+            if(array_key_exists($v['p_id'],$senddata)){
+                $senddata[$v['p_id']]['balance_coin_count']= $v['pay_amount'];
+            }else{
+                $v['balance_coin_count'] =  $v['pay_amount'];
+                unset($v['pay_amount']);
+                $senddata[$v['p_id']] = $v;
+            };
+        }
+         //平台币内充
+         $bind = self::getJoinPromoteData(array("pay_way"=>array("LT",0)));
+         foreach($bind as $k=>$v){
+             if(array_key_exists($v['p_id'],$senddata)){
+                 $senddata[$v['p_id']]['bind_coin_count']= $v['pay_amount'];
+             }else{
+                 $v['bind_coin_count'] =  $v['pay_amount'];
+                 unset($v['pay_amount']);
+                 $senddata[$v['p_id']] = $v;
+             };
+         }
+         //内冲
+         $inside = self::getJoinPromoteData([],"promote_coin");
+         foreach($inside as $k=>$v){
+            if(array_key_exists($v['p_id'],$senddata)){
+                $senddata[$v['p_id']]['inside_cash_count']= $v['pay_amount'];
+            }else{
+                $v['inside_cash_count'] =  $v['pay_amount'];
+                unset($v['pay_amount']);
+                $senddata[$v['p_id']] = $v;
+            };
+        }
+        if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){
+            $pmap['status']=1;
+           
+            $admininside = M("provide_user p","tab_")->field("sum(amount) amount")->where($pmap)->find();
+            if($admininside['amount'] >0){
+                $senddata[0]['inside_cash_count']= $admininside['amount'];
+            }
+           
+        }
 
+        $data = [];
+        $count =array(
+            "cash_count"=>0,
+            "balance_coin_count"=>0,
+            "bind_coin_count"=>0,
+            "inside_cash_count"=>0,
+        );
+        foreach($senddata as $k=>$v){
+           
+            if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
+            if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
+            if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
+            if(!array_key_exists('bind_coin_count',$v)) $v['bind_coin_count']=0;
+            if(!array_key_exists('inside_cash_count',$v)) $v['inside_cash_count']=0;
+            $v['allcount'] = $v['cash_count']-0+$v['balance_coin_count']+$v['bind_coin_count'];
+            $count['cash_count'] +=  $v['cash_count'];
+            $count['balance_coin_count'] +=  $v['balance_coin_count'];
+            $count['bind_coin_count'] +=  $v['bind_coin_count'];
+            $count['inside_cash_count'] +=  $v['inside_cash_count'];
+            $count['all_count'] +=  $v['allcount'];
+            $data[] = $v;
+        }
+        $data = my_sort($data, $data_order_type, (int)$data_order);
+        $this->assign('list_data', $data);
+        $this->assign('all_count', $count);
         $this->display();
         # code...
     }
+    private function getJoinPromoteData($map,$type="spend")
+    {
+        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($type == "spend"){
+            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 (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
+                $map['s.pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
+            } elseif (isset($_REQUEST['time_start'])) {
+                $map['s.pay_time'] = ['GT', strtotime($_REQUEST['time_start'])];
+            } elseif (isset($_REQUEST['time_end'])) {
+                $maps['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
+            }
+
+            $map['s.pay_status']=1;
+            $field= "sum(pay_amount) pay_amount,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";
+            return M()
+                    ->table("tab_spend s")
+                    ->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('p_id')
+                    ->select();
+        }else{
+            if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
+                $map['s.create_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
+            } elseif (isset($_REQUEST['time_start'])) {
+                $map['s.create_time'] = ['GT', strtotime($_REQUEST['time_start'])];
+            } elseif (isset($_REQUEST['time_end'])) {
+                $maps['s.create_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
+            }
+            $map['s.status']=1;
+            $map['s.source_id']=0;
+            $map['s.type']=1;
+            $field= "sum(num) pay_amount,IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id";
+            return  M("promote_coin s","tab_")
+            ->field($field)
+            ->where($map)
+            ->join("tab_promote promote ON s.promote_id = promote.id","left")
+            ->group('p_id')
+            ->select();
+        }
+        
+    }
     
 
 }
\ No newline at end of file
diff --git a/Application/Admin/View/FinancePromote/index.html b/Application/Admin/View/FinancePromote/index.html
index 4d61eeaf9..b4757c72c 100644
--- a/Application/Admin/View/FinancePromote/index.html
+++ b/Application/Admin/View/FinancePromote/index.html
@@ -1,58 +1,105 @@
-
+
 
 
-
-
-
-
+    
+    
+    
+    
 
-
+            resize: none;
+            border-width: 1px;
+            border-style: solid;
+            border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
+            box-shadow: 0px 3px 3px #F7F8F9 inset;
+            height: 35px;
+            height: 28px;
+            border-radius: 3px;
+            font-size: 12px;
+        }
+
+        .select2-container--default .select2-selection--single .select2-selection__rendered {
+            line-height: 35px;
+            line-height: 28px;
+        }
+
+        .select2-container--default .select2-selection--single .select2-selection__arrow {
+            height: 26px;
+        }
+
+        .select2-container--default .select2-search--dropdown .select2-search__field {
+            height: 26px;
+            line-height: 26px;
+            font-size: 12px;
+        }
+
+        .select2-results__option[aria-selected] {
+            font-size: 12px;
+        }
+        .tooltip {
+            position: relative;
+            /* display: block; */
+            /* color: #056dae; */
+        }
+        .tooltip .tooltiptext {
+            display: none;
+            width: 100%;
+            background-color: #fff;
+            text-align: center;
+            border-radius: 6px;
+            padding: 5px 10px 5px 5px;
+            position: absolute;
+            z-index: 1;
+            bottom: 80%;
+            left: 0;
+            border: #000 solid 1px;
+            line-height: 20px;
+        }
+
+        .tooltip .tooltiptext::after {
+            content: "";
+            position: absolute;
+            top: 100%;
+            left: 50%;
+            margin-left: -5px;
+            border-width: 5px;
+            border-style: solid;
+            border-color: black transparent transparent transparent;
+        }
+        .tooltip:hover .tooltiptext {
+            color: #333;
+            display: block;
+            
+        }
+    
     
     
     
     
- +
@@ -64,33 +111,38 @@
- +  -  -
- - +
+ +
- - + - +
- - +
+ - +
@@ -105,283 +157,301 @@ 推广公司 会长渠道 - 游戏现金金额 - 平台币直充支出 - 内充支出 - 平台币内充 - 渠道游戏内充值合计 - 操作 + + 游戏现金金额▲ + + 游戏现金金额▼ + 游戏现金金额 + + 第三方支付(微信,支付宝,快捷) + + + 平台币直充支出▲ + + 平台币直充支出▼ + 平台币直充支出 + + 平台币购买游戏道具所产生的金额 + + + 内充支出▲ + + 内充支出▼ + 内充支出 + + 公会下的玩家使用绑定币消费的金额 + + + 平台币内充▲ + + 平台币内充▼ + 平台币内充 + + 管理后台直接下放给会长的平台币 + 渠道游戏内充值合计 游戏现金金额(游戏现金流水+平台币支出+公会内充支出=总流水 + 操作 - - aOh! 暂时还没有内容! - - - - {$data.id} - - {:get_registertype($data['register_type'])} - {$data.account} - - {$data.account} - - - - 官方渠道 - - ---{$data.promote_account} - - - {$data.balance} - {$data.recharge_total} - {$data.gold_coin|default='0.00'} - {$data.alipay|default='--'} - - - {$data.small_count|default=0} - -- - - - {:get_vip_level($data['recharge_total'])} - - - - 手机号 - 邮箱 - 账号 - - - - - {$data.register_time|date='Y-m-d H:i:s',###} - {$data.register_ip} - - - 空 - - - - - {$data.device_number|encryptStr} - - - 已{:get_info_status($data['lock_status'],4)} - - {:get_info_status($data['lock_status'],4)} - - - 正常 - - 已拉黑 - - - 查看 - 启用 - {:L('Lock')} - - - - - + + aOh! 暂时还没有内容! + + + + {$data.company_name} + {:get_promote_name($data['p_id'])} + + {$data.cash_count} + {$data.balance_coin_count} + {$data.bind_coin_count} + + {$data.inside_cash_count} + {$data.allcount} + + + + 游戏查看 + 渠道查看 + + + + + 汇总: - - 当前用户累计充值:{$now_count}  用户数:{$user_count} - - + {$all_count['cash_count']} + {$all_count['balance_coin_count']} + {$all_count['bind_coin_count']} + {$all_count['inside_cash_count']} + {$all_count['all_count']} + + 游戏查看 + 渠道查看 +
- 导出 + 导出 {$_page|default=''}
- - - - - + + + + +
- -if(C('COLOR_STYLE')=='blue_color') echo ''; - - - - - + + + - + + } + - + \ No newline at end of file