diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index 929355e79..2f9d589e1 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -157,8 +157,8 @@ class ExportController extends Controller
 
                     $adminList = getMarketAdminsByPromoteIds(array_column($xlsData, 'promote_id'));
                     foreach($xlsData as $value) {
-                        $value['market_admin_username'] = isset($adminList[$value['promote_id']]) && $adminList[$value['promote_id']]['admin'] ? $adminList[$value['promote_id']]['admin']['username'] : '无';
                         ($value['promote_account']=='官方渠道'||$value['promote_account']=='自然注册')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
+                        $value['market_admin_username'] = isset($adminList[$value['promote_id']]) && $adminList[$value['promote_id']]['admin'] ? $adminList[$value['promote_id']]['admin']['username'] : '无';
                         $value['create_time'] = date("Y-m-d H:i:s",$value['create_time']);
                         $value['play_time'] = date("Y-m-d H:i:s",$value['play_time']);
                         mb_convert_variables('GBK', 'UTF-8', $value);
@@ -3582,14 +3582,10 @@ class ExportController extends Controller
     }
 
     private function promote_statistics_export($p=0){
-        $page = intval($p);
-        $page = $page ? $page : 1; //默认显示第一页数据
-        $arraypage=$page;
-        $row = 10;
-        $user=M('User','tab_');
-        if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
-            $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
-            unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
+        if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
+            $map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399)];
+            unset($_REQUEST['timestart']);
+            unset($_REQUEST['timeend']);
         } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
             $map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())];
             unset($_REQUEST['timestart']);
@@ -3597,104 +3593,157 @@ class ExportController extends Controller
             $map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399];
             unset($_REQUEST['timeend']);
         }
-
-//        if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
-//            $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
-//            unset($_REQUEST['start']);unset($_REQUEST['end']);
-//        }
-        $play_info_map = '';
-
+        //TODO:应需求,取消玩家表,只要user表的fgame有就算注册无需在play表存在
+        $play_map = false;
         if (isset($_REQUEST['game_name'])) {
             $map['fgame_name'] = $_REQUEST['game_name'];
-            $play_info_map .= " and upi.game_name = '{$_REQUEST['game_name']}' ";
-            unset($_REQUEST['game_name']);
+            // $play_map = " and up.game_name = '{$_REQUEST['game_name']}' ";
         }
+        $play_info_map = false;
         if (isset($_REQUEST['server_id'])) {
-            $play_info_map .= " and upi.server_name = '{$_REQUEST['server_id']}' ";
+            $play_map = false; //有区服就不检索玩家表,有区服一定已经选择游戏了
+            $play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name = '{$_REQUEST['game_name']}'";
         }
