diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 518e5122a..52ae4ab44 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2113,4 +2113,27 @@ function check_str($str, $substr) return $nums; } +function getPromoteGameRatio($promoteID = 0, $relationGameId = 0, $amount=0, $timeStart=0, $timeEnd=0, $isDefault = false) +{ + $map = " promote_id = {$promoteID} and relation_game_id = {$relationGameId} and status = 1 and begin_time <= {$timeStart} "; + if ($timeEnd) { + $map .= " and (end_time = 0 or end_time >= {$timeEnd}) "; + } + $result = M('promote_game_ratio_log', 'tab_')->where($map)->order('id desc')->find(); + if (!$result) return 0; + $ratios = array_reverse(json_decode($result['turnover_ratio'], true)); + if (!$ratios) return 0; + if ($isDefault) { + return $result['ratio'] ?: 0; + } + $ratio = $result['ratio']; + foreach ($ratios as $item) { + if (($item['instanceof'] == 1 && $amount >= $item['turnover']) || ($item['instanceof'] == 2 && $amount > $item['turnover'])) { + $ratio = $item['ratio']; + break; + } + } + return $ratio; +} + ?> diff --git a/Application/Admin/Controller/AdminController.class.php b/Application/Admin/Controller/AdminController.class.php index af06678f6..97bfe625a 100644 --- a/Application/Admin/Controller/AdminController.class.php +++ b/Application/Admin/Controller/AdminController.class.php @@ -48,7 +48,8 @@ class AdminController extends Controller { if ( false === $access ) { $this->error('403:禁止访问'); }elseif(null === $access ){ - if(CONTROLLER_NAME !== "Ajax"){//ajax放行 + $access_controller = ['Ajax', 'Finance', 'FinancePromote', 'PayChannel']; + if(!in_array(CONTROLLER_NAME, $access_controller)){//ajax放行 //检测访问权限 $rule = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME); if($rule == "admin/statistics/overview"||$rule == "admin/spend/lists"){//第一级菜单单独判断 diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index 83cc1f5fd..90a5f3ba0 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -191,6 +191,10 @@ class AjaxController extends ThinkController{ foreach ($data as &$item) { $item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : ""); } + if($company_id <= 0){ + array_unshift($data,["id"=>0,"nickname"=>"官方渠道","account"=>"官方渠道","company_id"=>0]); + + } $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>$data]); } diff --git a/Application/Admin/Controller/DepositController.class.php b/Application/Admin/Controller/DepositController.class.php index b386cddb7..bd1c1aa67 100644 --- a/Application/Admin/Controller/DepositController.class.php +++ b/Application/Admin/Controller/DepositController.class.php @@ -10,7 +10,7 @@ use User\Api\UserApi as UserApi; class DepositController extends ThinkController { const model_name = 'Deposit'; - public function lists(){ + public function lists($p = 1){ if(isset($_REQUEST['user_account'])){ $map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%'); unset($_REQUEST['user_account']); @@ -38,16 +38,10 @@ class DepositController extends ThinkController { }else if(isset($_REQUEST['promote_id']) && $_REQUEST['promote_id']==0){ $map['promote_id']=array('elt',0); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); }elseif(isset($_REQUEST['promote_name'])&&$_REQUEST['promote_id']==-1){ $map['promote_id']=get_promote_id($_REQUEST['promote_name']); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); }else{ $map['promote_id']=$_REQUEST['promote_id']; - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); @@ -94,6 +88,47 @@ class DepositController extends ThinkController { $map1=$map; $map1['pay_status']=1; + +// if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') { +// $page = intval($p); +// $page = $page ? $page : 1; //默认显示第一页数据 +// if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} +// $map1['order_status'] = 1; +// unset($map1['pay_status']); +// if ($map['pay_status']) { +// $map['order_status']=$map['pay_status']; +// } +// +// $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); +// $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); +// $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); +// $this->assign('total',$total); +// $this->assign('ttotal',$ttotal); +// $this->assign('ytotal',$ytotal); +// +// $data = D('coin_pay_order') +// /* 查询指定字段,不指定则查询所有字段 */ +// ->field('*,order_status as pay_status') +// // 查询条件 +// ->where($map) +// /* 默认通过id逆序排列 */ +// ->order("id desc") +// /* 数据分页 */ +// ->page($page, $row) +// /* 执行查询 */ +// ->select(); +// +// /* 查询记录总数 */ +// $count = D('coin_pay_order')->where($map)->count(); +// +// $page = set_pagination($count,$row); +// if($page) {$this->assign('_page', $page);} +// +// $this->assign('list_data', $data); +// $this->meta_title = '平台币充值列表'; +// $this->display('lists');die(); +// } + $total=null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); $ttotal=null_to_0(D(self::model_name)->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); $ytotal=null_to_0(D(self::model_name)->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); @@ -105,9 +140,122 @@ class DepositController extends ThinkController { $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Deposit/lists','status'=>1])->find()); $this->assign("is_admin",is_administrator()); + parent::lists(self::model_name,$_GET["p"],$map); } + public function lists_secord() { + + if(isset($_REQUEST['user_account'])){ + $map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%'); + unset($_REQUEST['user_account']); + } + if(isset($_REQUEST['order_number'])){ + $map['order_number']=array('like','%'.trim($_REQUEST['order_number']).'%'); + unset($_REQUEST['order_number']); + } + if(isset($_REQUEST['pay_ip'])){ + $map['pay_ip']=array('like','%'.trim($_REQUEST['pay_ip']).'%'); + unset($_REQUEST['pay_ip']); + } + + setPowerPromoteIds($map,'promote_id'); + + if(!isset($_REQUEST['promote_id'])){ + + }else if(isset($_REQUEST['promote_id']) && $_REQUEST['promote_id']==0){ + $map['promote_id']=array('elt',0); + }elseif(isset($_REQUEST['promote_name'])&&$_REQUEST['promote_id']==-1){ + $map['promote_id']=get_promote_id($_REQUEST['promote_name']); + }else{ + $map['promote_id']=$_REQUEST['promote_id']; + } + if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ + $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); + unset($_REQUEST['time-start']);unset($_REQUEST['time-end']); + }elseif(isset($_REQUEST['time-start'])){ + $map['create_time'] = ['GT',strtotime(I('time-start'))]; + unset($_REQUEST['time-start']); + }elseif(isset($_REQUEST['time-end'])){ + $map['create_time'] = ['LT',strtotime(I('time-end'))+86399]; + unset($_REQUEST['time-end']); + } + if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ + $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); + unset($_REQUEST['start']);unset($_REQUEST['end']); + }elseif(isset($_REQUEST['start'])){ + $map['create_time'] = ['GT',strtotime(I('start'))]; + unset($_REQUEST['start']); + }elseif(isset($_REQUEST['end'])){ + $map['create_time'] = ['LT',strtotime(I('end'))+86399]; + unset($_REQUEST['end']); + } + if(isset($_REQUEST['pay_way'])) { + if ($_REQUEST['pay_way'] == "2") { + $map['pay_way'] = ['in', '2,3,4']; + } else { + $map['pay_way'] = $_REQUEST['pay_way']; + } + unset($_REQUEST['pay_way']); + } + + + if(isset($_REQUEST['pay_status'])){ + $map['pay_status']=$_REQUEST['pay_status']; + unset($_REQUEST['pay_status']); + } + 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); + $sort = $data_order==3?'desc':'asc'; + $map['order'] = $data_order_type.' '.$sort; + } + + $map1=$map; + $map1['pay_status']=1; + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + $map1['order_status'] = 1; + unset($map1['pay_status']); + if ($map['pay_status']) { + $map['order_status']=$map['pay_status']; + } + + $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); + $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); + $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); + $this->assign('total',$total); + $this->assign('ttotal',$ttotal); + $this->assign('ytotal',$ytotal); + + $data = D('coin_pay_order') + /* 查询指定字段,不指定则查询所有字段 */ + ->field('*,order_status as pay_status,order_number as pay_order_number') + // 查询条件 + ->where($map) + /* 默认通过id逆序排列 */ + ->order("id desc") + /* 数据分页 */ + ->page($page, $row) + /* 执行查询 */ + ->select(); + + /* 查询记录总数 */ + $count = D('coin_pay_order')->where($map)->count(); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign("is_admin",is_administrator()); + $this->assign('list_data', $data); + $this->meta_title = '平台币充值列表'; + $this->display();die(); + } + public function send_lists(){ diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 14f221229..78804a5bf 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1259,16 +1259,10 @@ class ExportController extends Controller } else if (isset($_REQUEST['promote_id']) && $_REQUEST['promote_id'] == 0) { $map['promote_id'] = array('elt', 0); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } elseif (isset($_REQUEST['promote_name']) && $_REQUEST['promote_id'] == -1) { $map['promote_id'] = get_promote_id($_REQUEST['promote_name']); - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } else { $map['promote_id'] = $_REQUEST['promote_id']; - unset($_REQUEST['promote_id']); - unset($_REQUEST['promote_name']); } if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) { $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1)); @@ -1290,31 +1284,32 @@ class ExportController extends Controller } $map1 = $map; $map1['pay_status'] = 1; - $total = D('Deposit')->where($map1)->sum('pay_amount'); - if (isset($map['pay_status']) && $map['pay_status'] == 0) { - $total = sprintf("%.2f", 0); - } else { - $total = sprintf("%.2f", $total); - } - $xlsCell = array( - array('pay_order_number', "订单号"), - array('user_account', "玩家账号"), - array('promote_account', L('Subordinate_channel')), - array('pay_amount', "充值平台币"), - array('pay_way', "充值方式", 'get_pay_way', '*'), - array('pay_ip', "充值ip"), - array('create_time', "充值时间"), - array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), - array('', "共计充值{$total}"), - ); - $xlsData = D('Deposit') - ->where($map) - ->order('id DESC') - ->select(); - foreach ($xlsData as $key => $value) { - $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); - } + $total = D('Deposit')->where($map1)->sum('pay_amount'); + if (isset($map['pay_status']) && $map['pay_status'] == 0) { + $total = sprintf("%.2f", 0); + } else { + $total = sprintf("%.2f", $total); + } + + $xlsCell = array( + array('pay_order_number', "订单号"), + array('user_account', "玩家账号"), + array('promote_account', L('Subordinate_channel')), + array('pay_amount', "充值平台币"), + array('pay_way', "充值方式", 'get_pay_way', '*'), + array('pay_ip', "充值ip"), + array('create_time', "充值时间"), + array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), + array('', "共计充值{$total}"), + ); + $xlsData = D('Deposit') + ->where($map) + ->order('id DESC') + ->select(); + foreach ($xlsData as $key => $value) { + $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); + } // dd($xlsData); break; case 9: @@ -2235,6 +2230,104 @@ class ExportController extends Controller $xlsData[] = $re_data; } break; + case 26: + $xlsName = $xlsName?$xlsName:L('Platform_currency_recharge'); + if (isset($_REQUEST['user_account'])) { + $map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%'); + unset($_REQUEST['user_account']); + } + if (isset($_REQUEST['order_number'])) { + $map['order_number'] = array('like', '%' . trim($_REQUEST['order_number']) . '%'); + unset($_REQUEST['order_number']); + } + if (isset($_REQUEST['pay_ip'])) { + $map['pay_ip'] = array('like', '%' . trim($_REQUEST['pay_ip']) . '%'); + unset($_REQUEST['pay_ip']); + } + + // $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'])) { + + } else if (isset($_REQUEST['promote_id']) && $_REQUEST['promote_id'] == 0) { + $map['promote_id'] = array('elt', 0); + } elseif (isset($_REQUEST['promote_name']) && $_REQUEST['promote_id'] == -1) { + $map['promote_id'] = get_promote_id($_REQUEST['promote_name']); + } else { + $map['promote_id'] = $_REQUEST['promote_id']; + } + if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) { + $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1)); + unset($_REQUEST['time-start']); + unset($_REQUEST['time-end']); + } + if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) { + $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1)); + unset($_REQUEST['start']); + unset($_REQUEST['end']); + } + if (isset($_REQUEST['pay_way'])) { + $map['pay_way'] = $_REQUEST['pay_way']; + unset($_REQUEST['pay_way']); + } + if (isset($_REQUEST['pay_status'])) { + $map['pay_status'] = $_REQUEST['pay_status']; + unset($_REQUEST['pay_status']); + } + $map1 = $map; + $map1['pay_status'] = 1; + + $map1['order_status'] = 1; + unset($map1['pay_status']); + if ($map['pay_status']) { + $map['order_status']=$map['pay_status']; + } + + $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); + + if (isset($map['pay_status']) && $map['pay_status'] == 0) { + $total = sprintf("%.2f", 0); + } else { + $total = sprintf("%.2f", $total); + } + $xlsCell = array( + array('pay_order_number', "订单号"), + array('promote_account', L('Subordinate_channel')), + array('pay_amount', "充值平台币"), + array('pay_way', "充值方式"), + array('create_time', "充值时间"), + array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), + array('', "共计充值{$total}"), + ); + $xlsData = D('coin_pay_order') + /* 查询指定字段,不指定则查询所有字段 */ + ->field('*,order_status as pay_status,order_number as pay_order_number') + // 查询条件 + ->where($map) + /* 默认通过id逆序排列 */ + ->order("id desc") + /* 执行查询 */ + ->select(); +// var_dump($xlsData);die(); + foreach ($xlsData as $key => $value) { + $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); + if(!$xlsData[$key]['pay_way']) { + $xlsData[$key]['pay_way'] = '无'; + } else { + $xlsData[$key]['pay_way'] = get_pay_way($xlsData[$key]['pay_way'],'*'); + } + } + +// dd($xlsData); + break; default: $xlsName = $xlsCell = $xlsData = []; diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index d817c5e55..fa1a40ea6 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -2,7 +2,8 @@ namespace Admin\Controller; class FinancePromoteController extends AdminController { - public function _initialize(Type $var = null) + public $COMPANY_NAME = "万盟天下科技"; + public function _initialize() { parent::_initialize(); // echo "
";
@@ -114,7 +115,7 @@ class FinancePromoteController extends AdminController
             } else {
                 $v['company_belong']='内团';
             }
-            if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
+            if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
             if(empty($v['p_id'])) $v['p_id']= "0";
             if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
             if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
@@ -308,7 +309,7 @@ class FinancePromoteController extends AdminController
         foreach($senddata as $k=>$v){
 
             $v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团';
-            if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
+            if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
             if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
             if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
             if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
@@ -434,6 +435,8 @@ class FinancePromoteController extends AdminController
         }
         if (isset($_REQUEST['export'])) {
             data2csv($data,$title, array(
+                "company_name"=>"推广公司",
+                "account"=>"会长账号",
                 "partner_name"=>"合作公司",
                 "game_name"=>"游戏",
                 "cash_count"=>"游戏现金金额",
@@ -585,16 +588,26 @@ class FinancePromoteController extends AdminController
             ->field("s.game_id,s.game_name,p.partner as partner_name,
             SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
             SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
-            SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count")
+            SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,
+            IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
+            IFNULL(company_name,'{$this->COMPANY_NAME}') company_name")
             ->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
+            ->join("tab_promote promote ON s.promote_id = promote.id","left")
+            ->join("tab_promote_company company ON promote.company_id = company.id","left")
             ->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')
+            ->order("p_id asc,cash_count desc")
             ->where($map)
-            ->group('s.game_id');
+            ->group('p_id,game_id');
         if ($row != 0) {
             $query = $query->page($page,$row);
         }
-        $data = $query->select();
-        // dump($data);die();
+        $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)
@@ -621,27 +634,15 @@ class FinancePromoteController extends AdminController
             $map['pay_way'] = $_REQUEST['pay_way'];
             $this->assign('pay_way', $map['pay_way']);
         }
-
         if (!empty($_REQUEST['pay_order_number'])) {
             $map['pay_order_number'] = $_REQUEST['pay_order_number'];
         }
-
-        // if (!empty(I('partner_id'))&&empty(I("game_id"))) {
-        //     $wherePartner = I('partner_id');
-        //     $gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select();
-        //     $gameId = implode(',',array_column($gameId,'id'));
-        //     $map['tab_spend.game_id'] = ['in',$gameId];
-        // }
         if (!empty(I("game_id"))) {
             $map['tab_spend.game_id'] = I("game_id");
         }
         if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type']) || isset($_REQUEST['partner_id'])) {
             $map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameidByPartnerNameType($_REQUEST['partner_id'],$_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
         }
-        // if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
-        //     $map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
-        // }
-
         if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
             $map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
         } elseif (isset($_REQUEST['time_start'])) {
@@ -649,7 +650,6 @@ class FinancePromoteController extends AdminController
         } elseif (isset($_REQUEST['time_end'])) {
             $map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
         }
-
         if ($_REQUEST['promote_id'] != '') {
             if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
                 $map['tab_spend.promote_id'] = $_REQUEST['promote_id'];
@@ -725,8 +725,6 @@ class FinancePromoteController extends AdminController
         $count = count($count);
         $page = set_pagination($count,$row);
 
-
-        // $map['pay_game_status'] = 1;
         $total_cost = D('spend')->sumSpend($map, 'cost');//订单金额合计
         $total_pay_amount = D('spend')->sumSpend($map, 'pay_amount');//实付金额合计
 
@@ -888,7 +886,7 @@ class FinancePromoteController extends AdminController
             $pmap['company_id'] = $_REQUEST['company_id'];
             //获取公司名称
             if($pmap['company_id'] == 0){
-                $title .= "万盟天下科技-";
+                $title .= "{$this->COMPANY_NAME}-";
             }else{
                 $gfflg = false;
                 $title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-");
@@ -921,9 +919,10 @@ class FinancePromoteController extends AdminController
                     $t_in = implode(',', array_column($promoter_ids, 'id'));
                 }
                 $map[$field] = ['in',$t_in];
+            }else{
+                $map[$field] = ['in',"-1"];
             }
         }
-        
         //判断是否有推广员
         $level = 1;
         if ($_REQUEST['promote_id'] != '') {
@@ -939,7 +938,6 @@ class FinancePromoteController extends AdminController
                 }
             }
         }
