diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 3ff4e0b7a..b05b76bb9 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -840,7 +840,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); +// $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,1596556800,1598889599,1)); } @@ -879,10 +880,14 @@ class TimingController extends AdminController { // "_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"]) // ->select(); + dump($company_id.'|'.$relation_game_id.'|'.$begintime.'|'.$endtime.'|'.$company_data['company_belong']); + $company_game_ratio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($company_id,(string)$relation_game_id,$begintime,$endtime,$company_data['company_belong']); $company_game_ratio = $company_game_ratio[$relation_game_id]; + dump($company_game_ratio); + // $mould = json_decode($company_game_ratio['turnover_ratio'],true); $amount = 0; @@ -1153,7 +1158,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'=>64,'spend.promote_id'=>1726,'relation_game_id'=>219]) + ->where(['company_id'=>64,'spend.promote_id'=>1726,'relation_game_id'=>211]) // ->order("is_settlement ASC") ->select(); @@ -1223,7 +1228,8 @@ class TimingController extends AdminController { 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']); - + dump(date($begin_pay_time)."-".date($cv['begin_time']-1)); + dump($promote_data[$key]['promote_amount']); } } @@ -1252,8 +1258,10 @@ class TimingController extends AdminController { } else { $cv['end_time'] = $cv['end_time']+86399; } - + 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']); + dump($promote_data[$key]['promote_amount']); } } @@ -1330,7 +1338,7 @@ class TimingController extends AdminController { $promote_data[$key]['company_profit'] = $value['pay_amount']-$promote_data[$key]['cp_amount']-$promote_data[$key]['promote_amount']-$promote_data[$key]['channel_amount']-$promote_data[$key]['company_tax']-$specialAmount; $promote_data[$key]['promote_amount'] += $specialAmount; - + dump($promote_data[$key]['promote_amount']); if ($value['promote_id'] == 0) { // $promote_data[$key]['promote_account']='官方渠道'; // $promote_data[$key]['company_id']='0'; diff --git a/Application/Admin/Model/CompanyGameRatioModel.class.php b/Application/Admin/Model/CompanyGameRatioModel.class.php index f633caee3..6c85e094a 100644 --- a/Application/Admin/Model/CompanyGameRatioModel.class.php +++ b/Application/Admin/Model/CompanyGameRatioModel.class.php @@ -55,17 +55,32 @@ class CompanyGameRatioModel extends Model foreach($res as $k=>$v){ //获取最后一个数据 $tgr = &$game_ratio[$v['relation_game_id']]; - $last_time_ratio = end($game_ratio[$v['relation_game_id']]); + + $game_radio_data = $game_ratio[$v['relation_game_id']]; + + $game_key = 0; + + foreach ($game_radio_data as $key => $value) { + if (!isset($value['ratio'])) { + $game_key = $key; + $last_time_ratio = $value; + break; + } + } + +// $last_time_ratio = end($game_ratio[$v['relation_game_id']]); if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){ //全段 if($v['begin_time'] <= $last_time_ratio['begintime']){ - $tgr[count($tgr)-1]['ratio'] = !$is_inside?$v['ratio']:0; - $tgr[count($tgr)-1]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[]; + + $tgr[$game_key]['ratio'] = !$is_inside?$v['ratio']:0; + $tgr[$game_key]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[]; continue; }else{ //上分段 - $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1; + + $tgr[$game_key]['endtime'] = $v['begin_time']-1; $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]]; continue; @@ -73,8 +88,9 @@ class CompanyGameRatioModel extends Model } if($v['end_time'] < $last_time_ratio['endtime']){ if($last_time_ratio['begintime'] < $v['begin_time']){ + //中段 - $tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1; + $tgr[$game_key]['endtime'] = $v['begin_time']-1; $tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]]; @@ -85,16 +101,18 @@ class CompanyGameRatioModel extends Model if($last_time_ratio['begintime'] > $v['begin_time']){ //下分段 - $tgr[count($tgr)-1]['begintime'] = $v['end_time']-0+1; + + $tgr[$game_key]['begintime'] = $v['end_time']-0+1; // $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]]; $tgr[] = ['begintime'=>$last_time_ratio['begintime'],"endtime"=>$v['end_time']-0,"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]]; continue; } if($last_time_ratio['begintime'] = $v['begin_time']){ - $tgr[count($tgr)-1]['endtime'] = $v['end_time']; - $tgr[count($tgr)-1]['ratio'] = !$is_inside?$v['ratio']:0; - $tgr[count($tgr)-1]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[]; + + $tgr[$game_key]['endtime'] = $v['end_time']; + $tgr[$game_key]['ratio'] = !$is_inside?$v['ratio']:0; + $tgr[$game_key]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[]; $tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']]; } diff --git a/Application/Admin/View/CompanyStatementPool/editPuPool.html b/Application/Admin/View/CompanyStatementPool/editPuPool.html index 024288cc1..354397cb2 100644 --- a/Application/Admin/View/CompanyStatementPool/editPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/editPuPool.html @@ -269,6 +269,7 @@ - - - + - diff --git a/Application/Admin/View/CompanyStatementPool/viewPuPool.html b/Application/Admin/View/CompanyStatementPool/viewPuPool.html index 32e791c67..caabbedc7 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPuPool.html @@ -148,7 +148,7 @@ {$com['statement_info'][0]['account']} - - + - @@ -244,7 +244,9 @@ {$account['game_list'][0]['game_name']} {$account['game_list'][0]['game_type_name']} + {$account['time']|default="-----"} + {$account['game_list'][0]['pay_amount']} diff --git a/Data/update.sql b/Data/update.sql index bf820ca88..d7badc735 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -2670,13 +2670,13 @@ ADD COLUMN `begin_time` int(11) NOT NULL DEFAULT 0 COMMENT '开始时间' AFTER ADD COLUMN `end_time` int(11) NOT NULL DEFAULT 0 COMMENT '过期时间' AFTER `begin_time`; ALTER TABLE `tab_game_ratio_mould` -ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 0 COMMENT '结算流水类型' AFTER `end_time`; +ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 1 COMMENT '结算流水类型' AFTER `end_time`; ALTER TABLE `tab_company_game_ratio_log` -ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 0 COMMENT '结算流水类型 1 月流水 2 历史流水' AFTER `end_time`; +ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 1 COMMENT '结算流水类型 1 月流水 2 历史流水' AFTER `end_time`; ALTER TABLE `tab_company_game_ratio` -ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 0 COMMENT '结算流水类型 1 月流水 2 历史流水' AFTER `end_time`; +ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 1 COMMENT '结算流水类型 1 月流水 2 历史流水' AFTER `end_time`; ALTER TABLE `tab_settleup_marketorder` ADD COLUMN `is_settlement` tinyint(2) NULL DEFAULT 0 COMMENT '是否结算' AFTER `company_profit`;