From ab7ae8063449322e1fed638f6fae9c185e9c069e Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Thu, 3 Sep 2020 18:04:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E7=82=B9bug=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementController.class.php | 35 +++++++++++++++++-- .../CompanyStatementPoolController.class.php | 7 +++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index c0353a959..e6bc5ed65 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -1368,14 +1368,16 @@ class CompanyStatementController extends ThinkController $statement_data = []; M()->startTrans(); foreach ($data as $key => $value) { + $begin_time = 99999999999; + $end_time = 0; $statement_data = []; $company_data = M("promote_company","tab_")->where(['id'=>$value['company_id']])->find(); $company_type = M("company_relation","tab_")->where("first_company_id={$value['company_id']} or second_company_id={$value['company_id']}")->find(); $insert['is_payment'] = $company_type['is_payment']; - $insert['statement_begin_time'] = strtotime($value['statement_begin_time']); - $insert['statement_end_time'] = strtotime($value['statement_end_time']); +// $insert['statement_begin_time'] = strtotime($value['statement_begin_time']); +// $insert['statement_end_time'] = strtotime($value['statement_end_time']); $insert['withdraw_type'] = $withdraw_type; $insert['company_belong'] = $company_data['company_belong']; $insert['company_name'] = $company_data['company_name']; @@ -1470,12 +1472,23 @@ class CompanyStatementController extends ThinkController $amount_time['pay_way'] = ['egt',0]; foreach ($statement_info as $k => $v) { + $statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time'])); $statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399; + if ($statement_begin_time<$begin_time) { + $begin_time = $statement_begin_time; + } + + if ($statement_end_time>$end_time) { + $end_time = $statement_end_time; + } + + $amount_time['_string'] = "payed_time between {$statement_begin_time} and {$statement_end_time} and relation_game_id={$v['relation_game_id']}"; $dataAmount = M("spend","tab_") - ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name,substring_index(substring_index(promote.`chain`,'/',2),'/',-1) promote_id,chain,admin_id") + ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name, + CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,chain,admin_id") ->join("left join tab_promote promote on tab_spend.promote_id=promote.id") ->join("left join tab_game game on tab_spend.game_id=game.id") ->where($amount_time) @@ -1525,9 +1538,25 @@ class CompanyStatementController extends ThinkController $insert['statement_info'] = json_encode($statement_insert); } else { + $insert['statement_info'] = json_encode($statement_info); + foreach ($statement_info as $k => $v) { + $statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time'])); + $statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399; + + if ($statement_begin_time<$begin_time) { + $begin_time = $statement_begin_time; + } + + if ($statement_end_time>$end_time) { + $end_time = $statement_end_time; + } + } } + $insert['statement_begin_time'] = $begin_time; + $insert['statement_end_time'] = $end_time; + if ($company_type['first_company_id'] == $value['company_id']) { $insert['first_party_info'] = json_encode($proCompany_info); $insert['second_party_info'] = json_encode($secord_info); diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 34a6fa726..72ac9b7d5 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -799,7 +799,12 @@ class CompanyStatementPoolController extends ThinkController if($re_op){ //公司及上游回退 if($db_res['company_type'] == 2){ - $this->retry($db_res); //个人重算 + + if($db_res['withdraw_type'] == 3) { + $this->cancelCompanyPool($db_res);//公司撤回 + } else { + $this->retry($db_res); //个人重算 + } }else{ $this->cancelCompanyPool($db_res);//公司撤回 }