-        // dd($map);
         $_POST['promote_level'] = $level;
     }
     
diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php
index 27bb806c1..bb5d4b408 100644
--- a/Application/Admin/Controller/MemberController.class.php
+++ b/Application/Admin/Controller/MemberController.class.php
@@ -204,16 +204,12 @@ class MemberController extends ThinkController
                 $v['login_time'] = date('Y-m-d H:i:s',$v['login_time']);
                 $v['lock_status'] = get_info_status($v['lock_status'],4);
                 $v['check_status'] = $v['check_status']==1 ? "正常" :"拉黑";
-                if($v['lock_status'] != '锁定') {
-                    $v['lock_remark'] = '';
-                }
-//                dump($v['lock_status']);
                 // $data[$k] = $v;
             }
-//            die();
+            
             $field = array(
                 "id"=>"账号ID","account"=>"玩家账号","promote_account"=>"所属推广员","balance"=>"账户平台币","recharge_total"=>"累计充值","gold_coin"=>"金币",
-                "vip_level"=>"VIP等级","register_type"=>"注册方式","register_time"=>"注册时间","register_ip"=>"注册IP","login_time"=>"最后登录时间",
+                "small_count"=>"小号","vip_level"=>"VIP等级","register_type"=>"注册方式","register_time"=>"注册时间","register_ip"=>"注册IP","login_time"=>"最后登录时间",
                 "device_number"=>"设备号","lock_remark"=>"锁定备注","lock_status"=>"账号状态","check_status"=>"拉黑状态"
             );
             data2csv($data,"玩家_玩家列表",$field);
