From 166c1d63d61acf4849a86e1f3569e269fc48a723 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Fri, 4 Dec 2020 14:40:48 +0800 Subject: [PATCH] =?UTF-8?q?12=E6=9C=88=E5=8A=9F=E8=83=BD=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementPoolController.class.php | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 993f19158..79d24669a 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -1761,4 +1761,60 @@ class CompanyStatementPoolController extends ThinkController } + public function splitForPayStatementInfo() { + $ids = $_REQUEST['ids']; + $dbres = $this->DBModel->field("id")->where("id in ({$ids})")->select(); + foreach($dbres as $key=>$value){ + + $statement_data_info = M("company_statement_info","tab_") + ->where(['pool_id'=>$value['id']]) + ->select(); + + //循环info汇总详单 + foreach ($statement_data_info as $skey => $svalue) { + + $statement_info = json_decode($svalue['statement_info'],true); + $handle_data = []; + + foreach ($statement_info as $k => $v) { + $game_list = $v['game_list']; + foreach ($game_list as $gk => $gv ) { + //同一结算时间的汇总成一个数组 + $handle_data[$gv['statement_begin_time'].'-'.$gv['statement_end_time']][] = ['account'=>$v['account'],'game_list'=>$gv]; + + } +// dump($handle_data); + + } + $save = []; + $handle_statement = []; + //将同一时间的汇总详单记录起来 + foreach ($handle_data as $hk => $hv) { + $statement_time = explode('-',$hk); + + $save['statement_begin_time'] = $statement_time[0]; + $save['statement_end_time'] = $statement_time[1]; + + $handle_statement = $hv; + +// $save['statement_info'] = json_encode($handle_statement); + $save['company_id'] = $svalue['company_id']; + $save['company_name'] = $svalue['company_name']; + $save['company_type'] = $svalue['company_type']; + $save['company_info'] = $svalue['company_info']; + + $save['statement_money'] = $svalue['statement_money']; + $save['statement_info_id'] = $svalue['id']; + + dump($handle_statement); + + } + + + } + + } + + } + }