diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php
index 51e436624..3a71b06a4 100644
--- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php
+++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php
@@ -111,8 +111,8 @@ class AggregateFinanceStatementController extends ThinkController
             $data[$key]['oplist'] = $this->OpAuth($value);
         }
         $count =  M("aggregate_statement","tab_")->field("count(id) count,SUM(ratio_money) ratio_money")->where($map)->find();
-        $pay_money_count = M("aggregate_statement","tab_")->field("SUM(pay_money) pay_money")->where($map)->where("withdraw_type <> 2")->find()['pay_money'];
-
+        $map['withdraw_type'] = ["NEQ",2];
+        $pay_money_count = M("aggregate_statement","tab_")->field("SUM(pay_money) pay_money")->where($map)->find()['pay_money'];
         //分页
         $parameter['p'] = $page;
         $parameter['row'] = $row;
diff --git a/Application/Admin/Controller/CompanyStatementLackController.class.php b/Application/Admin/Controller/CompanyStatementLackController.class.php
index 658649fb7..2403610c6 100644
--- a/Application/Admin/Controller/CompanyStatementLackController.class.php
+++ b/Application/Admin/Controller/CompanyStatementLackController.class.php
@@ -55,7 +55,7 @@ class CompanyStatementLackController extends ThinkController
             $map['company_type'] = $_REQUEST['company_type'];
         }
         if(isset($_REQUEST['company_name'])){
-            $map['company_name'] =["LIKE","%{$_REQUEST['company_id']}%"];
+            $map['company_name'] =["LIKE","%{$_REQUEST['company_name']}%"];
         }
         if(isset($_REQUEST['statement_pool_num'])){
             $map['statement_pool_num'] =["LIKE","%{$_REQUEST['statement_pool_num']}%"];
diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php
index 91a8eeeb2..3ab8f3d1b 100644
--- a/Application/Admin/Controller/CompanyStatementPoolController.class.php
+++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php
@@ -207,11 +207,12 @@ class CompanyStatementPoolController extends ThinkController
         //获取基本信息
         $infolist = M("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}'")->select();
         //获取母单
-        $pool_info =  M("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status')->where("id={$id}")->find();
+        $pool_info =  M("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment')->where("id={$id}")->find();
         $statement_num = $pool_info['statement_num'];
         $this->assign("title",$statement_num);
         $this->assign("pool_status",$pool_info['verify_status']);
-        
+        $this->assign("pool_status",$pool_info['verify_status']);
+        $this->assign("is_payment",$pool_info['is_payment']);
         if($infolist[0]['company_type'] == 3){
             //上游
             $this->viewCpPool($infolist,$is_export);
@@ -239,8 +240,8 @@ class CompanyStatementPoolController extends ThinkController
         foreach($infolist as $k=>&$v){
             $v['statement_info'] = json_decode($v['statement_info'],true);
             $v['company_info'] = json_decode($v['company_info'],true);
-            $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
-            $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
+            $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
+            $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']);
             $cline = $line+1;
             if($is_export){
                 $v['sum_money_exp'] = "=";
@@ -260,24 +261,16 @@ class CompanyStatementPoolController extends ThinkController
                     }else{
                         $va['sum_money'] =  "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
                     }
-                    $count['sum_money_exp'] .= "O{$line}+";
-                    $count['platform_amount_exp'] .= "J{$line}+";
                 }else{
                     $count['platform_amount'] += $va['pay_amount'];
                     $count['sum_money'] +=  $va['sum_money'];
                 }
             }
             $v['statement_count'] = count($v['statement_info']);
-            
         }
         if($is_export){
-            $platform_amount_exp = trim($count["platform_amount_exp"],"+");
-            $sum_money_exp = trim($count["sum_money_exp"],"+");
-            if(empty($platform_amount_exp)){ $platform_amount_exp = 0;}
-            if(empty($sum_money_exp)){ $sum_money_exp = 0;}
-            
-            $count["platform_amount"] = "=".$platform_amount_exp;
-            $count["sum_money"] = "=".$sum_money_exp;
+            $count["platform_amount"] = "=SUM(J2:J".$line.")";
+            $count["sum_money"] = "=SUM(O2:O".$line.")";
         }
         $this->assign("data",$infolist);
         $this->assign("count",$count);
@@ -299,8 +292,8 @@ class CompanyStatementPoolController extends ThinkController
         unset($pl);
         foreach($infolist as $k=>&$v){
             $v['statement_info'] = json_decode($v['statement_info'],true);
-            $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
-            $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
+            $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
+            $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']);
             $cline = $line+1;
             if($is_export){
                 $v['statement_money_exp'] = "=";
@@ -379,8 +372,8 @@ class CompanyStatementPoolController extends ThinkController
         //
         foreach($infolist as $k=>&$v){
             $v['statement_info'] = json_decode($v['statement_info'],true);
-            $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']);
-            $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']);
+            $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
+            $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']);
             $cline = $line+1;
             if($is_export){
                 $v['statement_money_exp'] = "=";
@@ -787,7 +780,7 @@ class CompanyStatementPoolController extends ThinkController
         //重新计算
         $stime = $info['statement_end_time']-0+1;
         $type = $info['withdraw_type'];
-        A("CompanyStatementSet")->promoteUserPool($type,$stime,true);
+        A("CompanyStatementSet")->promoteUserPool($type,$stime,true,$info['is_payment']);
 
         M()->commit();
         $this->ajaxReturn(array(
diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php
index 22ab90e12..a0f1818de 100644
--- a/Application/Admin/Controller/CompanyStatementSetController.class.php
+++ b/Application/Admin/Controller/CompanyStatementSetController.class.php
@@ -255,8 +255,8 @@ class CompanyStatementSetController extends Controller {
 		$GameDb = M("Game","tab_");
 		$StatementDb = M("CompanyStatement","tab_");
 
-		$statement_begin_time = date("Y-m-d",$begintime);
-		$statement_end_time = date("Y-m-d",$endtime);
+		$statement_begin_time = date("Y.m.d",$begintime);
+		$statement_end_time = date("Y.m.d",$endtime);
 		foreach($cpList as $k=>$v){
 			$add_data=[];
 			
@@ -303,7 +303,7 @@ class CompanyStatementSetController extends Controller {
 				$game['pay_amount'] =$va['pay_money'];
 				$game['game_name'] =$ke;
 				//获取游戏id及比例
-				$game_id = $GameDb->where("game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find();
+				$game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find();
 				if(empty($game_id)){
 					$game['relation_game_id']=0;
 					// $game['sum_money']=0;
@@ -408,8 +408,9 @@ class CompanyStatementSetController extends Controller {
 				//金额为0不补点
 				continue;
 			}
-			if($add_data['platform_amount'] <= 0){
-				return;		
+			if($add_data['platform_amount'] == 0){
+				//全等于0表示没有流水,小于0依旧要结算
+				return;
 			}
 			//添加
 			if($recount && $company_id !== false){
@@ -565,8 +566,8 @@ class CompanyStatementSetController extends Controller {
 		$verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]);
 		$StatementDb = M("CompanyStatement","tab_");
 
-		$statement_begin_time = date("Y-m-d",$begintime);
-		$statement_end_time = date("Y-m-d",$endtime);
+		$statement_begin_time = date("Y.m.d",$begintime);
+		$statement_end_time = date("Y.m.d",$endtime);
 		$RewardRecord = M("RewardDetail","tab_");
 		foreach($pcList as $k=>$v){
             if(!isset($pc[$k])){continue;}//不存在的公司不结算
@@ -756,7 +757,7 @@ class CompanyStatementSetController extends Controller {
 		$Spend = M("Spend","tab_");
 		$spenMap = [
 			"s.pay_status"=>1,
-			"s.pay_time"=>['between', [$begintime,$endtime]],
+			"s.payed_time"=>['between', [$begintime,$endtime]],
 		];
 		for ($i=0; $i <count($idarr); $i++) {
             $company_id = $idarr[$i];
@@ -791,7 +792,7 @@ class CompanyStatementSetController extends Controller {
 			
 		}
 	}
-	public function promoteUserPool($type,$stime,$recount = false){
+	public function promoteUserPool($type,$stime,$recount = false,$is_payment=false){
 		$t = $this->setBeginAndEndTime($type,$stime);
 		$begintime = $t[0];
 		$endtime = $t[1];
@@ -835,9 +836,15 @@ class CompanyStatementSetController extends Controller {
 			$user['withdraw_type'] = 2;
 			$this->doPromoteUserPool($user,$users,2,$stime,$recount);
 		}
+		if($is_payment !== false && $is_payment==1){
+			$this->savePromotateUserPool($users);
+		}else if($is_payment !== false && $is_payment==2){
+			$this->savePromotateUserPool($user);
+		}else{
+			$this->savePromotateUserPool($users);
+			$this->savePromotateUserPool($user);
+		}
 		
-		$this->savePromotateUserPool($users);
-		$this->savePromotateUserPool($user);
 	}
 
 	/**
@@ -908,8 +915,8 @@ class CompanyStatementSetController extends Controller {
 		$this->getPromoteCompanySpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
 
 		$StatementDb = M("CompanyStatement","tab_");
-		$statement_begin_time = date("Y-m-d",$begintime);
-		$statement_end_time = date("Y-m-d",$endtime);
+		$statement_begin_time = date("Y.m.d",$begintime);
+		$statement_end_time = date("Y.m.d",$endtime);
 		// $RewardRecord = M("RewardRecord","tab_");
 		$LackStatement = M("company_lack_statement_info","tab_");
 		$StatementInfo = M("company_statement_info","tab_");
@@ -935,6 +942,7 @@ class CompanyStatementSetController extends Controller {
 			$v['reward'] = 0;
 			$v['platform_amount'] = 0;
 			if(!isset($v['list'])){continue;}
+			$company_belong = $pc[$v['id']]['company_belong'];
 			//服务器费用
             if ($type < 2) {
                 if ($v['has_server_fee'] == 1 && $v['server_fee'] > 0) {
@@ -1138,8 +1146,8 @@ class CompanyStatementSetController extends Controller {
 		$pl =  M("promote_company","tab_")
 				->alias('pc')
 				->field("p.account,p.company_relation,IFNULL(s.nickname,'admin') nickname")
-				->join("left join (select company_id,account,company_relation from tab_promote where level = 1 group by company_id ) p on p.company_id = pc.id")//获取会长
-				->join("left join sys_member s on s.uid = pc.uid")
+				->join("left join (select company_id,account,company_relation,admin_id from tab_promote where level = 1 group by company_id ) p on p.company_id = pc.id")//获取会长
+				->join("left join sys_member s on s.uid = p.admin_id")
 				->where("pc.id = {$company_id}")
 				->find();
 		$company = array_merge($company_info,$pl);
diff --git a/Application/Admin/Controller/DepositController.class.php b/Application/Admin/Controller/DepositController.class.php
index e838bb7c9..8034efa3d 100644
--- a/Application/Admin/Controller/DepositController.class.php
+++ b/Application/Admin/Controller/DepositController.class.php
@@ -71,7 +71,10 @@ class DepositController extends ThinkController {
             }
             unset($_REQUEST['pay_way']);
         }
-
+        if ($_REQUEST['merchant_id']) {
+            $map['merchant_id'] = $_REQUEST['merchant_id'];
+            unset($_REQUEST['merchant_id']);
+        }
 
         if(isset($_REQUEST['pay_status'])){
             $map['pay_status']=$_REQUEST['pay_status'];
@@ -213,6 +216,10 @@ class DepositController extends ThinkController {
             $sort = $data_order==3?'desc':'asc';
             $map['order'] = $data_order_type.' '.$sort;
         }
+        if ($_REQUEST['merchant_id']) {
+            $map['merchant_id'] = $_REQUEST['merchant_id'];
+            unset($_REQUEST['merchant_id']);
+        }
 
         $map1=$map;
         $map1['pay_status']=1;
@@ -235,7 +242,7 @@ class DepositController extends ThinkController {
 
         $data = D('coin_pay_order')
             /* 查询指定字段,不指定则查询所有字段 */
-            ->field('*,order_status as pay_status,order_number as pay_order_number')
+            ->field('*,order_status as pay_status,order_number as pay_order_number,merchant_id')
             // 查询条件
             ->where($map)
             /* 默认通过id逆序排列 */
diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index 997f21507..e05aa5125 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -1127,6 +1127,12 @@ class ExportController extends Controller
                     }
                     unset($_REQUEST['pay_way']);
                 }
+
+                if ($_REQUEST['merchant_id']) {
+                    $map['merchant_id'] = $_REQUEST['merchant_id'];
+                    unset($_REQUEST['merchant_id']);
+                }
+
                 if (isset($_REQUEST['pay_game_status'])) {
                     $map['pay_game_status'] = $_REQUEST['pay_game_status'];
                     unset($_REQUEST['pay_game_status']);
@@ -1200,7 +1206,7 @@ class ExportController extends Controller
 
 
                 $xlsCell = array(
-                    "支付订单号","CP订单号", "充值时间","支付时间", "玩家账号", "游戏名称", L('Subordinate_channel'), "所属推广公司", "所属市场专员", "充值ip","区服ID", "游戏区服",
+                    "支付订单号","CP订单号", "充值时间","支付时间", "玩家账号", "游戏名称", L('Subordinate_channel'), "所属推广公司", "所属市场专员","所属商户", "充值ip","区服ID", "游戏区服",
                     "角色ID","角色名称", "订单金额", "实付金额", "充值方式", L('Order_status'), "游戏通知状态", "消费"."{$total}"
                 );
 
@@ -1232,7 +1238,7 @@ class ExportController extends Controller
 //                        ->join($tab_promote_join)
 //                        ->order('pay_time DESC')
 //                        ->select();
-                        ->field('pay_order_number,extend,pay_time,payed_time,user_account,game_name,promote_account, 0 as company_name,market_admin_id,spend_ip,server_id,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status, promote_id')
+                        ->field('pay_order_number,extend,pay_time,payed_time,user_account,game_name,promote_account, 0 as company_name,market_admin_id,merchant_id,spend_ip,server_id,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status, promote_id')
                         // ->join('tab_promote on tab_promote.id = tab_spend.promote_id', 'left')
                         // ->join('tab_promote_company on tab_promote_company.id and tab_promote.company_id', 'left')
                         ->where($map)
@@ -1254,6 +1260,7 @@ class ExportController extends Controller
                         }else {
                             $value['payed_time'] = "------";
                         }
+                        $value['merchant_id'] = getMerchantName($value['merchant_id']);
                         checkEncryptionAuth($value['user_account'],'spend_lists');
 //                        $value['user_account'] = encryption($value['user_account']);
                         ($value['promote_account']=='官方渠道'||$value['promote_account']=='自然注册')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
@@ -1352,6 +1359,10 @@ class ExportController extends Controller
                     $map['pay_status'] = $_REQUEST['pay_status'];
                     unset($_REQUEST['pay_status']);
                 }
+                if ($_REQUEST['merchant_id']) {
+                    $map['merchant_id'] = $_REQUEST['merchant_id'];
+                    unset($_REQUEST['merchant_id']);
+                }
                 $map1 = $map;
                 $map1['pay_status'] = 1;
 
@@ -1369,6 +1380,7 @@ class ExportController extends Controller
                         array('pay_amount', "充值平台币"),
                         array('pay_way', "充值方式", 'get_pay_way', '*'),
                         array('pay_ip', "充值ip"),
+                        array('merchant_id', "所属商户"),
                         array('create_time', "充值时间"),
                         array('payed_time','支付时间'),
                         array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
@@ -1384,6 +1396,8 @@ class ExportController extends Controller
 
                         ($xlsData[$key]['promote_account']=='官方渠道'||$xlsData[$key]['promote_account']=='自然注册')?($xlsData[$key]['promote_account']=C('OFFICIEL_CHANNEL')):'';
 
+                        $xlsData[$key]['merchant_id'] = getMerchantName($value['merchant_id']);
+
                         $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
                         if ($value['pay_status'] == 1){
                             $xlsData[$key]['payed_time'] = date('Y-m-d H:i:s', $value['payed_time']);
@@ -2390,6 +2404,10 @@ class ExportController extends Controller
                         $map['pay_status'] = $_REQUEST['pay_status'];
                         unset($_REQUEST['pay_status']);
                     }
+                    if ($_REQUEST['merchant_id']) {
+                        $map['merchant_id'] = $_REQUEST['merchant_id'];
+                        unset($_REQUEST['merchant_id']);
+                    }
                     $map1 = $map;
                     $map1['pay_status'] = 1;
 
@@ -2411,6 +2429,7 @@ class ExportController extends Controller
                         array('promote_account', L('Subordinate_channel')),
                         array('pay_amount', "充值平台币"),
                         array('pay_way', "充值方式"),
+                        array('merchant_id', "所属商户"),
                         array('create_time', "充值时间"),
                         array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
                         array('', "共计充值{$total}"),
@@ -2427,6 +2446,7 @@ class ExportController extends Controller
 //                    var_dump($xlsData);die();
                     foreach ($xlsData as $key => $value) {
                         $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
+                        $xlsData[$key]['merchant_id'] = getMerchantName($value['merchant_id']);
                         if(!$xlsData[$key]['pay_way']) {
                             $xlsData[$key]['pay_way'] = '无';
                         } else {
@@ -2449,6 +2469,7 @@ class ExportController extends Controller
                         array('order_amount', '订单金额'),
                         array('pay_amount', '实付金额'),
                         array('pay_way', '充值方式'),
+                        array('merchant_id', '所属商户'),
                         array('add_time', '录入时间'),
                     );
     
@@ -2490,6 +2511,10 @@ class ExportController extends Controller
                         $timeend = strtotime($params['timeend'])+86399;
                         $map['t.pay_time'] = array("ELT",$timeend);
                     }
+                    if ($_REQUEST['merchant_id']) {
+                        $map['merchant_id'] = $_REQUEST['merchant_id'];
+                        unset($_REQUEST['merchant_id']);
+                    }
     
     
                     $orderData =M('test_order t', 'tab_')
@@ -2517,6 +2542,7 @@ class ExportController extends Controller
                         $order_list['pay_amount'] = $v['pay_amount'];
                         $order_list['pay_way'] = get_pay_way($v['pay_way']);
                         $order_list['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
+                        $order_list['merchant_id'] = getMerchantName($v['merchant_id']);
 
                         checkEncryptionAuth($order_list['user_account'],'TestOrder_lists');
 
@@ -8253,18 +8279,21 @@ class ExportController extends Controller
 
         $map = [];
 
+        $searchGameIds = null;
         $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id');
         if ($game_ids) {
             $map['s.game_id'] = ['in', $game_ids];
+            $searchGameIds = $game_ids;
         }
 
+
         if (!empty(I('partner_id'))) {
             $map['g.partner_id'] = I('partner_id');
         }
 
         if (!empty(I('timestart'))) {
             $timestart = strtotime(I('timestart'));
-            $map['_string'] = "s.pay_time >= {$timestart}";
+            $map['_string'] = "s.payed_time >= {$timestart}";
         }
 
         if (!empty(I('timeend'))) {
@@ -8272,25 +8301,41 @@ class ExportController extends Controller
             if (!empty($map['_string'])) {
                 $map['_string'] .= " and ";
             }
-            $map['_string'] .= " s.pay_time < {$timeend}";
+            $map['_string'] .= " s.payed_time < {$timeend}";
         }
 
         if (!empty(I('game_type_id'))) {
             $map['g.game_type_id'] = I('game_type_id');
+            $searchGameIds = M('game', 'tab_')->where(['game_type_id' => I('game_type_id', 0)])->getField('id', true);
         }
 
         $xlsData = D("spend")->gameStatistics($map);
 
         $uniqueCodes = array_column($xlsData, 'unique_code');
+        $gameIds = array_column($xlsData, 'game_id');
         $uniqueCodes = array_filter($uniqueCodes, function($value) {
             if ($value) {
                 return true;
             }
             return false;
         });
+
+        $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->where(['game_id' => ['in', $gameIds]])->select();
+        $gameSets = index_by_column('game_id', $gameSets);
+
+        $searchGameCodes = [];
+        if (count($searchGameIds) > 0) {
+            $searchGameCodes = M('game', 'tab_')->where(['id' => ['in', $searchGameIds], 'unique_code' => ['neq', '']])->getField('unique_code', true);
+            $searchGameCodes = array_unique($searchGameCodes);
+        }
         
         $client = new AggregateClient();
-        $result = $client->api('game-data', ['unique_codes' => $uniqueCodes, 'started_at' => I('timestart', ''), 'ended_at' => I('timeend', '')]);
+        $result = $client->api('game-data', [
+            'unique_codes' => $uniqueCodes, 
+            'started_at' => I('timestart', ''), 
+            'ended_at' => I('timeend', ''),
+            'search_games' => $searchGameCodes,
+        ]);
         $aggData = [];
         $aggTotal = '0.00';
         if ($result['code'] == '0000') {
@@ -8298,7 +8343,7 @@ class ExportController extends Controller
             $aggTotal = $result['data']['total'];
         }
 
-        $exceptIds = [];
+        $exceptIds = getAggExceptIds($gameSets);
         foreach ($xlsData as $key => $value) {
             $aggAmount = '0.00';
             $deviceType = $value['sdk_version'] == 1 ? 'android' : 'ios';
@@ -8306,11 +8351,10 @@ class ExportController extends Controller
                 $aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', '');
             }
             $xlsData[$key]['agg_amount'] = $aggAmount;
-            if ($aggAmount != '0.00') {
-                $value['cash_count'] = 0;
-                $value['balance_coin_count'] = 0;
-                $value['inside_cash_count'] = 0;
-                $exceptIds[] = $value['game_id'];
+            if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) {
+                $xlsData[$key]['cash_count'] = $value['cash_count'] = 0;
+                $xlsData[$key]['balance_coin_count'] =$value['balance_coin_count'] = 0;
+                $xlsData[$key]['inside_cash_count'] =$value['inside_cash_count'] = 0;
             }
             // $xlsData[$key]['game_name'] = substr($value["game_name"],0,strrpos($value["game_name"],'('));
             $xlsData[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'];
diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php
index 4cfd24076..3940b4203 100644
--- a/Application/Admin/Controller/FinanceController.class.php
+++ b/Application/Admin/Controller/FinanceController.class.php
@@ -707,9 +707,11 @@ class FinanceController extends ThinkController
 
         $map = [];
 
+        $searchGameIds = null;
         $game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id');
         if ($game_ids) {
             $map['s.game_id'] = ['in', $game_ids];
+            $searchGameIds = $game_ids;
         }
 
         if (!empty(I('partner_id'))) {
@@ -731,10 +733,13 @@ class FinanceController extends ThinkController
 
         if (!empty(I('game_type_id'))) {
             $map['g.game_type_id'] = I('game_type_id');
+            $searchGameIds = M('game', 'tab_')->where(['game_type_id' => I('game_type_id', 0)])->getField('id', true);
         }
+        
         $startTime = time();
        //游戏统计列表
         $data = D("spend")->gameStatistics($map, $row, $p);
+        $gameIds = array_column($data, 'game_id');
         $uniqueCodes = array_column($data, 'unique_code');
         $uniqueCodes = array_filter($uniqueCodes, function($value) {
             if ($value) {
@@ -743,8 +748,22 @@ class FinanceController extends ThinkController
             return false;
         });
         
+        $gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->select();
+        $gameSets = index_by_column('game_id', $gameSets);
+
+        $searchGameCodes = [];
+        if (count($searchGameIds) > 0) {
+            $searchGameCodes = M('game', 'tab_')->where(['id' => ['in', $searchGameIds], 'unique_code' => ['neq', '']])->getField('unique_code', true);
+            $searchGameCodes = array_unique($searchGameCodes);
+        }
+
         $client = new AggregateClient();
-        $result = $client->api('game-data', ['unique_codes' => $uniqueCodes, 'started_at' => I('timestart', ''), 'ended_at' => I('timeend', '')]);
+        $result = $client->api('game-data', [
+            'unique_codes' => $uniqueCodes,
+            'started_at' => I('timestart', ''),
+            'ended_at' => I('timeend', ''),
+            'search_games' => $searchGameCodes,
+        ]);
         $aggData = [];
         $aggTotal = '0.00';
         if ($result['code'] == '0000') {
@@ -753,18 +772,18 @@ class FinanceController extends ThinkController
         }
 
         $endTime = time();
-        $exceptIds = [];
+        $exceptIds = getAggExceptIds($gameSets);
         foreach ($data as $key => $value) {
             $aggAmount = '0.00';
             $deviceType = $value['sdk_version'] == 1 ? 'android' : 'ios';
             if ($value['unique_code'] && isset($aggData[$value['unique_code']]) && isset($aggData[$value['unique_code']][$deviceType])) {
                 $aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', '');
             }
-            if ($aggAmount != '0.00') {
+            // if ($aggAmount != '0.00') {
+            if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) {
                 $data[$key]['cash_count'] = $value['cash_count'] = 0;
                 $data[$key]['balance_coin_count'] = $value['balance_coin_count'] = 0;
                 $data[$key]['inside_cash_count'] = $value['inside_cash_count'] = 0;
-                $exceptIds[] = $value['game_id'];
             }
             $data[$key]['all_cash_count'] = number_format($value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'],2,'.','');
             $data[$key]['agg_amount'] = $value['unique_code'] ? $aggAmount : '0.00';
diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php
index eeb1ce40a..e314200ff 100644
--- a/Application/Admin/Controller/MarketPercentageController.class.php
+++ b/Application/Admin/Controller/MarketPercentageController.class.php
@@ -23,7 +23,7 @@ class MarketPercentageController extends ThinkController
 
         $admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
         $map['admin_id'] = $admin_id;
-        if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14) {
+        if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
             unset($map['admin_id']);
             $admin_data = M("member")
                 ->field("access.uid admin_id")
@@ -199,7 +199,7 @@ class MarketPercentageController extends ThinkController
 
         $admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
         $map['admin_id'] = $admin_id;
-        if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14) {
+        if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
             unset($map['admin_id']);
 
             $admin_data = M("member")
@@ -561,7 +561,7 @@ class MarketPercentageController extends ThinkController
 
         $admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
         $map['admin_id'] = $admin_id;
-        if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14) {
+        if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
             unset($map['admin_id']);
 
             $admin_data = M("member")
diff --git a/Application/Admin/Controller/TestOrderController.class.php b/Application/Admin/Controller/TestOrderController.class.php
index 0141a6507..638f3c3e1 100644
--- a/Application/Admin/Controller/TestOrderController.class.php
+++ b/Application/Admin/Controller/TestOrderController.class.php
@@ -47,6 +47,10 @@ class TestOrderController extends ThinkController
             $timeend = strtotime($_REQUEST['timeend'])+86399;
             $map['pay_time'] = array("ELT",$timeend);
         }
+        if ($_REQUEST['merchant_id']) {
+            $map['merchant_id'] = $_REQUEST['merchant_id'];
+            unset($_REQUEST['merchant_id']);
+        }
         $order_list = M('test_order t', 'tab_')
                       ->field("t.*,g.sdk_version")
                       ->join("tab_game g on t.game_id = g.id","left")
diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php
index 2c04fa38f..7debc9146 100644
--- a/Application/Admin/Controller/TimingController.class.php
+++ b/Application/Admin/Controller/TimingController.class.php
@@ -757,7 +757,7 @@ class TimingController extends AdminController {
     public function caculateMarketStream () {
         echo date("Y-m-d H:i:s")."----------------------市场结算管理计算----------------------\n";
 
-        $map['pay_time'] = date("Y-m",strtotime('-1 month'));
+        $map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
 
         if ($_REQUEST['time']) {
             $map['pay_time'] = $_REQUEST['time'];
@@ -765,7 +765,7 @@ class TimingController extends AdminController {
         $spend_map = [];
         if($_REQUEST['time'] == 'all') {
             $map = [];
-            $spend_map['pay_time'] = ['elt',strtotime(date('Y-m-t 23:59:59', strtotime('-1 month')))];
+            $spend_map['pay_time'] = ['elt',strtotime(date('Y-m-t 23:59:59', strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')))];
         }
 
         $data = M("auth_group")
@@ -971,8 +971,8 @@ class TimingController extends AdminController {
         }
 
         if (!$pay_time) {
-            $pay_time = date("Y-m",strtotime('-1 month'));
-            $map['pay_time'] = date("Y-m",strtotime('-1 month'));
+            $pay_time = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
+            $map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
         }
 
         if ($pay_time == 'all') {
@@ -984,7 +984,7 @@ class TimingController extends AdminController {
                 $date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
                 $i++;
                 $this->insertAllUserBonus($date);
-            } while ($date < date('Y-m', strtotime("{$end} -1 month")));
+            } while ($date < date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')));
 
 //            $map['pay_time'] = [];
             unset($map['pay_time']);
@@ -1090,7 +1090,7 @@ class TimingController extends AdminController {
     public function sendMarketBonus(){
         echo date("Y-m-d H:i:s")."----------------------月初发放市场专员应发份额----------------------\n";
 
-        $map['pay_time'] = date("Y-m",strtotime('-1 month'));
+        $map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
 
         if ($_REQUEST['time']) {
             $map['pay_time'] = $_REQUEST['time'];
diff --git a/Application/Admin/View/CompanyStatementPool/viewCpPool.html b/Application/Admin/View/CompanyStatementPool/viewCpPool.html
index 2f0f88287..2fe543ae5 100644
--- a/Application/Admin/View/CompanyStatementPool/viewCpPool.html
+++ b/Application/Admin/View/CompanyStatementPool/viewCpPool.html
@@ -126,7 +126,7 @@
                             <td rowspan="{$com.statement_count}">{$com.company_name}</td>
                             <td rowspan="{$com.statement_count}">{$com.matche_platform}</td>
                             <!-- <td rowspan="{$com.statement_count}">{$com.statement_begin_time} ~ {$com.statement_end_time}</td> -->
-                            <td>{$com['statement_info'][0]['statement_begin_time']} ~ {$com['statement_info'][0]['statement_end_time']}</td>
+                            <td>{$com['statement_info'][0]['statement_begin_time']} - {$com['statement_info'][0]['statement_end_time']}</td>
 
                             <td>{$com['statement_info'][0]['game_name']}</td>
                             <td>{$com['statement_info'][0]['pay_amount']}</td>
@@ -145,7 +145,7 @@
                         <foreach name="com.statement_info" item="it" key="k">
                             <if condition="$k neq 0">
                                 <tr>
-                                    <td>{$it['statement_begin_time']} ~ {$it['statement_end_time']}</td>
+                                    <td>{$it['statement_begin_time']} - {$it['statement_end_time']}</td>
                                     <td>{$it['game_name']}</td>
                                     <td>{$it['pay_amount']}</td>
                                     <td>{$it['pay_amount']}</td>
diff --git a/Application/Admin/View/CompanyStatementPool/viewPcPool.html b/Application/Admin/View/CompanyStatementPool/viewPcPool.html
index b8d1c2e5a..1821046e7 100644
--- a/Application/Admin/View/CompanyStatementPool/viewPcPool.html
+++ b/Application/Admin/View/CompanyStatementPool/viewPcPool.html
@@ -127,7 +127,7 @@
                             <td rowspan="{$com.statement_count}">{$com.reward}</td>
                             <td rowspan="{$com.statement_count}">{$com.statement_money}</td>
                             <td rowspan="{$com.statement_count}">{$com.settlement_contact}</td>
-                            <td>{$com['statement_info'][0]['statement_begin_time']} ~ {$com['statement_info'][0]['statement_end_time']}</td>
+                            <td>{$com['statement_info'][0]['statement_begin_time']} - {$com['statement_info'][0]['statement_end_time']}</td>
                             <td rowspan="{$com.statement_count}">{$com.renark}</td>
                         </tr>
 
@@ -140,7 +140,7 @@
                                     <td>{$it['increment_ratio']}%</td>
                                     <td>{$it['fax_ratio']}%</td>
                                     <td>{$it['d_statement_money']}</td>
-                                    <td>{$it['statement_begin_time']} ~ {$it['statement_end_time']}</td>
+                                    <td>{$it['statement_begin_time']} - {$it['statement_end_time']}</td>
                                 </tr>
                             </if>
                         </foreach>
diff --git a/Application/Admin/View/CompanyStatementPool/viewPuPool.html b/Application/Admin/View/CompanyStatementPool/viewPuPool.html
index 5b6b25910..ad3b017f0 100644
--- a/Application/Admin/View/CompanyStatementPool/viewPuPool.html
+++ b/Application/Admin/View/CompanyStatementPool/viewPuPool.html
@@ -111,10 +111,17 @@
                         <th>奖励</th>
                         <th>罚款</th>
                         <th>结算金额</th>
-                        <th>开户名</th>
-                        <th>银行卡号</th>
-                        <th>开户支行</th>
-                        <th>帐户类型</th>
+                        <if condition="$is_payment eq 2">
+                            <th>开户名</th>
+                            <th>银行卡号</th>
+                            <th>开户支行</th>
+                            <th>帐户类型</th>
+                        </if>
+                        <if condition="$is_payment eq 1">
+                            <th>支付宝真实姓名</th>
+                            <th>支付宝账号</th>
+                        </if>
+
                         <th>备注</th>
                         <th>是否结算</th>
                         <if condition="!$is_export">
@@ -136,7 +143,7 @@
 
                             <td>{$com['statement_info'][0]['game_name']}</td>
                             <td>{$com['statement_info'][0]['game_type_name']}</td>
-                            <td>{$com['statement_info'][0]['statement_begin_time']} ~ {$com['statement_info'][0]['statement_end_time']}</td>
+                            <td>{$com['statement_info'][0]['statement_begin_time']} - {$com['statement_info'][0]['statement_end_time']}</td>
                             <td>{$com['statement_info'][0]['pay_amount']}</td>
                             <if condition="$com['statement_info'][0]['statement_type'] neq 0">
                                 <td></td>
@@ -150,10 +157,18 @@
                             <td>{$com['statement_info'][0]['fine']}</td>
                             <td>{$com['statement_info'][0]['sum_money']}</td>
 
-                            <td rowspan="{$com.statement_count}">{$com.company_info.payee_name}</td>
-                            <td rowspan="{$com.statement_count}">&nbsp;{$com.company_info.bank_account}</td>
-                            <td rowspan="{$com.statement_count}">{$com.company_info.opening_bank}</td>
-                            <td rowspan="{$com.statement_count}"></td>
+                            <if condition="$is_payment eq 2">
+                                <td rowspan="{$com.statement_count}">{$com.company_info.payee_name}</td>
+                                <td rowspan="{$com.statement_count}">&nbsp;{$com.company_info.bank_account}</td>
+                                <td rowspan="{$com.statement_count}">{$com.company_info.opening_bank}</td>
+                                <td rowspan="{$com.statement_count}"></td>
+                            </if>
+
+                            <if condition="$is_payment eq 1">
+                                <td rowspan="{$com.statement_count}">{$com.company_info.ali_user}</td>
+                                <td rowspan="{$com.statement_count}">{$com.company_info.ali_account}</td>
+                            </if>
+
                             <td rowspan="{$com.statement_count}">{$com.remark}</td>
                             <td rowspan="{$com.statement_count}"><if condition="$com['st'] eq 0">否 <else /> 是 </if></td>
                             <if condition="!$is_export">
@@ -173,7 +188,7 @@
                                 <tr>
                                     <td>{$it['game_name']}</td>
                                     <td>{$it['game_type_name']}</td>
-                                    <td>{$it['statement_begin_time']} ~ {$it['statement_end_time']}</td>
+                                    <td>{$it['statement_begin_time']} - {$it['statement_end_time']}</td>
                                     <td>{$it['pay_amount']}</td>
 
                                     <if condition="$it['statement_type'] neq 0">
@@ -200,11 +215,16 @@
                         <td></td>
                         <td></td>
                         <td>{$count.sum_money|default=0}</td>
-                       
-                        <td></td>
-                        <td></td>
-                        <td></td>
-                        <td></td>
+                        <if condition="$is_payment eq 2">
+                            <td></td>
+                            <td></td>
+                            <td></td>
+                            <td></td>
+                        </if>
+                        <if condition="$is_payment eq 1">
+                            <td></td>
+                            <td></td>
+                        </if>
                         <td></td>
                         <td></td>
                         <if condition="!$is_export">
diff --git a/Application/Admin/View/Deposit/lists.html b/Application/Admin/View/Deposit/lists.html
index 11ac0aef1..8b9a258d9 100644
--- a/Application/Admin/View/Deposit/lists.html
+++ b/Application/Admin/View/Deposit/lists.html
@@ -81,7 +81,14 @@
                     <option value="0">下单未付款</option>
                 </select>
             </div>
-
+            <div class="input-list search_item input-list-gamenoticestatus">
+                <select id="merchant_id" name="merchant_id" class="select_gallery">
+                    <option value="0">请选择商户</option>
+                    <volist name=":getMerchantList()" id="vo">
+                        <option value="{$vo.id}" <if condition="$_GET['merchant_id'] eq $vo['id']">selected</if>>{$vo.name}</option>
+                    </volist>
+                </select>
+            </div>
 <!--            <div class="input-list search_item input-list-gamenoticestatus">-->
 <!--                <select name="promote_level" style="color:#444" class="select_gallery" id="promote_level">-->
 <!--                    <option value="">请选择推广员等级</option>-->
@@ -125,6 +132,7 @@
                     </th>
                     <th>充值方式</th>
                     <th>充值ip</th>
+                    <th>所属商户</th>
                     <th>
                         <a class="paixu" data-order='create_time'>
                             充值时间
@@ -186,6 +194,7 @@
                             <td><span>{$data.pay_amount}</span></td>
                             <td><if condition="$data['pay_way'] neq ''">{:get_pay_way($data['pay_way'])}<else/>无</if></td>
                             <td>{$data.pay_ip}</td>
+                            <td>{:getMerchantName($data['merchant_id'])}</td>
                             <td>{:set_show_time($data['create_time'],'','pay')}</td>
                             <td>
                                 <if condition="$data['pay_status'] eq 1">
@@ -215,7 +224,7 @@
                 </empty>
                 <tr class="data_summary">
                     <td>汇总</td>
-                    <td colspan="9">
+                    <td colspan="10">
                         当页充值:{:array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount'))};
                         今日充值:{$ttotal} ;
                         昨日充值:{$ytotal} ;
diff --git a/Application/Admin/View/Deposit/lists_secord.html b/Application/Admin/View/Deposit/lists_secord.html
index c79fed93c..9c3c1378a 100644
--- a/Application/Admin/View/Deposit/lists_secord.html
+++ b/Application/Admin/View/Deposit/lists_secord.html
@@ -90,6 +90,14 @@
                     <option value="">请选择推广员</option>
                 </select>
             </div>
+            <div class="input-list search_item input-list-gamenoticestatus">
+                <select id="merchant_id" name="merchant_id" class="select_gallery">
+                    <option value="0">请选择商户</option>
+                    <volist name=":getMerchantList()" id="vo">
+                        <option value="{$vo.id}" <if condition="$_GET['merchant_id'] eq $vo['id']">selected</if>>{$vo.name}</option>
+                    </volist>
+                </select>
+            </div>
 
             <input type="hidden" name="" value="" class="sortBy">
             <div class="input-list">
@@ -116,6 +124,7 @@
                         </a>
                     </th>
                     <th>充值方式</th>
+                    <th>所属商户</th>
                     <th>
                         <a class="paixu" data-order='create_time'>
                             支付时间
@@ -154,6 +163,7 @@
                             </td>
                             <td><span>{$data.pay_amount}</span></td>
                             <td><if condition="$data['pay_way'] neq ''">{:get_pay_way($data['pay_way'])}<else/>无</if></td>
+                            <td>{:getMerchantName($data['merchant_id'])}</td>
                             <td>{:set_show_time($data['create_time'],'','pay')}</td>
                             <td>
                                 <if condition="$data['pay_status'] eq 1">
diff --git a/Application/Admin/View/Promote/edit.html b/Application/Admin/View/Promote/edit.html
index bfda48013..96a199a74 100644
--- a/Application/Admin/View/Promote/edit.html
+++ b/Application/Admin/View/Promote/edit.html
@@ -344,22 +344,6 @@
                             <span class="notice-text">显示推广员的平台币余额,推广员平台币用于会长代充或者转移给下级推广员</span>
                         </td>
                     </tr>
-                    <if condition="$data['level'] eq 1">
-                      <tr>
-                        <td class="l">结算模式:</td>
-                        <td class="r table_radio">
-                        <span class="form_radio table_btn">
-                            <label>
-                                <input type="radio"  value="1" name="settlement_type" <eq name="data['settlement_type']" value="1">checked="checked"</eq>>周结
-                            </label>
-                            <label>
-                                <input type="radio"  value="2" name="settlement_type" <eq name="data['settlement_type']" value="2">checked="checked"</eq>>月结
-                            </label>
-                        </span>
-                          <span class="notice-text">会长推广结算模式</span>
-                        </td>
-                      </tr>
-                    </if>
                 </tbody>
             </table>
         </div>
diff --git a/Application/Admin/View/Spend/lists.html b/Application/Admin/View/Spend/lists.html
index 7a15d6d3a..fdcc521d4 100644
--- a/Application/Admin/View/Spend/lists.html
+++ b/Application/Admin/View/Spend/lists.html
@@ -150,7 +150,7 @@
                 <select id="merchant_id" name="merchant_id" class="select_gallery">
                     <option value="0">请选择商户</option>
                     <volist name=":getMerchantList()" id="vo">
-                        <option value="{$vo.id}">{$vo.name}</option>
+                        <option value="{$vo.id}" <if condition="$_GET['merchant_id'] eq $vo['id']">selected</if>>{$vo.name}</option>
                     </volist>
                 </select>
             </div>
@@ -308,7 +308,7 @@
                     <if condition="$rule_count_check">
                     <tr class="data_summary">
                         <td>汇总</td>
-                        <td colspan="18">
+                        <td colspan="19">
                             当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))}
                             <!-- 今日充值:{$ttotal}-->
                             <!-- 昨日充值:{$ytotal}-->
diff --git a/Application/Admin/View/TestOrder/lists.html b/Application/Admin/View/TestOrder/lists.html
index 9cb4a9dc7..f75eb69ef 100644
--- a/Application/Admin/View/TestOrder/lists.html
+++ b/Application/Admin/View/TestOrder/lists.html
@@ -87,6 +87,14 @@
           <option value="17" <if condition="$_GET['pay_way']  eq '17'">selected</if>>易宝支付</option>
         </select>
       </div>
+      <div class="input-list search_item input-list-gamenoticestatus">
+        <select id="merchant_id" name="merchant_id" class="select_gallery">
+          <option value="0">请选择商户</option>
+          <volist name=":getMerchantList()" id="vo">
+            <option value="{$vo.id}" <if condition="$_GET['merchant_id'] eq $vo['id']">selected</if>>{$vo.name}</option>
+          </volist>
+        </select>
+      </div>
 
       <div class="input-list">
         <a class="sch-btn" href="javascript:;" id="search" url="{:U('TestOrder/lists','model='.$model['name'].'&row='.I('row'),false)}" style="">搜索</a>
@@ -130,6 +138,8 @@
 
           <th >充值方式</th>
 
+          <th>所属商户</th>
+
           <th >录入时间</th>
 
           <th >操作</th>
@@ -161,6 +171,7 @@
               <td >{$data.order_amount}</td>
               <td >{$data.pay_amount}</td>
               <td >{$data.pay_way|get_pay_way}</td>
+              <td>{:getMerchantName($data['merchant_id'])}</td>
               <td >{$data.add_time|date='Y-m-d H:i:s',###}</td>
               <td ><a class="confirm del" data-id="{$data.id}">删除</a></td>
             </tr>
@@ -179,6 +190,7 @@
             <td >------</td>
             <td >------</td>
             <td >------</td>
+            <td >------</td>
           </tr>
         </notemtpy>
         </tbody>
diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php
index 526108922..6a50765dc 100644
--- a/Application/Common/Common/extend.php
+++ b/Application/Common/Common/extend.php
@@ -3029,4 +3029,23 @@ function db2csv(&$data,$title,$header=false){
 function hideRealName($realName)
 {
 	return mb_strlen($realName,'utf-8') == 2 ? mb_substr($realName,0,1,'utf-8').'*':mb_substr($realName,0,1,'utf-8').'**';
+}
+
+function isAggGame($payUrl)
+{
+    if (strpos($payUrl, 'sdk-pay-a.wmtxkj') !== false || strpos($payUrl, 'sdk-pay-i.wmtxkj') !== false ) {
+        return true;
+    }
+    return false;
+}
+
+function getAggExceptIds($gameSettings)
+{
+    $exceptIds = [];
+    foreach ($gameSettings as $setting) {
+        if (isAggGame($setting['pay_notify_url'])) {
+            $exceptIds[] = $setting['game_id'];
+        }
+    }
+    return $exceptIds;
 }
\ No newline at end of file
diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php
index c4ddb5e71..07ec33d96 100644
--- a/Application/Home/Controller/SafeController.class.php
+++ b/Application/Home/Controller/SafeController.class.php
@@ -415,7 +415,7 @@ class SafeController extends BaseController{
         $bank = $_REQUEST["bank_card"];           //银行账号
         $bank_name = $_REQUEST["bank_name"];             //开户银行
         $bank_account = $_REQUEST['bank_account'];        //银行账户名
-        $agreementpic = $_REQUEST["agreementpic"];
+        $agreementpic = $_REQUEST["agreementpic"] ?? '';
         $alipayaccount = $_REQUEST['alipay_account'];
         $alipayrealname = $_REQUEST['alipay_real_name'];
 
@@ -482,10 +482,10 @@ class SafeController extends BaseController{
             $this->error('卡号格式错误');
             return false;
         } 
-        if(empty($agreementpic)) {
-            $this->error("补充协议不能为空");
-            return false;
-        }
+        // if(empty($agreementpic)) {
+        //     $this->error("补充协议不能为空");
+        //     return false;
+        // }
         if (empty($alipayaccount)) {
             $this->error('支付宝账户不能为空');
             return false;
@@ -519,7 +519,7 @@ class SafeController extends BaseController{
         $data['alipay_real_name'] = $alipayrealname;
 
      //  $data['agreementpic'] = $
-        $data['anothpic'] = $agreementpic;
+        $agreementpic ? $data['anothpic'] = $agreementpic : null;
         $id = get_pid();
         $updateRs = M("promote","tab_")->where(['id'=>$id])->save($data);
             if($updateRs) {
diff --git a/Application/Payment/Common/extend.php b/Application/Payment/Common/extend.php
index 2e4b75364..1cb8c0d56 100644
--- a/Application/Payment/Common/extend.php
+++ b/Application/Payment/Common/extend.php
@@ -2162,7 +2162,7 @@ function getGamePromoteCompanyRadio($company_id,$relation_game_id,$endtime,$amou
     if(empty($cgr_res)){
         //模板搜索
         //获取公司类型
-        if($company_belong === false){
+        if($company_belong == false){
             $company_belong =  M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
         }
         $mwhere = "company_belong='{$company_belong}' and relation_game_id='{$relation_game_id}'";