diff --git a/Application/Admin/Controller/MsgController.class.php b/Application/Admin/Controller/MsgController.class.php
index a23901b59..683bcaef4 100644
--- a/Application/Admin/Controller/MsgController.class.php
+++ b/Application/Admin/Controller/MsgController.class.php
@@ -70,8 +70,15 @@ class MsgController extends ThinkController{
 				}	        
 		      
 				$look= $model->where(['id'=>$ids])->find();
-		
-				redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Apply/and_lists/type/'.$look['sdk_version'].'/game_id/'.$look['game_id']);
+        switch($look['type']) {
+          case 1:
+            redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Apply/and_lists/type/'.$look['sdk_version'].'/game_id/'.$look['game_id']);
+          break;
+          case 3:
+            redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Settlement/sheetDetail/id/'.$look['game_id']);
+          break;
+        }
+				
 
 				
 
diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php
index ef6df8786..bd70095ec 100644
--- a/Application/Admin/Controller/PromoteController.class.php
+++ b/Application/Admin/Controller/PromoteController.class.php
@@ -1367,6 +1367,7 @@ class PromoteController extends ThinkController
                         'company_belong' => $promote_belong['company_belong'],
                         'company_relation' => $promote_belong['company_relation'],
                         'can_view_recharge' => $promote_belong['can_view_recharge'],
+                        'account_type' => $promote_belong['company_type']
                     ];
                     $res = M("promote", "tab_")
                         ->where("chain like '%/{$promote_belong['promote_id']}/%' or id={$promote_belong['promote_id']} ")
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index 34889bb14..b24605372 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -1668,6 +1668,7 @@ class QueryController extends ThinkController
         $this->display();
     }
 