-        $today=total(1);
-        $week=total(2);
-        $mounth=total(3);
+
+        $today = total(1);
+        $week = total(2);
+        $mounth = total(3);
+        
         if (isset($_REQUEST['promote_id'])) {
-            $map['tp1.id'] = $_REQUEST['promote_id'];
-        } else {
-            $map['tp1.chain'] = '/';
+            $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
+            if ($promoter_ids) {
+                $map['u.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
+            }
         }
+
+        if (!empty($_REQUEST['admin_id'])) {
+            $map['promote.admin_id'] = $_REQUEST['admin_id'];
+        }
+
         //为数据权限添加
         setPowerPromoteIds($map, 'u.promote_id');
-        $data =  M('promote', 'tab_')->alias('tp1')->field('tp1.account as promote_account,tp1.id, date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.id) as count,      
-            count(IF(register_time ' . $today . ',1,null)) as today,
-            count(IF(register_time ' . $week . ',1,null)) as week,
-            count(IF(register_time ' . $mounth . ',1,null)) as mounth')
-            ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
-            ->join("tab_user as u on tp2.id = u.promote_id", 'left')
-            ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
-            ->where($map)
-            ->group('tp1.id')
-            ->order('count desc, register_time')
-            ->select();
-        unset($map['tp1.id']);
-        unset($map['tp1.chain']);
-        $map['promote_id'] = 0;
-        //如果有官方渠道权限
-        $user_auth_promote_ids = session('user_auth_promote_ids');
-        if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) {
-            //官方渠道数据添加
-            $authorityData = M('user', 'tab_')->alias('u')
-                ->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, 
-            count(id) as count,     
-            count(IF(register_time ' . $today . ',1,null)) as today,
-            count(IF(register_time ' . $week . ',1,null)) as week,
-            count(IF(register_time ' . $mounth . ',1,null)) as mounth')
+
+        // 如果是市场专员那么只能看自己的
+        $isMarketAdmin = isMarketAdmin();
+        if ($isMarketAdmin) {
+            $map['promote.admin_id'] = is_login();
+        }
+        
+        $data = M("User u","tab_")
+                ->field("count(u.id) as count,IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',u.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
+                ->join("tab_promote promote ON u.promote_id = promote.id","left")
+                ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
+                ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
+                ->join('tab_game on u.fgame_id = tab_game.id')
                 ->where($map)
-                ->find();
+                ->group('id')
+                ->order('count desc, register_time')
+                ->select();
+        //今日/本周/本月不变
+        $tmap = $map;
+        if(isset($tmap['register_time'])){
+            //获取最大最小
+            $tweek = total(2,false);
+            $tmonth = total(3,false);
+            //获取最小
+            $tmin = 0;
+            if($tweek[1][0] < $tmonth[1][0]){
+                $tmin = $tweek[1][0];
+            }else{
+                $tmin = $tmonth[1][0]; 
+            }
+            $tmap['register_time'] = ['between', array($tmin,$tmonth[1][1])];
+        }
+
+        $tdata = M("User u","tab_")
+                ->field("count(IF(register_time {$today},1,null)) as today,
+                        count(IF(register_time {$week},1,null)) as week,
+                        count(IF(register_time {$mounth},1,null)) as mounth,
+                        IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',u.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
+                ->join("tab_promote promote ON u.promote_id = promote.id","left")
+                ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
+                ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
+                ->where($tmap)
+                ->group('id')
+                ->order('register_time')
+                ->select();
+        $tmdata = [];
+        foreach($data as $k=>$v){
+            $v['today'] = 0;
+            $v['week'] = 0;
+            $v['mounth'] = 0;
+            $tmdata[$v['id']] = $v;
+        }
+        if(!empty($tdata)){
+            foreach ($tdata as $k => $v) {
+                $tmdata[$v['id']]['today'] = $v['today'];
+                $tmdata[$v['id']]['week'] = $v['week'];
+                $tmdata[$v['id']]['mounth'] = $v['mounth'];
+                $tmdata[$v['id']]['id'] = $v['id'];
+            }
         }
-        $authorityData['promote_account'] = C('OFFICIEL_CHANNEL');
-        $authorityData['id'] = "1";
-        if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) {
-            $authorityData = [];
-        } else {
-            array_push($data, $authorityData);
+        if(count($tmdata) >0){
+            //获取推广员
+            $idstr = implode(",",array_keys($tmdata));
+            $promoteRes = M("Promote","tab_")->field("id,account promote_account")->where("id in ({$idstr})")->select();
+            foreach($promoteRes as $k=>$v){
+                $tmdata[$v['id']]['promote_account'] = $v['promote_account'];
+            }
         }
-
-//数据排序
+        $data = [];
+        foreach($tmdata as $k => $v){
+            if($v['id'] == 0){
+                $v['promote_account'] = C('OFFICIEL_CHANNEL');
+            }
+            $data[] = $v;
+        }
+        unset($map['tp1.id']);
+        unset($map['tp1.chain']);
+        unset($tmap['tp1.id']);
+        unset($tmap['tp1.chain']);
+        $map['u.promote_id'] = 0;
+        $tmap['u.promote_id'] = 0;
+        $authorityData['count'] = 0;
+        //数据排序
         $last_names = array_column($data,'count');
         array_multisort($last_names,SORT_DESC,$data);
-//        var_dump($data);die();
 
-        $count=count($data);
+        $count = count($data);
         foreach ($data as $key => $value) {
-            static $i=0;
-            $i++;
-            $data[$key]['rand']=$i;
+            static $i = 0;
+            $i++; 
+            $data[$key]['rand'] = $i;
         }
-//        foreach ($data as $key => $value) {
-//            if($data[$key]['promote_id']==0){
-//                unset($data[$key]);
-//            }
-//        }
 
-        $total=A('Platform')->data_total($data);
-        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($count > $row){
-            $page = new \Think\Page($count, $row);
-            $page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
-            $this->assign('_page', $page->show());
+        $total = $this->data_total($data);
+        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);
         }
-        $data=my_sort($data,$data_order_type,(int)$data_order);
-        $size=$row;//每页显示的记录数
 
-        $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
+
+        $data = my_sort($data, $data_order_type, (int)$data_order);
         //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
-//        $data = array_slice($data, ($arraypage-1)*$size, $size);
+
+        $companys = !empty($data) ? M('promote', 'tab_')
+            ->field('tab_promote.id, company_name, sys_member.nickname as admin_username')
+            ->join("tab_promote_company on tab_promote.company_id = tab_promote_company.id", 'left')
+            ->join('sys_member on tab_promote.admin_id = sys_member.uid', 'left')
+            ->where("tab_promote.id in (".implode(',', array_column($data, 'id')).")")->select() : [];
+        $companys = $companys ? array_column($companys, null, 'id') : [];
+        foreach ($data  as &$item) {
+            $item['company_name'] = $companys[$item['id']]['company_name'] ?? '无';
+            $item['admin_username'] = $companys[$item['id']]['admin_username'] ?? '无';
+        }
+
         $xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'推广员注册统计';
         $xlsCell = array(
-            array('promote_account', "推广员账号"),
+            array('company_name'  , "公司"),
+            array('promote_account', "会长账号"),
+            array('admin_username'  , "市场专员"),
+            //array('relation_game_name'  , "游戏"),
             array('count'  , "累计注册"),
             array('rand'   , "排行榜"),
             array('today'  , "今日注册"),
diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php
index ffb8dcf53..2192aa350 100644
--- a/Application/Admin/Controller/FinancePromoteController.class.php
+++ b/Application/Admin/Controller/FinancePromoteController.class.php
@@ -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'])) {
@@ -291,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');
@@ -311,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;
@@ -325,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();
         }
 
@@ -520,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){
@@ -547,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_")
@@ -559,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();
         }
     }
@@ -860,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,
@@ -878,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) {
@@ -888,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,
diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php
index 13d73fb09..0c01e5d05 100644
--- a/Application/Admin/Controller/MarketPercentageController.class.php
+++ b/Application/Admin/Controller/MarketPercentageController.class.php
@@ -93,13 +93,13 @@ class MarketPercentageController extends ThinkController
 
         if ($_REQUEST['export']) {
             $data = $data->where($map)
-                ->group("promote_id,game_name,pay_time")
+                ->group("promote_id,game_name,pay_time,admin_id")
                 ->order("pay_time DESC")
                 ->select();
         } else {
             $data = $data->page($p, $row)
                 ->where($map)
-                ->group("promote_id,game_name,pay_time")
+                ->group("promote_id,game_name,pay_time,admin_id")
                 ->order("pay_time DESC")
                 ->select();
         }
@@ -169,7 +169,7 @@ class MarketPercentageController extends ThinkController
 
         $count = M("settleup_marketorder","tab_")
             ->where($map)
-            ->group("promote_id,game_name,pay_time")
+            ->group("promote_id,game_name,pay_time,admin_id")
             ->select(false);
 
         $count = M()->table("({$count}) count")->count();
diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php
index 7802e7eb4..6b4bf9ca6 100644
--- a/Application/Admin/Controller/MendController.class.php
+++ b/Application/Admin/Controller/MendController.class.php
@@ -118,7 +118,6 @@ class MendController extends ThinkController {
 
     public function edit($id = null)
     {
-        
         if (IS_POST) {
             $promoteService = new PromoteService();
             if ($_POST['prmoote_id_to'] == -1){
@@ -137,8 +136,12 @@ class MendController extends ThinkController {
             // if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){
             //     $this->error('在订单日期内含有已经结算的订单,无法补链');
             // }
-            if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){
-                $this->error("在订单日期内含有已经结算的订单,无法补链。如订单:{$this->tempid}");
+
+            // if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){
+            //     $this->error("在订单日期内含有已经结算的订单,无法补链。");
+            // }
+            if(self::checkOrderTime(strtotime($_POST['order_time']))){
+                $this->error('仅能补链本周数据,请重新选择补链时间');
             }
             if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){
                 $this->error('在订单日期内含有多个推广员,无法补链');
@@ -178,20 +181,35 @@ class MendController extends ThinkController {
                 $this->error($res['msg']);
             }
         } else {
-            $user = A('User', 'Event');
-            $user_data = $user->user_entity($id);
-            $user_data || $this->error("用户数据异常");
+            // echo 1;die();
+            $map['id'] = $id;
+            $data = M("user","tab_")->where($map)->find();
+
+            // $user = A('User', 'Event');
+            // $user_data = $user->user_entity($id);
+            // $user_data || $this->error("用户数据异常");
 //            var_dump($user_data);die;
-            $this->assign("data", $user_data);
+            $this->assign("data", $data);
             $this->meta_title = '编辑推广补链';
 
-						$this->m_title = '推广补链';
-				$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find());
+			$this->m_title = '推广补链';
+			$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find());
 
 
             $this->display();
         }
     }
+    private function checkOrderTime($order_time){
+        $sdefaultDate = date("Y-m-d");
+        $first=1;//周一开始
+        $w=date('w',strtotime($sdefaultDate));
+        $checktime=strtotime("$sdefaultDate -".($w ? $w - $first : 6).' days'); //本周开始时间
+        if($order_time >= $checktime){
+            //在本周允许换绑
+            return false;
+        }
+        return true;
+    }
     /**
      * 2020.1.3 之后判断订单是否已经结算
      */
@@ -200,42 +218,51 @@ class MendController extends ThinkController {
         $map = array(
             "pay_status"=>1,
             "user_account"=>$account,
-            "pay_time"=>array("EGT",$order_time)
+            "payed_time"=>array("EGT",$order_time)
         );
         $spendlist = M("Spend","tab_")->field("id,selle_status,pay_order_number")->where($map)->select();
         if(count($spendlist) < 1){
+            //无流水可换绑
             return false;
         }
-        //获取所有未审核
-        $withmap = array(
-            "status"=>0,
-            "settlement_begin_time"=>array("EGT",$order_time),
-            "settlement_end_time"=>array("ELT",$order_time)
-        );     
-        $withspendlist = M("withdraw","tab_")->field("spend_ids")->select();
+        //获取结算方式
+        $c_id =  M("User","tab_")
+        ->alias('a')
+        ->field("IFNULL(p.company_id,0) company_id")
+        ->join('tab_promote p ON a.promote_id= p.id')
+        ->where("a.account = '{$account}'")
+        ->find();
         
-        $dsh_list = false;
-        if(!empty($withspendlist)){
-            //获取所有涉及订单
-           foreach ($withspendlist as $value) {
-            $dsh_list .= (','.$value['spend_ids']);
-           }
+        if(empty($c_id) || $c_id['company_id'] == 0){
+            //官方渠道不结算,可换绑
+            return false;
         }
-        if($dsh_list){
-            $dsh_list = array_flip(explode(",",$dsh_list));
+        $c_id = $c_id['company_id'];
+        $r =  M("CompanyRelation","tab_")->where("(first_company_type = 2 AND first_company_id = '{$c_id}') OR (second_company_type = 2 AND second_company_id = '{$c_id}')")->find();
+        if(empty($r) || $r['settlement_type'] == 0){
+            //不结算的公司允许换绑
+            return false;
         }
-        foreach($spendlist as $k=>$v){
-            
-            if($v['selle_status'] == 1){
-                $this->tempid = $v['pay_order_number'];
-                return true; //有已结算
-            }
-            if($dsh_list && $dsh_list[$v['id']]){
-                $this->tempid = $v['pay_order_number'];
-                return true; //有待审核的
-            }
+        $checktime = 0;
+        if($r['settlement_type'] == 1){
+            //周结
+            $sdefaultDate = date("Y-m-d");
+            $first=1;
+            $w=date('w',strtotime($sdefaultDate));
+            $checktime=strtotime("$sdefaultDate -".($w ? $w - $first : 6).' days'); //本周开始时间
+        }else{
+            //月结
+            $y = date("Y", time()); //年 
+            $m = date("m", time()); //月 
+            $checktime = mktime(0, 0, 0, $m, 1, $y); // 本月开始时间 
         }
-        return false;
+        if($order_time >= $checktime){
+            //未在结算期内,允许换绑
+            return false;
+        }
+        //其他情况不允许换绑
+        return true;
+        
     }
 
     /**
diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php
index a63e42791..1236ffafd 100644
--- a/Application/Admin/Controller/PlatformController.class.php
+++ b/Application/Admin/Controller/PlatformController.class.php
@@ -446,6 +446,10 @@ class PlatformController extends ThinkController
             $play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name = '{$_REQUEST['game_name']}'";
         }
 
+        if (!empty($_REQUEST['admin_id'])) {
+            $map['promote.admin_id'] = $_REQUEST['admin_id'];
+        }
+
         $today = total(1);
         $week = total(2);
         $mounth = total(3);
@@ -456,13 +460,23 @@ class PlatformController extends ThinkController
                 $map['u.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
             }
         }
+
+
+        // 如果是市场专员那么只能看自己的会长信息
+        $isMarketAdmin = isMarketAdmin();
+        if ($isMarketAdmin) {
+            $map['promote.admin_id'] = is_login();
+        }
+
         //为数据权限添加
         setPowerPromoteIds($map, 'u.promote_id');
+
         $data = M("User u","tab_")
                 ->field("count(u.id) as count,IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',u.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
                 ->join("tab_promote promote ON u.promote_id = promote.id","left")
                 ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
                 ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
+                ->join('tab_game on u.fgame_id = tab_game.id')
                 ->where($map)
                 ->group('id')
                 ->order('count desc, register_time')
@@ -491,6 +505,7 @@ class PlatformController extends ThinkController
                 ->join("tab_promote promote ON u.promote_id = promote.id","left")
                 ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
                 ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
+                ->join('tab_game on u.fgame_id = tab_game.id')
                 ->where($tmap)
                 ->group('id')
                 ->order('register_time')
@@ -539,7 +554,7 @@ class PlatformController extends ThinkController
         $count = count($data);
         foreach ($data as $key => $value) {
             static $i = 0;
-            $i++;
+            $i++; 
             $data[$key]['rand'] = $i;
         }
 
@@ -563,9 +578,21 @@ class PlatformController extends ThinkController
         $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
         //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
         $data = array_slice($data, ($arraypage - 1) * $size, $size);
+
+        $companys = !empty($data) ? M('promote', 'tab_')
+            ->field('tab_promote.id, company_name, sys_member.nickname as admin_username')
+            ->join("tab_promote_company on tab_promote.company_id = tab_promote_company.id", 'left')
+            ->join('sys_member on tab_promote.admin_id = sys_member.uid', 'left')
+            ->where("tab_promote.id in (".implode(',', array_column($data, 'id')).")")->select() : [];
+        $companys = $companys ? array_column($companys, null, 'id') : [];
+        foreach ($data  as &$item) {
+            $item['company_name'] = $companys[$item['id']]['company_name'] ?? '无';
+            $item['admin_username'] = $companys[$item['id']]['admin_username'] ?? '无';
+        }
         $this->meta_title = '渠道注册统计列表';
         $this->assign("is_admin",is_administrator());
         $this->assign('list_data', $data);
+        $this->assign('admin_users', M('member')->field('uid,nickname')->select());
         $this->assign('total', $total);
         $this->display();
     }
@@ -601,7 +628,7 @@ class PlatformController extends ThinkController
             $map['pay_time'] = ['between', array(0, time())];
             // $pay_time = " between 0 and " . time();
         }
-        $map1['pay_status'] = $map['pay_status'] = 1;
+        $map1['s.pay_status'] = $map['s.pay_status'] = 1;
         $today = total(1);
         $week = total(2);
         $mounth = total(3);
@@ -616,17 +643,18 @@ class PlatformController extends ThinkController
         }else{
             $tmin = $tmonth[1][0]; 
         }
-
-        //为数据权限添加
-        setPowerPromoteIds($map, 'tp1.id');
         
         if (isset($_REQUEST['promote_id'])) {
-            $map['tp1.id'] = $_REQUEST['promote_id'];
+            //$map['tp1.id'] = $_REQUEST['promote_id'];
+            $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
+            if ($promoter_ids) {
+                $map['tp1.id'] = $_REQUEST['promote_id'];
+                $map['tp2.id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
+            }
         } else {
             $map['tp1.chain'] = '/';
         }
         
-        
         if (isset($_REQUEST['game_name'])) {
             $map['s.game_name'] = $_REQUEST['game_name'];
             if (isset($_REQUEST['server_id'])) {
@@ -635,20 +663,47 @@ class PlatformController extends ThinkController
             }
         }
 
-        if (isset($_REQUEST['game_name'])||isset($_REQUEST['promote_id'])) {
-            $data =  M('promote', 'tab_')->alias('tp1')
-                ->field('tp1.account as promote_account,tp1.id,
-            floor(sum(pay_amount)*100) as count')
-                ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
-                ->join("tab_spend as s use INDEX(search) on tp2.id = s.promote_id", 'left')
-                ->where($map)
-                ->group('tp1.id')
-                ->order('count desc')
-                ->select();
+        if (isMarketAdmin()) {
+            $map['s.market_admin_id'] = is_login();
+        } else if (!empty($_REQUEST['admin_id'])) {
+            $map['s.market_admin_id'] = $_REQUEST['admin_id'];
         } else {
-            $statisticsMap['time'] =$map['pay_time'];
-            $data = M('promote_statistics', 'tab_')->field("promote_account,promote_id as id,sum(count) count")->where($statisticsMap)->group("promote_id")->select();
-        }
+            //为数据权限添加
+            setPowerPromoteIds($map, 'tp1.id');
+        }
+
+        $data =  M('promote', 'tab_')->alias('tp1')
+        ->field('tp1.account as promote_account,tp1.id,
+    floor(sum(pay_amount)*100) as count')
+        ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
+        ->join("tab_spend as s use INDEX(search) on tp2.id = s.promote_id", 'left')
+        ->join("tab_game as g on g.id = s.game_id", 'left')
+        ->where($map)
+        ->group('tp1.id')
+        ->order('count desc')
+        ->select();
+
+        // if (isset($_REQUEST['server_id'])||isset($_REQUEST['game_name'])||isset($_REQUEST['promote_id'])||isset($_REQUEST['admin_id'])||isset($_REQUEST['admin_user_id'])) {
+        //     $data =  M('promote', 'tab_')->alias('tp1')
+        //         ->field('tp1.account as promote_account,tp1.id,
+        //     floor(sum(pay_amount)*100) as count')
+        //         ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
+        //         ->join("tab_spend as s use INDEX(search) on tp2.id = s.promote_id", 'left')
+        //         ->join("tab_game as g on g.id = s.game_id", 'left')
+        //         ->where($map)
+        //         ->group('tp1.id')
+        //         ->order('count desc')
+        //         ->select();
+        // } else {
+        //     $statisticsMap['time'] =$map['pay_time'];
+        //     setPowerPromoteIds($statisticsMap, 'tab_promote.id');
+        //     $data = M('promote_statistics', 'tab_')
+        //         ->field("promote_account,promote_id as id,sum(count) count")
+        //         ->join('tab_promote on tab_promote.id = tab_promote_statistics.promote_id', 'left')
+        //         ->where($statisticsMap)
+        //         ->group("promote_id")
+        //         ->select();
+        // }
 
 
 //        var_dump($data);die();
@@ -664,6 +719,7 @@ class PlatformController extends ThinkController
                     floor(sum(IF(s.pay_time ' . $mounth . ',pay_amount,0))*100)  as mounth')
             ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
             ->join("tab_spend as s on tp2.id = s.promote_id", 'left')
+            ->join("tab_game as g on g.id = s.game_id", 'left')
             ->where($tmap)
             ->group('tp1.id')
             ->select();
@@ -674,6 +730,7 @@ class PlatformController extends ThinkController
             $v['mounth'] = 0;
             $tmdata[$v['id']] = $v;
         }
+        //dd($data);
         foreach ($tdata as $k => $v) {
 
             $tmdata[$v['id']]['today'] = $v['today'];
@@ -683,16 +740,18 @@ class PlatformController extends ThinkController
                 $tmdata[$v['id']]['promote_account'] = $v['promote_account'];
                 $tmdata[$v['id']]['count'] = 0;
             }
+
+            $tmdata[$v['id']]['id'] = $v['id'];
         }
         $data = [];
         foreach($tmdata as $k => $v){
             $data[] = $v;
         }
-        // dd($data);
-        unset($map['tp1.id']);
+        //dd($data);
+        unset($map['tp1.id'], $map['tp2.id'], $map['tp2.admin_id']);
         unset($map['tp1.chain']);
         unset($tmap['tp1.id']);
-        unset($tmap['tp1.chain']);
+        unset($tmap['tp1.chain'], $tmap['tp2.id']);
         $map['s.promote_id'] = 0;
         $tmap['s.promote_id'] = 0;
         $authorityData['count'] = 0;
@@ -760,7 +819,17 @@ class PlatformController extends ThinkController
         $data = my_sort($data, $data_order_type, (int)$data_order);
 
         $size = $row;//每页显示的记录数
-        $pnum = ceil(count($data) / $size); //总页数,ceil()函数用于求大于数字的最小整数
+        $companys = !empty($data) ? M('promote', 'tab_')
+            ->field('tab_promote.id, company_name, sys_member.nickname as admin_username')
+            ->join("tab_promote_company on tab_promote.company_id = tab_promote_company.id", 'left')
+            ->join('sys_member on tab_promote.admin_id = sys_member.uid', 'left')
+            ->where("tab_promote.id in (".implode(',', array_column($data, 'id')).")")->select() : [];
+        $companys = $companys ? array_column($companys, null, 'id') : [];
+        foreach ($data  as &$item) {
+            $item['company_name'] = $companys[$item['id']]['company_name'] ?? '无';
+            $item['admin_username'] = $companys[$item['id']]['admin_username'] ?? '无';
+        }
+        
         if(isset($_REQUEST['export'])){
 
             $GetData = $_GET;
@@ -769,7 +838,9 @@ class PlatformController extends ThinkController
             addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出推广员充值统计','url'=>U('Platform/promotepay_statistics',$GetData),'menu'=>'统计-统计-推广员统计-推广员充值统计']);
 
             data2csv($data,'推广员充值统计',array(
-                "promote_account"=>"推广员账号",
+                'company_name' => '公司',
+                "promote_account"=>"会长账号",
+                'admin_username' => '当前市场专员',
                 "count"=>"累计充值",
                 "rand"=>"排行榜",
                 "today"=>"今日充值",
@@ -783,6 +854,7 @@ class PlatformController extends ThinkController
         $data = array_slice($data, ($arraypage - 1) * $size, $size);
         $this->meta_title = '渠道充值统计列表';
         $this->assign('list_data', $data);
+        $this->assign('admin_users', M('member')->field('uid,nickname')->select());
         $this->assign("is_admin",is_administrator());
         $this->display();
 
diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php
index cc1c4a612..fc537e30a 100644
--- a/Application/Admin/Controller/SpendController.class.php
+++ b/Application/Admin/Controller/SpendController.class.php
@@ -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']);
diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php
index a4c97c60a..f8999e383 100644
--- a/Application/Admin/Controller/TimingController.class.php
+++ b/Application/Admin/Controller/TimingController.class.php
@@ -914,7 +914,7 @@ class TimingController extends AdminController {
             unset($promote_data[$key]['market_percentage']);
 
             $marker_data = M("settleup_marketorder","tab_")
-                ->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name']])
+                ->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'admin_id'=>$value['admin_id']])
                 ->find();
             echo "日期:{$value['pay_time']},游戏:{$value['game_name']},推广员:{$value['promote_account']}\n";
 //            dump($promote_data[$key]);die();
@@ -923,7 +923,7 @@ class TimingController extends AdminController {
                     ->add($promote_data[$key]);
             } else {
                 M("settleup_marketorder","tab_")
-                    ->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name']])
+                    ->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'admin_id'=>$value['admin_id']])
                     ->save($promote_data[$key]);
             }
 
diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php
index f015a4e4d..f61c4a71d 100644
--- a/Application/Admin/Model/PromoteModel.class.php
+++ b/Application/Admin/Model/PromoteModel.class.php
@@ -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')]];
 
diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html
index f46117538..b1f47860f 100644
--- a/Application/Admin/View/FinancePromote/gameStatistics.html
+++ b/Application/Admin/View/FinancePromote/gameStatistics.html
@@ -194,7 +194,7 @@
         <tr>
           <th>推广公司</th>
           <th>会长账号</th>
-          <th>所属市场专员</th>
+          <th>当前所属市场专员</th>
           <th>团体类型</th>
           <th>开发类型</th>
           <th >游戏</th>
diff --git a/Application/Admin/View/FinancePromote/index.html b/Application/Admin/View/FinancePromote/index.html
index b7bdae4c9..545faf957 100644
--- a/Application/Admin/View/FinancePromote/index.html
+++ b/Application/Admin/View/FinancePromote/index.html
@@ -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'>
diff --git a/Application/Admin/View/FinancePromote/promoteUser.html b/Application/Admin/View/FinancePromote/promoteUser.html
index 21dc5d37a..efac2aafa 100644
--- a/Application/Admin/View/FinancePromote/promoteUser.html
+++ b/Application/Admin/View/FinancePromote/promoteUser.html
@@ -174,7 +174,7 @@
                     <tr>
                         <th>推广公司</th>
                         <th>推广员账号</th>
-                        <th>所属市场专员</th>
+                        <th>当前所属市场专员</th>
                         <th>团体类型</th>
                         <th>开发类型</th>
 
diff --git a/Application/Admin/View/Mend/edit.html b/Application/Admin/View/Mend/edit.html
index dccb49a24..022c92554 100644
--- a/Application/Admin/View/Mend/edit.html
+++ b/Application/Admin/View/Mend/edit.html
@@ -87,7 +87,7 @@
             <tr>
                 <td class="l noticeinfo">订单日期:</td>
                 <td class="r table_radio">
-                    <input type="text" name="order_time" class="date" value="{:I('order_time')}" placeholder="订单日期" />
+                    <input type="text" name="order_time" autocomplete="off" class="date" value="{:I('order_time')}" placeholder="订单日期" />
                 </td>
             </tr>
             <tr>
diff --git a/Application/Admin/View/Platform/promote_statistics.html b/Application/Admin/View/Platform/promote_statistics.html
index 1c3959f93..c8942ea10 100644
--- a/Application/Admin/View/Platform/promote_statistics.html
+++ b/Application/Admin/View/Platform/promote_statistics.html
@@ -53,14 +53,23 @@
                 </div>
             </div>
             <div class="input-list input-list-promote search_label_rehab">
-                <label>推广员账号:</label>
+                <label>会长账号</label>
                 <select id="promote_id" name="promote_id" class="select_gallery" style="width:150px;">
-                    <option value="">推广员账号</option>
+                    <option value="">会长账号</option>
                     <volist name=":get_all_toppromote()" id="vo">
                         <option promote-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
                     </volist>
                 </select>
             </div>
+            <div class="input-list input-list-promote search_label_rehab">
+                <label>市场专员:</label>
+                <select id="admin_id" name="admin_id" class="select_gallery" style="width:150px;">
+                    <option value="">全部</option>
+                    <volist name="admin_users" id="vo">
+                        <option <if condition="$vo.uid eq I('admin_id')">selected</if>" value="{$vo.uid}">{$vo.nickname}</option>
+                    </volist>
+                </select>
+            </div>
             <div class="input-list input-list-game search_label_rehab">
                 <select id="game_id" name="game_name" class="select_gallery"  style="width:120px;">
                     <option value="">游戏名称</option>
@@ -89,8 +98,12 @@
                 <!-- 表头 -->
                 <thead>
                 <tr>
+                    <th >公司</th>
+
                     <th >推广员账号</th>
 
+                    <th >市场专员</th>
+
                     <th ><a class="paixu" data-order='count'><if     condition="$userarpu_order eq 4 and  $userarpu_order_type eq 'count'">累计注册▲
                         <elseif condition="$userarpu_order eq 3 and $userarpu_order_type eq 'count'"/>累计注册▼
                         <else />累计注册<img src="__IMG__/up-down.png" width="13px">
@@ -130,11 +143,12 @@
                 </style>
                 <empty name="list_data" >
                     <tr>
-                        <td colspan="6" class="text-center">aOh! 暂时还没有内容!</td>
+                        <td colspan="9" class="text-center">aOh! 暂时还没有内容!</td>
                     </tr>
                     <else />
                     <volist name="list_data" id="data">
                         <tr>
+                            <td>{$data['company_name']}</td>
                             <td >
                                 {$data['promote_account']}
                                 <!-- <if condition="$data.promote_id1 gt 0">
@@ -143,6 +157,7 @@
                                     其他注册
                                 </if> -->
                             </td>
+                            <td>{$data['admin_username']}</td>
                             <td ><span class='ljzc' data-value="{$data['id']}"><a>{$data.count}</a></span></td>
                             <td ><strong><if condition="$data.rand eq 1"><span>{$data.rand}</span><elseif condition="$data.rand eq 2"/><span>{$data.rand}</span><elseif condition="$data.rand eq 3"/><span>{$data.rand}</span><else/>{$data.rand}</if></strong></td>
                             <td >{$data.today}</td>
@@ -153,7 +168,7 @@
                     </volist>
                 </empty>
                 <tr class="data_summary">
-                    <td><span>汇总</span></td>
+                    <td colspan="3"><span>汇总</span></td>
                     <td ><span>{$total.sum_count}</span></td>
                     <td>---</td>
                     <td>{$total.sum_today}</td>
@@ -167,7 +182,7 @@
     <div class="page">
         <if condition="$role_export_check eq true ">
             <a class="sch-btn" href="{:U('Export/promote_statistics',
-                array('timestart'=>$_GET['timestart'],'timeend'=>$_GET['timeend'],'promote_id'=>$_GET['promote_id'],p=>$_GET['p'],'xlsname'=>'统计_推广员统计_推广员注册统计',)
+                array('timestart'=>$_GET['timestart'],'timeend'=>$_GET['timeend'],'admin_id'=>$_GET['admin_id'],'promote_id'=>$_GET['promote_id'],p=>$_GET['p'],'game_name'=>$_GET['game_name'], 'game_type'=>$_GET['game_type'],'server_id'=>$_GET['server_id'],'xlsname'=>'统计_推广员统计_推广员注册统计',)
                 ,false)}">导出</a>
         </if>
         {$_page|default=''}
@@ -284,7 +299,7 @@
                 // endDate:date
             })
 
-            $("#game_id").change(function(){
+    $("#game_id").change(function(){
                 $.ajax({
                     url:"{:U('getSpendServer')}",
                     type:"post",
@@ -326,4 +341,4 @@
             }
         })
     </script>
-</block>
+</block>
\ No newline at end of file
diff --git a/Application/Admin/View/Platform/promotepay_statistics.html b/Application/Admin/View/Platform/promotepay_statistics.html
index fcf74cf17..1ba329b87 100644
--- a/Application/Admin/View/Platform/promotepay_statistics.html
+++ b/Application/Admin/View/Platform/promotepay_statistics.html
@@ -54,12 +54,21 @@
 
             <div class="input-list input-list-promote search_label_rehab">
                 <select id="promote_id" name="promote_id" class="select_gallery" style="width:150px;">
-                    <option value="">推广员账号</option>
+                    <option value="">会长账号</option>
                     <volist name=":get_all_toppromote()" id="vo">
                         <option promote-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
                     </volist>
                 </select>
             </div>
+            <div class="input-list input-list-promote search_label_rehab">
+                <label>当前市场专员:</label>
+                <select id="admin_id" name="admin_id" class="select_gallery" style="width:150px;">
+                    <option value="">全部</option>
+                    <volist name="admin_users" id="vo">
+                        <option <if condition="$vo.uid eq I('admin_id')">selected</if>" value="{$vo.uid}">{$vo.nickname}</option>
+                    </volist>
+                </select>
+            </div>
             <div class="input-list input-list-game search_label_rehab">
                 <select id="game_id" name="game_name" class="select_gallery"  style="width:120px;">
                     <option value="">游戏名称</option>
@@ -103,7 +112,11 @@
                     <th ><a class="paixu" date-url='mzhuce'>本月充值</a></th>
                 </tr> -->
                 <tr>
-                    <th >推广员账号</th>
+                    <th >公司</th>
+
+                    <th >会长账号</th>
+
+                    <th >当前市场专员</th>
 
                     <th ><a class="paixu" data-order='count'><if     condition="$userarpu_order eq 4 and  $userarpu_order_type eq 'count'">累计充值▲
                         <elseif condition="$userarpu_order eq 3 and $userarpu_order_type eq 'count'"/>累计充值▼
@@ -144,12 +157,14 @@
                 </style>
                 <empty name="list_data" >
                     <tr>
-                        <td colspan="6" class="text-center">aOh! 暂时还没有内容!</td>
+                        <td colspan="10" class="text-center">aOh! 暂时还没有内容!</td>
                     </tr>
                     <else />
                     <volist name="list_data" id="data">
                         <tr>
+                            <td>{$data['company_name']}</td>
                             <td >{$data['promote_account']}</td>
+                            <td>{$data['admin_username']}</td>
                             <td ><span class='ljcz' data-value="{$data['promote_id']}"><a>{$data.count}</a></span></td>
                             <td ><strong><if condition="$data.rand eq 1"><span>{$data.rand}</span><elseif condition="$data.rand eq 2"/><span>{$data.rand}</span><elseif condition="$data.rand eq 3"/><span>{$data.rand}</span><else/>{$data.rand}</if></strong></td>
                             <td >{$data.today}</td>
@@ -159,7 +174,7 @@
                     </volist>
                 </empty>
                 <tr class="data_summary">
-                    <td><span>汇总</span></td>
+                    <td colspan="3"><span>汇总</span></td>
                     <td ><span>{$total.sum_count}</span></td>
                     <td>---</td>
                     <td>{$total.sum_today}</td>
@@ -352,7 +367,7 @@
                 pickerPosition:'bottom-left',
                 // endDate:date
             })
-            $("#game_id").change(function(){
+    $("#game_id").change(function(){
                 console.log($("#game_id option:selected").attr('game-id'));
                 $.ajax({
                     url:"{:U('getSpendServer')}",
@@ -396,4 +411,4 @@
             }
         })
     </script>
-</block>
+</block>
\ No newline at end of file