diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index 293b449c1..6245f8322 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -984,6 +984,10 @@ class FinanceController extends ThinkController $map['promote_id'] = $_REQUEST['root_id']; } + if ($_REQUEST['merchant_id']){ + $map['merchant_id'] = $_REQUEST['merchant_id']; + } + $promote_id = implode(',',$promote_id); if ($promote_id) { $map['promote_id'] = ['in',$promote_id]; @@ -1007,7 +1011,7 @@ class FinanceController extends ThinkController $map['game_player_name'] = array('like',I("user_nickname").'%'); } // var_dump($map);die(); - $field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,sdk_version"; + $field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,sdk_version,merchant_id"; $group = ""; $order = "payed_time DESC"; @@ -1017,7 +1021,18 @@ class FinanceController extends ThinkController $data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row); } + $merchant_data = M("payment_merchant","tab_") + ->field("id,name") + ->where("1=1") + ->select(); + $handle_merchant = []; + + foreach ($merchant_data as $key => $value) { + $handle_merchant[$value['id']] = $value['name']; + } + foreach($data as $key => $value) { + $data[$key]['merchant_name'] = $handle_merchant[$value['merchant_id']]; $data[$key]['pay_way'] = getPayType($value['pay_way']); $data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']); $data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']); @@ -1044,7 +1059,8 @@ class FinanceController extends ThinkController "game_player_name"=>"角色名称", "cost"=>"订单金额", "pay_amount"=>"实付金额", - "pay_way"=>"充值方式" + "pay_way"=>"充值方式", + "merchant_name"=>"所属商户" ); addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"充值-财务管理-游戏统计-订单查看-导出"]); data2csv($data,"游戏统计订单查看",$dcop); diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index 66bb88351..894738ec6 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -784,7 +784,12 @@ class FinancePromoteController extends AdminController if (!empty(I('user_nickname'))) { $map['game_player_name'] = array('like',I("user_nickname").'%'); } - $field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,sdk_version,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,market_admin_id"; + + if ($_REQUEST['merchant_id']){ + $map['merchant_id'] = $_REQUEST['merchant_id']; + } + + $field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,sdk_version,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,market_admin_id,merchant_id"; $group = ""; $order = "pay_time DESC"; if(isset($_REQUEST['export'])){ @@ -798,7 +803,18 @@ class FinancePromoteController extends AdminController $marketAdmins = getAdminUsernameList(array_column($data, 'market_admin_id')); } + $merchant_data = M("payment_merchant","tab_") + ->field("id,name") + ->where("1=1") + ->select(); + $handle_merchant = []; + + foreach ($merchant_data as $key => $value) { + $handle_merchant[$value['id']] = $value['name']; + } + foreach($data as $key => $value) { + $data[$key]['merchant_name'] = $handle_merchant[$value['merchant_id']]; $data[$key]['pay_way'] = getPayType($value['pay_way']); $data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']); $data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']); @@ -831,6 +847,7 @@ class FinancePromoteController extends AdminController "cost"=>"订单金额", "pay_amount"=>"实付金额", "pay_way"=>"充值方式", + "merchant_name"=>"所属商户", )); } $totalData = self::totalGameStatisticsData($map, false); diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 3c7825d35..be2419b2c 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -841,7 +841,8 @@ class TimingController extends AdminController { public function test() { // $this->getSpecialComplement(strtotime(date("Y-m-1",strtotime("2020-07"))),strtotime(date("Y-m-t",strtotime("2020-07")))+86399,2259); - dump(D("CompanyGameRatio")->getPromoteCompanyGameRatio(64,(string)211,1596211200,1598889599,1)); +// dump(D("CompanyGameRatio")->getPromoteCompanyGameRatio(64,(string)211,1596211200,1598889599,1)); + $this->createMarketBonus("all"); } @@ -990,10 +991,12 @@ class TimingController extends AdminController { $belong_map = []; $month_time[] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); - $month_time[] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-2).'-01')); +// $month_time[] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-2).'-01')); $map['pay_time'] = ['in',$month_time]; $spend_map['pay_time'] = ['elt',strtotime(date('Y-m-t 23:59:59', strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')))]; + $time_end = strtotime(date('Y-m-t',strtotime($month_time))); + } else { $month_time = $map['pay_time']; $time_start = strtotime(date('Y-m-1',strtotime($map['pay_time']))); @@ -1038,6 +1041,11 @@ class TimingController extends AdminController { } } + + if (!$value['end_time']) { + $value['end_time'] = $time_end; + } + $value['game_ids'] = implode(',',$value['game_ids']); if (!$spend_map['_string']) { @@ -1169,7 +1177,7 @@ class TimingController extends AdminController { ->join("left join tab_promote_company company on promote.company_id = company.id") ->join("left join ({$data}) auth on auth.uid=market_admin_id") ->where(['develop_type'=>['egt',1],'group_id'=>['in',['11','12','21']]]) -// ->where(['company_id'=>313,'spend.promote_id'=>4359,'relation_game_id'=>191]) +// ->where(['company_id'=>278,'spend.promote_id'=>3917,'relation_game_id'=>213]) // ->order("is_settlement ASC") ->select(); @@ -1243,7 +1251,7 @@ class TimingController extends AdminController { } elseif($value['is_settlement'] == '1') { if ($ck == 0) { - +// echo 1; if ($cv['begin_time'] >= $begin_pay_time) { $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$begin_pay_time,$cv['begin_time']-1,$value['pay_amount']); @@ -1255,15 +1263,17 @@ class TimingController extends AdminController { if (!$company_belong_game[$ck+1]) { +// dump($end_pay_time); +// dump($cv['end_time']); if ($end_pay_time > $cv['end_time']) { - +// echo 2; $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$cv['end_time']+86400,$end_pay_time,$value['pay_amount']); } } if ($ck > 1) { - +// echo 3; if (($cv['begin_time'] - $company_belong_game[$ck-1]['end_time'] + 86399) > 1) { $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$company_belong_game[$ck-1]['end_time'] + 86400,$cv['begin_time']-1,$value['pay_amount']); @@ -1271,12 +1281,17 @@ class TimingController extends AdminController { } if (!in_array($value['relation_game_id'],$ungame_ids)) { - +// echo 4; if (($cv['end_time']+86399) > $end_pay_time) { $cv['end_time'] = $end_pay_time; } else { $cv['end_time'] = $cv['end_time']+86399; } + + if ($cv['begin_time'] < $begin_pay_time) { + $cv['begin_time'] = $begin_pay_time; + } + // dump($promote_data[$key]['promote_amount']); // dump(date($cv['begin_time'])."-".date($cv['end_time'])); $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$cv['begin_time'],$cv['end_time'],$value['pay_amount']); @@ -1430,11 +1445,12 @@ class TimingController extends AdminController { $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')); } +// dump(date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')));die(); if ($pay_time == 'all') { $end = date("Y-m",time()); - $start = '2019-08'; + $start = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); $i = 0; do { $date = date('Y-m', strtotime($start . ' + ' . $i . ' month')); @@ -1443,8 +1459,8 @@ class TimingController extends AdminController { $this->insertAllUserBonus($date); } while ($date < date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'))); -// $map['pay_time'] = []; - unset($map['pay_time']); + $map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));; +// unset($map['pay_time']); } else{ M("market_altogether","tab_")->where(['pay_time'=>$pay_time])->delete(); $this->insertAllUserBonus($pay_time); @@ -1484,7 +1500,7 @@ class TimingController extends AdminController { // dump($market_percentage); $settleup_marketorder = M("settleup_marketorder","tab_") - ->where(['admin_id'=>$value['admin_id'],'pay_time'=>$value['pay_time']]) + ->where(['admin_id'=>$value['admin_id'],'pay_time'=>$value['pay_time'],'is_settlement'=>1]) ->select(); $all_data[$key]['performance_commission'] = 0; diff --git a/Application/Admin/View/Finance/gameStatisticsDetail.html b/Application/Admin/View/Finance/gameStatisticsDetail.html index b3ff89c42..6db8d3462 100644 --- a/Application/Admin/View/Finance/gameStatisticsDetail.html +++ b/Application/Admin/View/Finance/gameStatisticsDetail.html @@ -88,6 +88,15 @@ +