+
     public function getChannelStream() {
 
         $map = [];
diff --git a/Application/Admin/Controller/SettlementController.class.php b/Application/Admin/Controller/SettlementController.class.php
new file mode 100644
index 000000000..0068f55ca
--- /dev/null
+++ b/Application/Admin/Controller/SettlementController.class.php
@@ -0,0 +1,461 @@
+= ".strtotime(I('create_time_start'));
+        }
+        if (I('create_time_end')) {
+            $map['_string'] = "create_time <= ".strtotime(I('create_time_end'));
+        }
+        $login_uid = is_login();
+        $list = M('settlement_sheet', 'tab_')->where($map)->page($p, $row)->order("if (audit_user ={$login_uid}, 0,1 ) and status = 3, all_status desc, create_time desc")->select();
+        $count = M('settlement_sheet', 'tab_')->where($map)->count();
+        if (!empty($list)) {
+            foreach ($list as &$item) {
+                switch ($item['settlement_type']) {
+                    case '1':
+                        $item['settlement_type_name'] = '上游结算单';
+                        break;
+                    case '2':
+                        $item['settlement_type_name'] = '下游-内团结算单';
+                        break;
+                    case '3':
+                        $item['settlement_type_name'] = '下游-外团结算单';
+                        break;
+                    case '4':
+                        $item['settlement_type_name'] = '下游-个人结算单';
+                        break;
+                }
+
+                switch ($item['settlement_time_type']) {
+                    case '1':
+                        $item['settlement_time_type_name'] = '周结';
+                        break;
+                    case '2':
+                        $item['settlement_time_type_name'] = '月结';
+                        break;
+                }
+
+                switch ($item['status']) {
+                    case '1':
+                        $item['status_name'] = '审核通过';
+                        break;
+                    case '2':
+                        $item['status_name'] = '审核未通过';
+                        break;
+                    case '3':
+                        $item['status_name'] = '待审核';
+                        break;
+                }
+                $item['audit_users'] = json_decode($item['audit_users'], true);
+            }
+        }
+        $this->assign('admin_users', M('member')->field('uid, nickname')->select());
+        $page = set_pagination($count, $row);
+        if ($page) {
+            $this->assign('_page', $page);
+        }
+        $this->assign('list_data', $list);
+        $this->display();
+   }
+
+   // 生成结算单 月结算补点 周结不算
+   public function generateSettlementSheet($settlement_type = 0, $settlement_time_type = 0, $time_start=0, $time_end = 0, $delete=0, $id=0, $action='')
+   {
+        $msg = '';
+       $this->assign(I(''));
+       $this->assign('action', $action);
+        if ($delete) {
+            $res = M('settlement_sheet', 'tab_')->where(['id'=>$id])->delete();
+            return $res ? $this->success('删除成功', '', true) : $this->success('删除失败', '', true);
+        }
+        $this->meta_title = '结算单管理';
+        if (empty($settlement_type)) {
+            $msg = '请选择汇总结算单类型';
+        }
+        if (empty($settlement_time_type)) {
+            $msg = '请选择结算方式';
+        }
+        $settlement_time = I('settlement_time', '');
+        if ($settlement_time_type == 1) {
+            $settlement_time = explode(' 至 ', $settlement_time);
+            if (count($settlement_time) != 2) {
+                $msg = '请选择正确的时间区间';
+            } else {
+                $time_start = strtotime($settlement_time[0]);
+                $time_end = strtotime($settlement_time[1]) + 3600 * 24 - 1;
+            }
+            
+        } else {
+            $time_start = strtotime($settlement_time);
+            $time_end = strtotime('+1 month', $time_start) - 1;
+        }
+        if ($time_end > time()) {
+            $msg = "结算结算时间无法大于当前时间";
+        }
+        if (empty($time_start) || empty($time_end)) {
+            $msg = '请选择正确的时间区间';
+        }
+       if (IS_GET) {
+           
+           // 判断结算时间是否冲突
+           $isExsist = M('settlement_sheet', 'tab_')->where(['settlement_type'=>$settlement_type, 'time_start'=>$time_start, 'time_end'=>$time_end, 'settlement_time_type'=>$settlement_time_type])->find();
+            if ($isExsist) {
+                $msg = "已存在此类型结算单";
+            }
+           // 生成结算单数据
+           $generate = false;
+           if (!$msg) {
+                $generate = true;
+               if ($settlement_type == 1) {
+                if ($settlement_time_type == 1) {
+                    $map = " and p.settlement_type = 1";
+                } else {
+                    $map = '';
+                }
+                $result = M('spend', 'tab_')->query("
+                SELECT
+                    sum(s.pay_amount) as amount, g.relation_game_id, g.relation_game_name, p.partner, p.id as p_id, p.channel_rate, p.invoice_rate, g.id as game_id
+                FROM
+                    tab_spend as s
+                INNER JOIN tab_game g on s.game_id = g.id
+                INNER JOIN tab_partner p on p.id = g.partner_id {$map}
+                where s.pay_status = 1 and s.pay_time BETWEEN {$time_start} and {$time_end}
+                GROUP BY relation_game_id, p.id
+                ORDER BY p_id asc");
+                $list = [];
+                foreach ($result as $key => $item) {
+                    if (!isset($list[$item['p_id']])) {
+                        // 奖罚金额
+                        $reward = M('reward_record', 'tab_')
+                        ->field('sum(money) as money, reward_type')
+                        ->where("company_type = 1 and company_id = {$item['p_id']} and reward_time between {$time_start} and {$time_end}")
+                        ->group('reward_type')
+                        ->select();
+                        if (!empty($reward)) {
+                            $reward = array_column($reward, 'money', 'reward_type');
+                        }
+                        $list[$item['p_id']] = [
+                            'company_id'=>$item['p_id'], 
+                            'company_name'=>$item['partner'], 
+                            'bonuses'=>isset($reward[1]) ? $reward[1] : 0, 
+                            'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
+                            'channel_rate' => $item['channel_rate'], // 渠道费
+                            'invoice_rate' => $item['invoice_rate'], // 税费
+                            'time_start' => date('Y-m-d', $time_start),
+                            'time_end' => date('Y-m-d', $time_end)
+                        ];
+                    }
+                    $data = [];
+                    // 获取分成比例
+                    if ($settlement_time_type == 1) {
+                        $data['game_ratio'] = getGameCpRadio($item['game_id'], $item['amount'], false);
+                    } else {
+                        $data['game_ratio'] = getGameCpRadio($item['game_id'], $item['amount'], true);
+                    }
+                    $data['relation_game_id'] = $item['relation_game_id'];
+                    $data['relation_game_name'] = $item['relation_game_name'];
+                    $data['amount'] = $item['amount'];
+                    $data['self_game_ratio'] = 100 - $data['game_ratio'];
+                    $data['parter_settlement'] = $item['amount'] * $data['game_ratio']/100 - ($item['amount']*$item['channel_rate'] ) + $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
+                    $list[$item['p_id']]['channels'][] = array_merge($data, [
+                        'company_id'=>$item['p_id'], 
+                    'company_name'=>$item['partner'], 
+                    'bonuses'=>$list[$item['p_id']]['bonuses'], 
+                    'fine'=>$list[$item['p_id']]['fine'], 
+                    'channel_rate' => $item['channel_rate'],
+                    'invoice_rate' => $item['invoice_rate']]);
+                }
+               } else if (\in_array($settlement_type, [2, 3])) {
+                    $map = "p.account_type = 1 and p.`level` = 1 and p.company_belong " . ($settlement_type == 2 ? " = 0 " : " in (1, 2) ") ;
+                    if ($settlement_time_type == 1) {
+                        $map .= " and p.settlement_type = {$settlement_time_type} ";
+                    }
+                    $result = M()->query("
+                    SELECT
+                        p.id, p.account, pc.company_name, pc.id as p_id, pc.fax_ratio, pc.settlement_contact
+                    FROM
+                        tab_promote p 
+                    INNER JOIN tab_promote_company pc on p.company_id = pc.id
+                    where {$map}
+                    order by pc.id asc
+                    ");
+                    $list = [];
+                    foreach ($result as $key => $item) {
+                        $res = M()->query("
+                            select
+                            g.relation_game_name, g.relation_game_id, sum(s.pay_amount) as amount
+                            from
+                            tab_spend s
+                            inner join tab_promote p on p.chain like '/{$item['id']}/%' and s.promote_id = p.id
+                            inner join tab_game g on s.game_id = g.id
+                            where s.pay_status = 1 and s.pay_time BETWEEN {$time_start} and {$time_end}
+                            group by g.relation_game_id
+                        ");
+
+                        if ($res) {
+                            if (!isset($list[$item['p_id']])) {
+                                // 奖罚金额
+                                $reward = M('reward_record', 'tab_')
+                                ->field('sum(money) as money, reward_type')
+                                ->where("company_type = 2 and company_id = {$item['p_id']} and reward_time between {$time_start} and {$time_end}")
+                                ->group('reward_type')
+                                ->select();
+                                if (!empty($reward)) {
+                                    $reward = array_column($reward, 'money', 'reward_type');
+                                }
+                                $list[$item['p_id']] = [
+                                    'company_id'=>$item['p_id'], 
+                                    'company_name'=>$item['company_name'], 
+                                    'fax_ratio' => $item['fax_ratio'], 
+                                    'bonuses'=>isset($reward[1]) ? $reward[1] : 0, 
+                                    'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
+                                    'settlement_contact' => $item['settlement_contact'],
+                                    'create_time' => time(),
+                                    'time_start' => date('Y-m-d', $time_start),
+                                    'time_end' => date('Y-m-d', $time_end)
+                                ];
+                                $list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
+                            }
+                            foreach ($res as $k => $val) {
+                                $gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true);
+                                if ($settlement_time_type == 2) {
+                                    $gameRatioMax = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, false);
+                                } else {
+                                    $gameRatioMax = $gameRatio;
+                                }
+                                $price = $val['amount']*$gameRatioMax/100 - $val['amount']*$item['fax_ratio']/100;
+                                $list[$item['p_id']]['channels'][] = [
+                                    'promote_id' => $item['id'],
+                                    'account'=>$item['account'], 
+                                    'relation_game_name'=>$val['relation_game_name'], 
+                                    'relation_game_id'=>$val['relation_game_id'], 
+                                    'game_ratio'=>$gameRatio, 
+                                    'game_ratio_max'=>$gameRatioMax-$gameRatio, 
+                                    'price'=> $price,
+                                    'amount' => $val['amount']
+                                ];
+                                $list[$item['p_id']]['total_amount'] += $price;
+                            }
+                        }
+                    }
+               } else if ($settlement_type == 4) {
+                    $map = "p.account_type = 2 and p.`level` = 1 " ;
+                    if ($settlement_time_type == 1) {
+                        $map .= " and p.settlement_type = {$settlement_time_type} ";
+                    }
+                    $result = M()->query("
+                    SELECT
+                        p.id, p.account, pc.company_name, pc.id as p_id, company_relation, p.admin_id, pc.bank_card, pc.bank_cardname, pc.bank_name, pc.bank_address
+                    FROM
+                        tab_promote p 
+                    INNER JOIN tab_promote_company pc on p.company_id = pc.id
+                    where {$map}
+                    order by pc.id asc
+                    ");
+                    $list = [];
+                    foreach ($result as $key => $item) {
+                        $res = M()->query("
+                            select
+                            g.relation_game_name, g.relation_game_id, sum(s.pay_amount) as amount
+                            from
+                            tab_spend s
+                            inner join tab_promote p on p.chain like '/{$item['id']}/%' and s.promote_id = p.id
+                            inner join tab_game g on s.game_id = g.id
+                            where s.pay_status = 1 and s.pay_time BETWEEN {$time_start} and {$time_end}
+                            group by g.relation_game_id
+                        ");
+
+                        if ($res) {
+                            if (!isset($list[$item['p_id']])) {
+                                // 奖罚金额
+                                $reward = M('reward_record', 'tab_')
+                                ->field('sum(money) as money, reward_type')
+                                ->where("company_type = 2 and company_id = {$item['p_id']} and reward_time between {$time_start} and {$time_end}")
+                                ->group('reward_type')
+                                ->select();
+                                if (!empty($reward)) {
+                                    $reward = array_column($reward, 'money', 'reward_type');
+                                }
+                                $list[$item['p_id']] = [
+                                    'company_id'=>$item['p_id'], 
+                                    'company_name'=>$item['company_name'], 
+                                    'bonuses'=>isset($reward[1]) ? $reward[1] : 0, 
+                                    'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
+                                    'settlement_contact' => $item['settlement_contact'],
+                                    'bank_card' => $item['bank_card'],
+                                    'bank_address' => $item['bank_address'],
+                                    'create_time' => time(),
+                                    'time_start' => date('Y-m-d', $time_start),
+                                    'time_end' => date('Y-m-d', $time_end)
+                                ];
+                                $list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
+                            }
+                            foreach ($res as $k => $val) {
+                                $gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true);
+                                if ($settlement_time_type == 2) {
+                                    $gameRatioMax = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, false);
+                                } else {
+                                    $gameRatioMax = $gameRatio;
+                                }
+                            
+                                $price = $val['amount']*$gameRatioMax/100;
+                                $list[$item['p_id']]['channels'][] = [
+                                    'promote_id' => $item['id'],
+                                    'account'=>$item['account'], 
+                                    'relation_game_name'=>$val['relation_game_name'], 
+                                    'relation_game_id'=>$val['relation_game_id'], 
+                                    'game_ratio'=>$gameRatio, 
+                                    'game_ratio_max'=>$gameRatioMax-$gameRatio, 
+                                    'price'=> $price,
+                                    'amount' => $val['amount'],
+                                    'type_name' => '个人',
+                                    'company_relation_name' => $item['company_relation'] == 0 ? "自主开发及维护" : ($item['company_relation'] == 1 ? "只维护" : "无"),
+                                    'admin_name' => get_admin_nickname($item['admin_id']) ?: '无'
+                                ];
+                                $list[$item['p_id']]['total_amount'] += $price;
+                            }
+                        }
+                    }
+               } else {
+                $generate = false;
+                   $msg = "请选择正确的结算单类型";
+               }
+           }
+           $this->assign("generate", $generate);
+           $this->assign('admin_users', M('member')->where(['status'=>1])->field('uid, nickname')->select());
+           $this->assign('listData', array_values($list));
+           $this->assign('msg', $msg);
+           $this->assign('settlement_type', $settlement_type);
+           $this->meta_title = '结算单管理';
+           $this->display();
+       } else {
+            // 判断结算时间是否冲突
+            if ($msg) {
+                return $this->error($msg, true, true);
+            }
+            if ($id) {
+                $info = M('settlement_sheet', 'tab_')->where(['id'=>$id])->find();
+                if (!$info) {
+                    return $this->error('未找到该记录');
+                }
+
+            } else {
+                if (\sizeof($_POST['settlement_sheet']) == 0) {
+                    return $this->error('无法生成无记录的结算单', true, true);
+                }
+                $isExsist = M('settlement_sheet', 'tab_')->where(['settlement_type'=>$settlement_type, 'time_start'=>$time_start, 'time_end'=>$time_end, 'settlement_time_type'=>$settlement_time_type])->find();
+                if ($isExsist) {
+                    return $this->error('已存在此类型结算单', true, true);
+                }
+                $data['creater_id'] = is_login();
+                $data['create_time'] = time();
+                $data['orderid'] = $settlement_type.$settlement_time_type.date('YmdHis').$data['creater_id'].rand(1000, 9999);
+                $data['settlement_type'] = $settlement_type;
+                $data['settlement_time_type'] = $settlement_time_type;
+                $data['time_start'] = $time_start;
+                $data['time_end'] = $time_end;
+                $data['audit_users'] = json_encode($_POST['audit_users']);
+                $data['settlement_sheet'] = json_encode($_POST['settlement_sheet']);
+                $data['audit_user'] = $_POST['audit_users'][0];
+                $res = M('settlement_sheet', 'tab_')->add($data);
+                // 生成消息
+                $notice['user_id'] = $_POST['audit_users'][0];
+                $notice['content'] = "结算单汇总审核:有一个结算单待你审核,请尽快处理!";
+                $notice['type'] = 3;
+                $notice['status'] = 2;
+                $notice['create_time'] = time();
+                $notice['game_id'] = $res;
+                M('msg', 'tab_')->add($notice);
+                return $res ? $this->success('生成成功', true, true) : $this->error('生成失败', true, true);
+            }
+       }
+   }
+
+   public function sheetDetail($id=0)
+   {
+        $info = M('settlement_sheet', 'tab_')->where(['id'=>$id])->find();
+        if (!$info) {
+            return $this->error('未找到该记录');
+        }
+        $info['listData'] = json_decode($info['settlement_sheet'], true);
+        $info['audit_users'] = json_decode($info['audit_users']);
+        $login_uid = is_login();
+        $arr_index = array_search($login_uid, $info['audit_users']);
+        $audit_auth = true;
+        if ($arr_index === false) {
+            $audit_auth = false;
+        } else if ($arr_index + 1 != $info['step']) {
+            $audit_auth = false;
+        } else if ($arr_index + 1 == sizeof($info['audit_users']) && $info['status'] != 3) {
+            $audit_auth = false;
+        } else if ($info['status'] != 3) {
+            $audit_auth = false;
+        }
+        $this->assign(['audit_auth'=>$audit_auth]);
+        $this->assign($info);
+        $this->meta_title = '结算单管理';
+        $this->display();
+   }
+
+   public function auditSheet($id=0, $audit_type = 2, $remark = '' )
+   {
+    $info = M('settlement_sheet', 'tab_')->where(['id'=>$id])->find();
+    if (!$info) {
+        return $this->error('未找到该记录', true, true);
+    }
+    $info['audit_users'] = json_decode($info['audit_users']);
+    $login_uid = is_login();
+    $arr_index = array_search($login_uid, $info['audit_users']);
+    if ($arr_index === false) {
+        return $this->error('无权审核改结算单', true, true);
+    } else if ($arr_index + 1 != $info['step']) {
+        return $this->error('您已审核过此结算单', true, true);
+    } else if ($arr_index + 1 == sizeof($info['audit_users']) && $info['status'] != 3) {
+        return $this->error('该结算单已经审核完毕', true, true);
+    }
+    $is_last = ($info['setp'] + 1 >= sizeof($info['audit_users']));
+    $update['remark'] = $remark;
+    $update['status'] = $audit_type == 1 ?  ($is_last ? 1 : 3) : 2;
+    $update['step'] = ($audit_type == 1 && !$is_last) ? $info['step'] + 1 : $info['step'];
+    $update['audit_user'] = $login_uid;
+    if ($audit_type == 1 && $is_last) {
+        $update['all_status'] = 1;
+    } else if ($audit_type == 2) {
+        $update['all_status'] = 2;
+    }
+    // 通知审核
+    if ($update['status'] == 3 && !$is_last) {
+        $notice['user_id'] = $info['audit_users'][$info['step']];
+        $notice['content'] = "结算单汇总审核:有一个结算单待你审核,请尽快处理!";
+        $notice['type'] = 3;
+        $notice['status'] = 2;
+        $notice['create_time'] = time();
+        $notice['game_id'] = $id;
+        M('msg', 'tab_')->add($notice);
+    }
+    $upt = M('settlement_sheet', 'tab_')->where(['id'=>$id])->save($update);
+    return $upt ? $this->success('审核成功', true, true) : $this->error('审核失败', true, true);
+   }
+}
\ No newline at end of file
diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php
index da2b49e9e..12b37a10a 100644
--- a/Application/Admin/Controller/StatController.class.php
+++ b/Application/Admin/Controller/StatController.class.php
@@ -717,12 +717,13 @@ AND UNIX_TIMESTAMP(
                     $map['tab_user.promote_id']=$map_list['promote_id'];
                 }
                 unset($map['promote_id']);
-                $map["FROM_UNIXTIME(register_time,'%Y-%m-%d')"] = $time;
+                //$map["FROM_UNIXTIME(,'%Y-%m-%d')"] = $time;
+                $map["register_time"] = ['between', [strtotime($time), strtotime($time)+86399]];
 
                 $login_time = strtotime("+1 day",strtotime($time));
                 $login_time_end = $login_time+86399;
-                $num = M('user','tab_')
-                ->field('count(DISTINCT tab_user.id) as num')
+                $num_sql = M('user','tab_')
+                ->field('tab_user.id')
                 ->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id
                     and ur.login_time between $login_time and $login_time_end")
                     ->where($map)
@@ -1279,9 +1280,11 @@ AND UNIX_TIMESTAMP(
 							$mapl['tab_user.promote_id']=$mapl['promote_id'];
             unset($mapl['promote_id']);
             $login_time = date('Y-m-d', strtotime("+1 day",strtotime($time)));
+            $login_start = strtotime($login_time);
+            $login_end = $login_start + 86399;
             $num = $user
                 ->field('count(DISTINCT tab_user.id) as num')
-                ->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id and FROM_UNIXTIME(ur.login_time,'%Y-%m-%d') = '{$login_time}'")
+                ->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id and ur.login_time between {$login_start} and {$login_end}")
                 ->where($mapl)
                 ->find();
             if (!empty($data[$key]['register_num'])) {
diff --git a/Application/Admin/Controller/StatementController.class.php b/Application/Admin/Controller/StatementController.class.php
index d369fd60b..e2a28bf2f 100644
--- a/Application/Admin/Controller/StatementController.class.php
+++ b/Application/Admin/Controller/StatementController.class.php
@@ -328,7 +328,6 @@ class StatementController extends ThinkController
         }else{
             $this->ajaxReturn(array("error"=>"database error","code"=>2000));
         }
-       
-
    }
+
 }
diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt
new file mode 100644
index 000000000..06372c756
--- /dev/null
+++ b/Application/Admin/Controller/access_data_foldline.txt
@@ -0,0 +1 @@
+{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":0,"active":2,"player":0,"money":0},"active":[{"time":"0:00","count":1},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":1},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]}
\ No newline at end of file
diff --git a/Application/Admin/Model/UserModel.class.php b/Application/Admin/Model/UserModel.class.php
index 810e32c31..c3269cab4 100644
--- a/Application/Admin/Model/UserModel.class.php
+++ b/Application/Admin/Model/UserModel.class.php
@@ -1960,36 +1960,46 @@ class UserModel extends Model{
 	 */
 	public function activeRankOnPromote($timestr,$fieldname='count',$promoteid='',$row=0,$ordermark='desc') {
 
-		$map['tab_user.promote_id']=array('gt',0);
+		$map['promote_id']=array('gt',0);
 
-		if ($promoteid[0]) {$map['tab_user.promote_id']=array('in',$promoteid);}
+		if ($promoteid[0]) {$map['promote_id']=array('in',$promoteid);}
 
-		$sql = $this->field('tab_user.promote_id,tab_promote.account as promote_account,tab_user.id')
-					->join('tab_promote on (tab_promote.id = tab_user.promote_id) ')
+		$sql = $this->field('promote_id,tab_user.id')
 					->where(['register_time'.$timestr,$map])
 					->select(false);
 
-		$mid = $this->field('tab_user.promote_id,tab_promote.account as promote_account,tab_user.id')
-					->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
-					->join('tab_promote on(tab_user.promote_id = tab_promote.id)')
-					->union($sql)
-					->group('tab_user.promote_id,tab_user.id')
-					->where(['uu.login_time '.$timestr,$map])
-					->select(false);
-
-		$last = $this->table('('.$mid.') as a')->field('a.promote_id,a.promote_account,GROUP_CONCAT(a.id),count(a.id) as '.$fieldname)
-					->group('a.promote_id')->select(false);
-
+		// $mid = $this->field('tab_user.promote_id,tab_promote.account as promote_account,tab_user.id')
+		// 			->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
+		// 			->join('tab_promote on(tab_user.promote_id = tab_promote.id)')
+		// 			->union($sql)
+		// 			->group('tab_user.promote_id,tab_user.id')
+		// 			->where(['uu.login_time '.$timestr,$map])
+        //             ->select(false);
+                    
+        $mid = M('user_login_record', 'tab_')->alias("uu")->field('uu.promote_id, uu.user_id as id')
+                    ->union($sql)
+                    ->group('uu.promote_id, uu.user_id')
+                    ->where(['uu.login_time '.$timestr,$map])
+                    ->select(false);
+
+        $last = $this->table('('.$mid.') as a')->field('a.promote_id,GROUP_CONCAT(a.id),count(a.id) as '.$fieldname)
+        ->group('a.promote_id')->select(false);
 		if($row>0) {
 
-			$data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->select();
-
+			$data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
 
 		}	else {
 
-			$data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->select();
+			$data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
 
-		}
+        }
+        if (!empty($data)) {
+            $promoters = M('promote', 'tab_')->field('id, account')->where(['id'=>['in', array_column($data, 'promote_id')]])->select();
+            $promoter_names = array_column($promoters, 'account', 'id');
+            foreach ($data as &$item) {
+                $item['promote_account'] = isset($promoter_names[$item['promote_id']]) ? $promoter_names[$item['promote_id']] : '';
+            } 
+        }
 
 		return $data;
 	}
@@ -2013,27 +2023,33 @@ class UserModel extends Model{
 					->where(['register_time'.$timestr,$map2])
 					->select(false);
 
-		$mid = $this->field('uu.game_id,game_name,tab_user.id')
-					->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
-					->union($sql)
-					->group('uu.game_id,tab_user.id')
-					->where(['uu.login_time '.$timestr,$map])
-					->select(false);
+		// $mid = $this->field('uu.game_id,game_name,tab_user.id')
+		// 			->join('tab_user_login_record as uu on tab_user.id = uu.user_id')
+		// 			->union($sql)
+		// 			->group('uu.game_id,tab_user.id')
+		// 			->where(['uu.login_time '.$timestr,$map])
+        // 			->select(false);
+        
+        $mid = M('user_login_record', 'tab_')->alias("uu")->field('game_id,game_name,user_id as id')
+        ->union($sql)
+        ->group('uu.game_id, uu.user_id')
+        ->where(['uu.login_time '.$timestr,$map])
+        ->select(false);
 
 		$last = $this->table('('.$mid.') as a')->field('a.game_id,a.game_name,GROUP_CONCAT(a.id),count(a.id) as '.$fieldname)
 					->group('a.game_id')->select(false);
 
 		if($row>0) {
 
-			$data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->select();
+			$data = $this->table('('.$last.') as b')->limit($row)->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
 
 
 		}	else {
 
-			$data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->select();
-
-		}
+			$data = $this->table('('.$last.') as b')->order('b.'.$fieldname.' '.$ordermark)->limit(10)->select();
 
+        }
+        
 		return $data;
 
 	}
diff --git a/Application/Admin/View/Deposit/lists.html b/Application/Admin/View/Deposit/lists.html
index dc9b281a0..cbd9b3c9f 100644
--- a/Application/Admin/View/Deposit/lists.html
+++ b/Application/Admin/View/Deposit/lists.html
@@ -28,6 +28,10 @@
     
 
     
@@ -160,7 +164,7 @@
                                 
                             
                             {$data.pay_amount}
-                            {:get_pay_way($data['pay_way'])}
+                            {:get_pay_way($data['pay_way'])}
                             {$data.pay_ip}
                             {:set_show_time($data['create_time'],'','pay')}
                             
@@ -170,7 +174,7 @@
                                     {:get_info_status($data['pay_status'],9)}
                                 
                             
-                            
+
                             
                                 
diff --git a/Application/Admin/View/Deposit/lists_secord.html b/Application/Admin/View/Deposit/lists_secord.html new file mode 100644 index 000000000..a57da2ead --- /dev/null +++ b/Application/Admin/View/Deposit/lists_secord.html @@ -0,0 +1,430 @@ + + + + + + + + + + + +
+ +
+
+ +
+ +
+ +
+
+ + - +
+ + +
+
+ +
+ +
+
+ +
+ +
+ + - +
+
+ +
+ + +
+ 搜索 +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
订单号所属推广员 + + 充值平台币 + + 充值方式 + + 充值时间 + + 订单状态
aOh! 暂时还没有内容!
{:$data['pay_order_number']} + + 官方渠道 + + + {$data.promote_account} + + {$data.promote_account|encryptStr} + + + + {$data.pay_amount}{:get_pay_way($data['pay_way'])}{:set_show_time($data['create_time'],'','pay')} + + {:get_info_status($data['pay_status'],9)} + + {:get_info_status($data['pay_status'],9)} + +
汇总 + 当页充值:{:array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount'))}; + 今日充值:{$ttotal} ; + 昨日充值:{$ytotal} ; + 累计充值:{$total}元(此处只汇总充值成功的订单) +
+
+
+
+ 导出 + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html index ab804df9f..25a873721 100644 --- a/Application/Admin/View/FinancePromote/gameStatistics.html +++ b/Application/Admin/View/FinancePromote/gameStatistics.html @@ -95,6 +95,23 @@ +
+ +
+
+ +
+
- + + - +
@@ -150,6 +167,8 @@ + 推广公司 + 会长账号 合作公司 游戏 @@ -172,39 +191,41 @@ .data-table tbody td{border-right:1px solid #DDDDDD;} .d_list .drop-down ul {z-index:999;} - - - aOh! 暂时还没有内容! - - - - + + + aOh! 暂时还没有内容! + + + + + + {$data.company_name} + {$data.account} + {$data.partner_name} + {$data.game_name} + {$data.cash_count} + {$data.balance_coin_count} + + {$data.inside_cash_count} + + {$data.all_cash_count} + + 订单查看 + + + - {$data.partner_name} - {$data.game_name} - {$data.cash_count} - {$data.balance_coin_count} - - {$data.inside_cash_count} - - {$data.all_cash_count} - - 订单查看 + 总计 + {$sumCash}0 + {$sumBalance}0 + {$sumInside}0 + {$sumAll}0 + + 订单查看 - - - 总计 - {$sumCash}0 - {$sumBalance}0 - {$sumInside}0 - {$sumAll}0 - - 订单查看 - - - - + +
@@ -250,7 +271,7 @@ }); - $('.page a:eq(1)').click(function () { + $('.page a').click(function () { var href = $(this).attr('href'); $(this).removeAttr('href'); window.location.replace(href) @@ -348,6 +369,35 @@ } }) } + var promote_id = "{:I('promote_id')}"; + var company_id = "{:I('company_id')}"; + function getPromotersByCompanyid() { + var company_id = $("#company_id option:selected").val(); + if(!company_id){ + company_id = -1; + } + $.ajax({ + url: "{:U('Ajax/getPromotersByCompanyid')}", + type: "get", + data: { company_id:company_id}, + dataType: 'json', + success: function (response) { + str = ''; + data = response.data; + for (var i in data) { + str += "" + } + $("#promote_id").empty(); + $("#promote_id").append(str); + $("#promote_id").select2(); + } + }) + } + getPromotersByCompanyid(); + + $("#company_id").change(function(){ + getPromotersByCompanyid(); + }) // $("#game_name, #game_type").change(function(){ // get_partnet_list(); // }); diff --git a/Application/Admin/View/FinancePromote/gameStatisticsDetail.html b/Application/Admin/View/FinancePromote/gameStatisticsDetail.html index e93266324..59acf1702 100644 --- a/Application/Admin/View/FinancePromote/gameStatisticsDetail.html +++ b/Application/Admin/View/FinancePromote/gameStatisticsDetail.html @@ -244,7 +244,7 @@ highlight_subnav('{:U("FinancePromote/index")}'); $(function(){ - $('.page a:eq(1)').click(function () { + $('.page a').click(function () { var href = $(this).attr('href'); $(this).removeAttr('href'); window.location.replace(href) diff --git a/Application/Admin/View/FinancePromote/promoteUser.html b/Application/Admin/View/FinancePromote/promoteUser.html index 0ed92f16e..3619e61fd 100644 --- a/Application/Admin/View/FinancePromote/promoteUser.html +++ b/Application/Admin/View/FinancePromote/promoteUser.html @@ -307,7 +307,7 @@ window.location.replace(url); // window.location.href = url; }); - $('.page a:eq(1)').click(function () { + $('.page a').click(function () { var href = $(this).attr('href'); $(this).removeAttr('href'); window.location.replace(href) diff --git a/Application/Admin/View/Msg/lists.html b/Application/Admin/View/Msg/lists.html index 2e53f1a6a..26dc75f3f 100644 --- a/Application/Admin/View/Msg/lists.html +++ b/Application/Admin/View/Msg/lists.html @@ -58,7 +58,7 @@ {$data.id} - + {$data.content} diff --git a/Application/Admin/View/Promote/belong_edit.html b/Application/Admin/View/Promote/belong_edit.html index ee3b035c9..ae167dec6 100644 --- a/Application/Admin/View/Promote/belong_edit.html +++ b/Application/Admin/View/Promote/belong_edit.html @@ -50,7 +50,7 @@ 会长账号: - diff --git a/Application/Admin/View/Settlement/generatesettlementsheet.html b/Application/Admin/View/Settlement/generatesettlementsheet.html new file mode 100644 index 000000000..e4bdedc73 --- /dev/null +++ b/Application/Admin/View/Settlement/generatesettlementsheet.html @@ -0,0 +1,559 @@ + + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+ > + + + + + + +
+ +
+ +
+ +
+ style="width: 180px;" readonly="readonly"> +
+ + +
+ 生成 +
+ +
+
+
+ + +
+
+ + + + + + + +
{$msg}
+
+
+ + 上游-汇总结算单 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + $item): ?> + $channel): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
平台时间游戏名称平台流水分成比例我方比例渠道费率税费费率合作方结算分成违规罚款奖励备注
aOh! 暂时还没有可结算内容!
{$item.company_name}123{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['self_game_ratio']}%{$item['channel_rate']*100}%{$item['invoice_rate']*100}%{$channel['parter_settlement']}{$item['fine']}{$item['bonuses']}
123{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['self_game_ratio']}%{$channel['parter_settlement']}
+
+
+ + + 下游-汇总结算单 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + $item): ?> + $channel): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
排序平台会长账号游戏名称平台总额(元)分成比例补点比例税费费率分成金额(元)罚款奖励合计(元)对账人时间备注
aOh! 暂时还没有可结算内容!
{$index+1}{$item.company_name}{$channel['account']}{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$item['fax_ratio']*100}%{$channel['price']}{$item['fine']}{$item['bonuses']}{$item['total_amount']}{$item['settlement_contact']}{$item['time_start']} 至 {$item['time_end']}备注
{$channel['account']}{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$channel['price']}{$item['time_start']} 至 {$item['time_end']}
+
+
+ + 下游-个人汇总结算单 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $item): ?> + $channel): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
排序公司名称会长账号市场员下游类型下游性质游戏名称结算时间推广流水分成比例补点比例分成金额奖励罚款结算金额开户名银行卡号开户网点
aOh! 暂时还没有可结算内容!
{$index+1}{$item.company_name}{$channel['account']}{$channel['admin_name']}{$channel['company_relation_name']}{$channel['type_name']}{$channel['relation_game_name']}{$item['time_start']} 至 {$item['time_end']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$channel['price']}{$item['bonuses']}{$item['fine']}{$item['total_amount']}{$item['settlement_contact']}{$item['bank_card']}{$item['bank_address']}
{$channel['account']}{$channel['admin_name']}{$channel['company_relation_name']}{$channel['type_name']}{$channel['relation_game_name']}{$item['time_start']} 至 {$item['time_end']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$channel['price']}
+
+
+ +
+ + 请选择审核人: +
+ + + + + + +
+
+ + +
+ + + + + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + + + + + + + diff --git a/Application/Admin/View/Settlement/sheetDetail.html b/Application/Admin/View/Settlement/sheetDetail.html new file mode 100644 index 000000000..350254730 --- /dev/null +++ b/Application/Admin/View/Settlement/sheetDetail.html @@ -0,0 +1,406 @@ + + + + + + + + + + + + + +
+ 返回 + + {$msg} + +
+ 上游-汇总结算单 +
+ + + + + + + + + + + + + + + + + + + + + + + + + $item): ?> + $channel): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
平台时间游戏名称平台流水分成比例我方比例渠道费率税费费率合作方结算分成违规罚款奖励备注
aOh! 暂时还没有可结算内容!
{$item.company_name}123{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['self_game_ratio']}%{$item['channel_rate']*100}%{$item['invoice_rate']*100}%{$channel['parter_settlement']}{$item['fine']}{$item['bonuses']}{$item['remark']}
123{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['self_game_ratio']}%{$channel['parter_settlement']}
+
+
+ + + 下游-汇总结算单 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + $item): ?> + $channel): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
排序平台会长账号游戏名称平台总额(元)分成比例补点比例税费费率分成金额(元)罚款奖励合计(元)对账人时间备注
aOh! 暂时还没有可结算内容!
{$index+1}{$item.company_name}{$channel['account']}{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$item['fax_ratio']*100}%{$channel['price']}{$item['fine']}{$item['bonuses']}{$item['total_amount']}{$item['settlement_contact']}{$item['time_start']} 至 {$item['time_end']}备注
{$channel['account']}{$channel['relation_game_name']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$channel['price']}{$item['time_start']} 至 {$item['time_end']}
+
+
+ + 下游-个人汇总结算单 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $item): ?> + $channel): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
排序公司名称会长账号市场员下游类型下游性质游戏名称结算时间推广流水分成比例补点比例分成金额奖励罚款结算金额开户名银行卡号开户网点
aOh! 暂时还没有可结算内容!
{$index+1}{$item.company_name}{$channel['account']}{$channel['admin_name']}{$channel['company_relation_name']}{$channel['type_name']}{$channel['relation_game_name']}{$channel['time_start']} 至 {$channel['time_end']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$channel['price']}{$item['bonuses']}{$item['fine']}{$item['total_amount']}{$item['settlement_contact']}{$item['bank_card']}{$item['bank_address']}
{$channel['account']}{$channel['admin_name']}{$channel['company_relation_name']}{$channel['type_name']}{$channel['relation_game_name']}{$item['time_start']} 至 {$item['time_end']}{$channel['amount']}{$channel['game_ratio']}%{$channel['game_ratio_max']}%{$channel['price']}
+
+
+ +
+ + 请选择审核人: +
+ + + + + + +
+ +
+

审核人:

+
+ $user_id):?> + + {:get_admin_nickname($user_id)} + ( + + 通过 + + + + 待审核 + + ) + + + +
+
+ + + + + + +
+ +
+ + +
+ +
+ + + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + + + + + + + diff --git a/Application/Admin/View/Settlement/sheetList.html b/Application/Admin/View/Settlement/sheetList.html new file mode 100644 index 000000000..eb01d699a --- /dev/null +++ b/Application/Admin/View/Settlement/sheetList.html @@ -0,0 +1,262 @@ + + + + + + + + + + + + +
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + - +
+ + +
+
+
+ +
+ +
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
结算单单号结算单类型时间结算方式申请时间申请人审核状态当前审核人备注操作
aOh! 暂时还没有内容!
{$data.orderid}{$data.settlement_type_name}{:date('Y-m-d', $data['time_start'])} - {:date('Y-m-d', $data['time_end'])}{$data.settlement_time_type_name}{$data.create_time|date='Y-m-d H:i:s',###}{:get_admin_nickname($data['creater_id'])}{$data.status_name}{:get_admin_nickname($data['audit_users'][$data['step']-1])}{$data.remark} + 查看 + 删除 +
+
+
+
+ {$_page|default=''} +
+ + + +
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + + + + + diff --git a/Application/Admin/View/Tool/payset.html b/Application/Admin/View/Tool/payset.html index 52a7ee57a..803572aa8 100644 --- a/Application/Admin/View/Tool/payset.html +++ b/Application/Admin/View/Tool/payset.html @@ -155,6 +155,34 @@ + + + + + 公钥 + + + + + + + + + + + + + + 私钥 + + + + + + + + + diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php index 4a4c42744..b3cc2d263 100644 --- a/Application/Home/Controller/SafeController.class.php +++ b/Application/Home/Controller/SafeController.class.php @@ -167,7 +167,6 @@ class SafeController extends BaseController{ $modelList = ['基础信息', $metaTitle]; $this->verifyPasswordView($modelList); $ver_status = M('promote','tab_')->where(['id'=>$id])->getField('ver_status',true); - if($ver_status[0] == 1) { //return $this->display('editModify'); $this->redirect('editModify'); diff --git a/Data/update.sql b/Data/update.sql index ad38ea81a..946eff4df 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -974,6 +974,31 @@ CREATE TABLE `tab_statement` ( KEY `link_phone` (`link_phone`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='cp/公会对账单'; +-- 2020-01-02 +-- 提现结算类型 cxj +ALTER TABLE `tab_withdraw` +ADD COLUMN `settlement_type` tinyint(3) NOT NULL DEFAULT 3 COMMENT '结算类型:1-周结 2-月结 3-管理员提现 4-推广员提现 5-其他'; + +-- 2020 01-03 cxj +ALTER TABLE `sys_file` +MODIFY COLUMN `mime` char(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '文件mime类型'; + +ALTER TABLE `tab_spend` +MODIFY COLUMN `selle_status` int(11) NOT NULL DEFAULT 0 COMMENT '渠道结算 0未结算1 结算', +MODIFY COLUMN `selle_ratio` double(5, 2) DEFAULT 0.00 COMMENT '渠道分成比例'; + +-- 2020 01-06 cxj +ALTER TABLE `tab_promote_game_ratio` +ADD COLUMN `turnover_ratio` varchar(2000) NOT NULL COMMENT '流水分成比例' AFTER `last_ratio_status`; +ALTER TABLE `tab_promote_game_ratio` +ADD COLUMN `last_turnover_ratio` varchar(2000) NOT NULL COMMENT '上次流水分成比例' AFTER `turnover_ratio`; + +-- 2020 01-07 cxj +ALTER TABLE `tab_withdraw` +ADD COLUMN `game_ratio` varchar(5000) NOT NULL COMMENT '游戏提现实际分成比例'; + +ALTER TABLE `tab_withdraw` +MODIFY COLUMN `settlement_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '结算类型:1-周结 2-月结 9-其他'; -- 新增CP游戏分成比例表 2020-01-09 郑昌隆 @@ -1188,6 +1213,11 @@ MODIFY COLUMN `company_belong` tinyint(1) UNSIGNED NOT NULL DEFAULT 3 COMMENT ' MODIFY COLUMN `company_relation` tinyint(1) UNSIGNED NOT NULL DEFAULT 2 COMMENT '工会关系:0-自主开发及维护;1-只维护 2 无' AFTER `company_belong`; ADD COLUMN `company_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '工会类型 1公司 2个人' AFTER `can_view_recharge`; +-- 2020-02-10 yulingwei 推广工会管理 新增属性类型 +ALTER TABLE `tab_promote` +MODIFY COLUMN `company_belong` tinyint(1) NOT NULL DEFAULT 0 COMMENT '工会归属:0-内团;1-外团 2-分发联盟 3 无' AFTER `company_id`, +MODIFY COLUMN `company_relation` tinyint(1) NOT NULL DEFAULT 0 COMMENT '工会关系:0-自主开发及维护;1-只维护 2 无' AFTER `company_belong`; + -- 2020-02-10 cxj 推广提现--新增审核模式 ALTER TABLE `tab_withdraw` ADD COLUMN `review_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '审核模式:1-人工审核 2-自动审核'; @@ -1255,3 +1285,38 @@ CREATE TABLE `tab_test_order` ( `add_time` int(11) DEFAULT '0' COMMENT '添加时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +-- 2020-02-10 yulingwei 预付款预警 +CREATE TABLE `tab_partner_divide_warn` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '公司预警表', + `partner_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '公司ID', + `advance_amount` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '预付款', + `warming_amount` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '预警金额', + `phones` json DEFAULT NULL, + `warn_frequency` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '预警金额频率', + `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态 1正常 2删除', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `upt_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', + `operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +-- 2020-02-17 yulingwei 汇总结算单管理 +CREATE TABLE `tab_settlement_sheet` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `orderid` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '0' COMMENT '订单ID (时间戳+adminid+4为随机数字)', + `settlement_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '结算类型 1 上游结算单 2 下游-内团结算单 3下游-外团结算单 4 下游-个人结算单', + `time_start` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '结算开始时间', + `time_end` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '结算结束时间', + `settlement_time_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '结算周期 1周结 2月结', + `settlement_sheet` json NOT NULL COMMENT '结算单', + `audit_users` json NOT NULL COMMENT '审核人员', + `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注', + `audit_user` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前审核人', + `step` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '审核进度 1,2,3', + `status` tinyint(1) unsigned NOT NULL DEFAULT '3' COMMENT '订单审核状态 1审核通过 2审核未通过 3待审核通过', + `all_status` tinyint(1) unsigned NOT NULL DEFAULT '3' COMMENT '订单审核状态 1审核通过 2审核未通过 3待审核通过', + `creater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '申请人', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; diff --git a/Public/static/icons_alibaba/iconfont.json b/Public/static/icons_alibaba/iconfont.json new file mode 100644 index 000000000..8be261669 --- /dev/null +++ b/Public/static/icons_alibaba/iconfont.json @@ -0,0 +1,135 @@ +{ + "id": "1392920", + "name": "project", + "font_family": "iconfont", + "css_prefix_text": "icon", + "description": "", + "glyphs": [ + { + "icon_id": "577306", + "name": "方形未选中", + "font_class": "fangxingweixuanzhong", + "unicode": "e720", + "unicode_decimal": 59168 + }, + { + "icon_id": "577307", + "name": "方形选中-fill", + "font_class": "fangxingxuanzhongfill", + "unicode": "e721", + "unicode_decimal": 59169 + }, + { + "icon_id": "577313", + "name": "加号1", + "font_class": "jiahao1", + "unicode": "e727", + "unicode_decimal": 59175 + }, + { + "icon_id": "577315", + "name": "减号", + "font_class": "jianhao", + "unicode": "e729", + "unicode_decimal": 59177 + }, + { + "icon_id": "1718321", + "name": "返回", + "font_class": "fanhui", + "unicode": "e600", + "unicode_decimal": 58880 + }, + { + "icon_id": "1718323", + "name": "更多", + "font_class": "gengduo", + "unicode": "e601", + "unicode_decimal": 58881 + }, + { + "icon_id": "2674472", + "name": "返回", + "font_class": "fanhui1", + "unicode": "e625", + "unicode_decimal": 58917 + }, + { + "icon_id": "2674473", + "name": "关闭", + "font_class": "guanbi", + "unicode": "e624", + "unicode_decimal": 58916 + }, + { + "icon_id": "4765734", + "name": "plus-circle", + "font_class": "plus-circle", + "unicode": "e781", + "unicode_decimal": 59265 + }, + { + "icon_id": "4765972", + "name": "minus-square", + "font_class": "minus-square", + "unicode": "e796", + "unicode_decimal": 59286 + }, + { + "icon_id": "4765973", + "name": "plus-square", + "font_class": "plus-square", + "unicode": "e797", + "unicode_decimal": 59287 + }, + { + "icon_id": "4936531", + "name": "minus-square-fill", + "font_class": "minus-square-fill", + "unicode": "e84b", + "unicode_decimal": 59467 + }, + { + "icon_id": "4936538", + "name": "plus-square-fill", + "font_class": "plus-square-fill", + "unicode": "e84c", + "unicode_decimal": 59468 + }, + { + "icon_id": "6151304", + "name": "reply", + "font_class": "reply", + "unicode": "e82f", + "unicode_decimal": 59439 + }, + { + "icon_id": "6151371", + "name": "sort", + "font_class": "sort", + "unicode": "e842", + "unicode_decimal": 59458 + }, + { + "icon_id": "6151377", + "name": "sort-down", + "font_class": "sort-down", + "unicode": "e843", + "unicode_decimal": 59459 + }, + { + "icon_id": "6151384", + "name": "sort-up", + "font_class": "sort-up", + "unicode": "e844", + "unicode_decimal": 59460 + }, + { + "icon_id": "8776842", + "name": "search", + "font_class": "icon-test", + "unicode": "e63c", + "unicode_decimal": 58940 + } + ] +}