From b8af3ea38484fa61b5c54ee8938e5c285dcf3c61 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 7 Dec 2020 14:59:38 +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 | 189 +++++----- .../ExcelPaymentController.class.php | 31 +- .../Controller/PaymentController.class.php | 354 +++++++++++++++--- Application/Payment/View/Payment/lists.html | 51 ++- .../Payment/View/Payment/viewPuPool.html | 243 ++++++++++-- 5 files changed, 665 insertions(+), 203 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 1da1ca382..481fa2e4b 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -1769,7 +1769,7 @@ class CompanyStatementPoolController extends ThinkController public function splitForPayStatementInfo() { $ids = $_REQUEST['ids']; - $limit_amount = 20000; + $limit_amount = 10000; $dbres = $this->DBModel->field("id")->where("id in ({$ids})")->select(); foreach($dbres as $key=>$value){ @@ -1780,44 +1780,79 @@ class CompanyStatementPoolController extends ThinkController if ($value['company_type'] == 2){ //循环info汇总详单 foreach ($statement_data_info as $skey => $svalue) { + if ($svalue['verify_status'] == 1) { - $statement_info = json_decode($svalue['statement_info'],true); - $handle_data = []; + $statement_info = json_decode($svalue['statement_info'], true); + $handle_data = []; - foreach ($statement_info as $k => $v) { + foreach ($statement_info as $k => $v) { - $game_list = $v['game_list']; + $game_list = $v['game_list']; - foreach ($game_list as $gk => $gv ) { - //同一结算时间的汇总成一个数组 - if (!$handle_data[$gv['statement_begin_time'].'-'.$gv['statement_end_time']][$v['account']]) { - $handle_data[$gv['statement_begin_time'].'-'.$gv['statement_end_time']][$v['account']] = ['account'=>$v['account'],'game_list'=>[$gv]]; - } else { - $handle_data[$gv['statement_begin_time'].'-'.$gv['statement_end_time']][$v['account']]['game_list'][] = $gv; + foreach ($game_list as $gk => $gv) { + //同一结算时间的汇总成一个数组 + if (!$handle_data[$gv['statement_begin_time'] . '-' . $gv['statement_end_time']][$v['account']]) { + $handle_data[$gv['statement_begin_time'] . '-' . $gv['statement_end_time']][$v['account']] = ['account' => $v['account'], 'game_list' => [$gv]]; + } else { + $handle_data[$gv['statement_begin_time'] . '-' . $gv['statement_end_time']][$v['account']]['game_list'][] = $gv; + } } } - } - $save = []; - $handle_statement = []; - //将同一时间的汇总详单记录起来 - foreach ($handle_data as $hk => $hv) { - $statement_time = explode('-',$hk); - $save['statement_begin_time'] = strtotime(str_replace('.','-',$statement_time[0])); - $save['statement_end_time'] = strtotime(str_replace('.','-',$statement_time[1])); - $handle_statement = json_encode(array_values($hv)); - $statement_money = 0; - - foreach ($hv as $shk => $shv) { - - $game_list = $shv['game_list']; - foreach($game_list as $gk => $gv ) { - $statement_money += $gv['sum_money']; + $save = []; + $handle_statement = []; + //将同一时间的汇总详单记录起来 + foreach ($handle_data as $hk => $hv) { + $statement_time = explode('-', $hk); + $save['statement_begin_time'] = strtotime(str_replace('.', '-', $statement_time[0])); + $save['statement_end_time'] = strtotime(str_replace('.', '-', $statement_time[1])); + $handle_statement = json_encode(array_values($hv)); + $statement_money = 0; + + foreach ($hv as $shk => $shv) { + + $game_list = $shv['game_list']; + foreach ($game_list as $gk => $gv) { + $statement_money += $gv['sum_money']; + } } - } - if ($statement_money > $limit_amount) { - for($amount=$statement_money;$amount>0;$amount -= $limit_amount) { + if ($statement_money > $limit_amount) { + for ($amount = $statement_money; $amount > 0; $amount -= $limit_amount) { + $save['statement_info'] = $handle_statement; + $save['company_id'] = $svalue['company_id']; + $save['company_name'] = $svalue['company_name']; + $save['company_type'] = $svalue['company_type']; + $save['pay_type'] = $svalue['pay_type']; + $save['verify_status'] = $svalue['verify_status']; + $save['remark'] = $svalue['remark']; + $save['company_info'] = $svalue['company_info']; + $save['statement_num'] = "JS_" . date("YmdHis", time()) . sp_random_string(5); + + if ($amount > $limit_amount) { + $save['statement_money'] = $limit_amount; + } else { + $save['statement_money'] = $amount; + } +// $setStatementInfo = json_decode($svalue['statement_info'],true); +// foreach ($setStatementInfo as $sskey => $ssvalue) { +// +// $setStatementInfo[$sskey]['pay_amount'] = $save['statement_money']/(($ssvalue['ratio']-$ssvalue['fax_ratio'])/100); +// $setStatementInfo[$sskey]['sum_money'] = $save['statement_money']; +// +// } +// +// $save['statement_info'] = json_encode($setStatementInfo); + + $save['statement_info_id'] = $svalue['id']; + $save['fine'] = $svalue['fine']; + $save['reward'] = $svalue['reward']; + $save['is_limit'] = 1; + + M("pay_statement_info", "tab_")->add($save); + } + + } else { $save['statement_info'] = $handle_statement; $save['company_id'] = $svalue['company_id']; $save['company_name'] = $svalue['company_name']; @@ -1826,79 +1861,63 @@ class CompanyStatementPoolController extends ThinkController $save['verify_status'] = $svalue['verify_status']; $save['remark'] = $svalue['remark']; $save['company_info'] = $svalue['company_info']; - $save['statement_num'] = "JS_".date("YmdHis",time()).sp_random_string(5); - - if ($amount > $limit_amount) { - $save['statement_money'] = $limit_amount; - } else { - $save['statement_money'] = $amount; - } - + $save['statement_num'] = "JS_" . date("YmdHis", time()) . $save['company_id'] . sp_random_string(5); + $save['statement_money'] = $statement_money; $save['statement_info_id'] = $svalue['id']; $save['fine'] = $svalue['fine']; $save['reward'] = $svalue['reward']; - $save['is_limit'] = 1; - M("pay_statement_info","tab_")->add($save); + M("pay_statement_info", "tab_")->add($save); } - } else { - $save['statement_info'] = $handle_statement; - $save['company_id'] = $svalue['company_id']; - $save['company_name'] = $svalue['company_name']; - $save['company_type'] = $svalue['company_type']; - $save['pay_type'] = $svalue['pay_type']; - $save['verify_status'] = $svalue['verify_status']; - $save['remark'] = $svalue['remark']; - $save['company_info'] = $svalue['company_info']; - $save['statement_num'] = "JS_".date("YmdHis",time()).sp_random_string(5); - $save['statement_money'] = $statement_money; - $save['statement_info_id'] = $svalue['id']; - $save['fine'] = $svalue['fine']; - $save['reward'] = $svalue['reward']; - M("pay_statement_info","tab_")->add($save); } - - - } } } else { foreach ($statement_data_info as $skey => $svalue) { + if ($svalue['verify_status'] == 1) { + $statement_money = $svalue['statement_money']; + if ($statement_money > $limit_amount) { + for ($amount = $statement_money; $amount > 0; $amount -= $limit_amount) { + $save['statement_begin_time'] = $svalue['statement_begin_time']; + $save['statement_end_time'] = $svalue['statement_end_time']; - $statement_money = $svalue['statement_money']; - if ($statement_money > $limit_amount) { - for ($amount = $statement_money; $amount > 0; $amount -= $limit_amount) { - $save['statement_begin_time'] = $svalue['statement_begin_time']; - $save['statement_end_time'] = $svalue['statement_end_time']; - $save['statement_info'] = $svalue['statement_info']; - $save['company_id'] = $svalue['company_id']; - $save['company_name'] = $svalue['company_name']; - $save['company_type'] = $svalue['company_type']; - $save['pay_type'] = $svalue['pay_type']; - $save['verify_status'] = $svalue['verify_status']; - $save['remark'] = $svalue['remark']; - $save['company_info'] = $svalue['company_info']; - $save['statement_num'] = "JS_" . date("YmdHis", time()) . sp_random_string(5); - $save['statement_money'] = $svalue['statement_money']; + $save['company_id'] = $svalue['company_id']; + $save['company_name'] = $svalue['company_name']; + $save['company_type'] = $svalue['company_type']; + $save['pay_type'] = $svalue['pay_type']; + $save['verify_status'] = $svalue['verify_status']; + $save['remark'] = $svalue['remark']; + $save['company_info'] = $svalue['company_info']; + $save['statement_num'] = "JS_" . date("YmdHis", time()) . $svalue['company_id'] . sp_random_string(5); + $save['statement_money'] = $svalue['statement_money']; + $save['is_limit'] = 1; - if ($amount > $limit_amount) { - $save['statement_money'] = $limit_amount; - } else { - $save['statement_money'] = $amount; - } + if ($amount > $limit_amount) { + $save['statement_money'] = $limit_amount; + } else { + $save['statement_money'] = $amount; + } + $setStatementInfo = json_decode($svalue['statement_info'],true); + foreach ($setStatementInfo as $sskey => $ssvalue) { - $save['statement_info_id'] = $svalue['id']; - $save['fine'] = $svalue['fine']; - $save['reward'] = $svalue['reward']; + $setStatementInfo[$sskey]['pay_amount'] = $save['statement_money']/(($ssvalue['ratio']-$ssvalue['fax_ratio'])/100); + $setStatementInfo[$sskey]['sum_money'] = $save['statement_money']; - M("pay_statement_info", "tab_")->add($save); - } - } else { - for ($amount = $statement_money; $statement_money > 0; $amount -= $limit_amount) { + } + + $save['statement_info'] = json_encode($setStatementInfo); + + $save['statement_info_id'] = $svalue['id']; + $save['fine'] = $svalue['fine']; + $save['reward'] = $svalue['reward']; + + M("pay_statement_info", "tab_")->add($save); + } + } else { $save['statement_begin_time'] = $svalue['statement_begin_time']; $save['statement_end_time'] = $svalue['statement_end_time']; $save['statement_info'] = $svalue['statement_info']; diff --git a/Application/Payment/Controller/ExcelPaymentController.class.php b/Application/Payment/Controller/ExcelPaymentController.class.php index 32cc1fb6c..982d81152 100644 --- a/Application/Payment/Controller/ExcelPaymentController.class.php +++ b/Application/Payment/Controller/ExcelPaymentController.class.php @@ -157,7 +157,6 @@ class ExcelPaymentController extends BaseController if(count($checkarr) < 1){ $this->ajaxReturn(["status"=>1,"msg"=>"ok"]); } - $limit_amount = 20000; // dump($batch);die(); $ExcelStatementInfo = M('ExcelStatementInfo',"tab_"); @@ -191,34 +190,12 @@ class ExcelPaymentController extends BaseController $this->ajaxReturn(["status"=>0,"msg"=>"支付宝真实姓名及登陆账号不允许为空"]); } - $statement_money = $v['statement_money']; - - if ($statement_money > $limit_amount) { - for($amount=$statement_money;$amount>0;$amount -= $limit_amount) { - - if ($amount > $limit_amount) { - $v['statement_money'] = $limit_amount; - } else { - $v['statement_money'] = $amount; - } - - $res = $ExcelStatementInfo->add($v); - if($res === false){ - M('ExcelStatementInfo',"tab_")->where("batch_num = '{$v['batch_num']}'")->delete(); - $this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]); - } - } - } else { - - $res = $ExcelStatementInfo->add($v); - if($res === false){ - M('ExcelStatementInfo',"tab_")->where("batch_num = '{$v['batch_num']}'")->delete(); - $this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]); - } - + $res = $ExcelStatementInfo->add($v); + if($res === false){ + M('ExcelStatementInfo',"tab_")->where("batch_num = '{$v['batch_num']}'")->delete(); + $this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]); } - } $this->ajaxReturn(["status"=>1,"msg"=>"ok"]); } diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 0ce6de013..2ab51099b 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -93,17 +93,19 @@ class PaymentController extends BaseController } // dump($map);die(); + $CompanyInfo = M("company_statement_info","tab_") + ->alias('s') + ->field("s.*,p.statement_num statement_pool_num") + ->join("left join tab_company_statement_pool p ON p.id = s.pool_id") + ->where($map) + ->page($page,$row) + ->order("FIELD(s.pay_status,0,-1,1),s.verify_status desc") + ->select(); + + $handleData = []; - $CompanyInfo = M("pay_statement_info","tab_") - ->alias('s') - ->field("s.*,p.statement_num statement_pool_num") - ->join("left join tab_company_statement_info i ON s.statement_info_id = i.id") - ->join("left join tab_company_statement_pool p ON p.id = i.pool_id") - ->where($map) - ->page($page,$row) - ->order("FIELD(s.pay_status,0,-1,1),s.verify_status desc") - ->select(); foreach($CompanyInfo as $k=>&$v){ + $handleData[] = $v['id']; $v['can_pay'] = 1; if($v['verify_status'] == -1){ $v['verify_status_str']="信息配置不全"; @@ -137,13 +139,59 @@ class PaymentController extends BaseController } $v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}"; } + + + $statementInfo = M("pay_statement_info","tab_") + ->alias('s') + ->field("s.*,p.statement_num statement_pool_num") + ->join("left join tab_company_statement_info i ON s.statement_info_id = i.id") + ->join("left join tab_company_statement_pool p ON p.id = i.pool_id") + ->where(['statement_info_id'=>['in',$handleData]]) + ->order("FIELD(s.pay_status,0,-1,1),s.verify_status desc") + ->select(); + + $handleData = []; + foreach ($statementInfo as $key => $value) { + + $value['can_pay'] = 1; + if($value['verify_status'] == -1){ + $value['verify_status_str']="信息配置不全"; + $value['can_pay'] = 0; + }else{ + if($value['pay_status'] == 1){ $value['can_pay'] = 0; } + $value['verify_status_str'] = $this->PayStatus[$value['pay_status']]; + if($value['pay_status'] == 1){ + $value['pay_type'] = $value['pay_type'] == 1 ? "提现" :"线上打款"; + $value['verify_status_str'] .= ("/". $value['pay_type']); + } + } + + $value['company_type'] = $this->CompanyType[$value['company_type']]; + $value['statement_begin_time'] = date('Y-m-d',$value['statement_begin_time']); + $value['statement_end_time'] = date('Y-m-d',$value['statement_end_time']); + if(empty($value['pay_time'])){ + $value['pay_time'] = "--"; + }else{ + $value['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']); + } + $value["valid"] = "{$value['statement_begin_time']} ~ {$value['statement_end_time']}"; + $handleData[$value['statement_info_id']]['data'][] = $value; + $handleData[$value['statement_info_id']]['ids'][] = $value['id']; + } + + foreach ($CompanyInfo as $key=>$value) { + $CompanyInfo[$key]['son_info'] = $handleData[$value['id']]['data']; + $CompanyInfo[$key]['ids'] = implode(',',$handleData[$value['id']]['ids']); + } +// dump($CompanyInfo);die(); + //统计待打款金额 $countmap = $map; $countmap['pay_status']=["neq",1]; - $money = M("pay_statement_info","tab_")->alias('s')->field("sum(statement_money) statement_money")->where($countmap)->find(); + $money = M("company_statement_info","tab_")->alias('s')->field("sum(statement_money) statement_money")->where($countmap)->find(); - $count = M("pay_statement_info","tab_")->alias('s')->field("count(id) count")->where($map)->find(); + $count = M("company_statement_info","tab_")->alias('s')->field("count(id) count")->where($map)->find(); $page = set_pagination($count['count'], $row); if ($page) { $this->assign('_page', $page); @@ -167,7 +215,7 @@ class PaymentController extends BaseController $is_export = true; } //获取基本信息 - $dbres = M("pay_statement_info","tab_")->where("id='{$id}'")->select(); + $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->select(); $title = $dbres[0]['company_name']; $this->assign("title",$title); @@ -182,41 +230,233 @@ class PaymentController extends BaseController } } + + //改变结构 + public function changeDataStruct($statement_info = [],$is_export = 0,&$week_line = 1) { + + $game_list = []; + $old_line = $week_line; + + //使用时间与会长账号作为键值分离数据 + foreach($statement_info as $sk=>$sv){ + + foreach($sv['game_list'] as $gk=>$gv){ + + $gv['account'] = $sv['account']; + $game_list[$gv['statement_begin_time'].'-'.$gv['statement_end_time']][$gv['account']][] = $gv; + + } + + } + + $game_data = []; + $handle_data = []; + //处理游戏金额数据 + foreach($game_list as $gk => $gv) { + + foreach ($gv as $sk => $sv) { + $game_data['account'] = $sk; + $game_data['row'] = count($sv); + + if ($game_data['row'] == '0') { + $game_data['row'] = 1; + } + + $game_data['time_row'] = count($sv); + + if ($game_data['time_row'] == '0') { + $game_data['time_row'] = 1; + } + + $game_data['time'] = $gk; + $game_data['week_amount'] = 0; + //周结算金额计算 + for ($i=0;;$i++) { + if ($sv[$i]['sum_money']) { + $game_data['week_amount'] += $sv[$i]['sum_money']; + $game_data['withhold_amount'] += $sv[$i]['withhold']; + $game_data['fine'] += $sv[$i]['fine']; + $game_data['reward'] += $sv[$i]['reward']; + } else { + break; + } + + } + + $game_data['game_list'] = $sv; + array_push($handle_data,$game_data); + $game_data = []; + + } + + } + + $substract = 1; + + //添加周结算金额,合并相同的结算时间 + + foreach($handle_data as $hk => $hv) { + + if($hk > 0) { + + for (;;) { + + if (!$handle_data[$hk-$substract]['time']) { + $substract++; + } else { + break; + } + + } + + if ($hv['time'] == $handle_data[$hk-$substract]['time']) { + + $handle_data[$hk-$substract]['time_row'] += $handle_data[$hk]['time_row']; + + $handle_data[$hk-$substract]['week_amount'] += $handle_data[$hk]['week_amount']; + $handle_data[$hk-$substract]['withhold_amount'] += $handle_data[$hk]['withhold_amount']; + + unset($handle_data[$hk]['time']); + unset($handle_data[$hk]['time_row']); + unset($handle_data[$hk]['week_amount']); + } + $substract = 1; + } + + } + + foreach($handle_data as $hk => $hv) { + $substract = 1; + if ($is_export) { + + for (;;) { + + if (!$handle_data[$hk+$substract]['time']&&$handle_data[$hk+$substract]['account']) { +// if ( +// $hv['account'] == 'zj9587' || +// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') { +// dump($handle_data[$hk]['time']); +// } + + $week_line++; + $substract++; + } else { + break; + } + + } + + if (count($hv['game_list'])>1) { + $week_line += count($hv['game_list'])-1; + } + + $handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line})+SUM(P{$old_line}:P{$week_line})-SUM(Q{$old_line}:Q{$week_line})-SUM(R{$old_line}:R{$week_line}),2)"; + + + if (count($hv['game_list'])>1) { + + $old_line += count($hv['game_list']); + + } else { + $old_line++; + } + + if(count($hv['game_list'])>1) { + + $week_line = $old_line ; + } else { + $week_line = $old_line; + } + + } + + } + + return $handle_data?$handle_data:[]; + } + //个人汇总结算查看 public function viewPuPool(&$infolist,$is_export){ $line = 1; $count = []; + $week_line = 2; + //获取对接人 foreach($infolist as $k=>&$v){ $v['statement_info'] = json_decode($v['statement_info'],true); $v['company_info'] = json_decode($v['company_info'],true); - $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']); - $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']); + $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']); + $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']); + if( isset($v['verify_status'])){ + if( $v['verify_status'] ==2 ){ + $v['is_payment'] = 2; //不打款 + }else{ + $v['is_payment'] = 1; + } + } $cline = $line+1; if($is_export){ - $v['sum_money_exp'] = "="; + $v['statement_money'] = "=ROUND("; } + $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); + + $v['statement_info'] = $handle_data; + $row = 0; foreach($v['statement_info'] as $ke=>&$va){ - $line ++; - if(isset($va['ratio'])){ - $va['increment_ratio'] = 0; - }else{ - $va['ratio'] = 0; + $va['row'] = count($va['game_list']); + $row += count($va['game_list']); + + foreach($va['game_list'] as $key=>&$val){ + $line ++; + if($v['withdraw_type'] != 3) { +// if(!$val['ratio']&&!$val['increment_ratio']) { +// if(isset($val['ratio'])){ +// $val['increment_ratio'] = 0; +// }else{ +// $val['ratio'] = 0; +// } +// } + if (!$val['increment_ratio']) { + $val['increment_ratio'] = 0; + } + + if (!$val['ratio']) { + $val['ratio'] = 0; + } + + } + + if($is_export){ + if($v['withdraw_type'] != 3) { + $val['sum_money'] = "=ROUND((K{$line}-L{$line})*(M{$line}+N{$line}),2)"; + } else { + $val['sum_money'] = "=ROUND(K{$line}*(N{$line}),2)"; + } + $v['statement_money'] .= "S{$line}+"; + }else{ + $count['platform_amount'] += $val['pay_amount']; + $count['week_money'] += $val['sum_money']; + $count['sum_money'] += $val['sum_money']; + } } + } - if($is_export){ - //J3*(K3+L3)+M3-N3 - $va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}"; - $count['sum_money_exp'] .= "O{$line}+"; - $count['platform_amount_exp'] .= "J{$line}+"; - }else{ - $count['platform_amount'] += $va['pay_amount']; - $count['sum_money'] += $va['sum_money']; + + $v['row'] = $row; + + if ($v['row'] == '0') { + $v['row'] = 1; + } + + if($is_export){ + if($v['withdraw_type'] != 3) { +// $v['statement_money'] .="P{$cline}-Q{$cline},2)"; + $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1) . ",2)"; + } else { + $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)"; } } - $v['statement_count'] = count($v['statement_info']); - } if($is_export){ $count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+"); @@ -655,12 +895,13 @@ class PaymentController extends BaseController $id = $_REQUEST['id']; $remark = $_REQUEST['remark']; - if(empty(C("ALI_PAYMENT"))){ - $this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>["status"=>0]]); - } +// if(empty(C("ALI_PAYMENT"))){ +// $this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>["status"=>0]]); +// } // Vendor("Alipay2020/Fund"); // $fund = new \Fund(C("ALI_PAYMENT")); - $dbres = M("company_statement_info", "tab_")->where("id='{$id}'")->find(); + $dbres = M("pay_statement_info", "tab_")->where("id='{$id}'")->find(); + $company_info = json_decode($dbres['company_info'], true); if ($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1) { //执行打款 @@ -668,27 +909,50 @@ class PaymentController extends BaseController $amount = $dbres['statement_money']; // $payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title); // $resultCode = $payres->code; -// $savedata = ["id"=>$dbres['id']]; + $savedata = ["id"=>$dbres['id']]; if (!empty($resultCode)&&$resultCode == 10000) { $savedata["pay_status"]=1; } else { - $savedata["pay_status"]=-1; + $savedata["pay_status"]=1; } -// $payres = json_decode(json_encode($payres), true); -// $payres["remark"] = $remark; -// -// $savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE); -// $savedata["pay_type"]=2; -// $savedata["pay_time"]=time(); + $payres = json_decode(json_encode($payres), true); + $payres["remark"] = $remark; + + $savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE); + $savedata["pay_type"]=2; + $savedata["pay_time"]=time(); } + + M("pay_statement_info","tab_")->save($savedata); + if ($savedata["pay_status"] == -1) { $this->ajaxReturn(["success"=>"打款成功","data"=>["status"=>0]]); } -// M("company_statement_info","tab_")->save($savedata); + //支付详单bug修改 + $this->setPayVerifyStatus(1,$savedata["pay_type"],$id); $this->ajaxReturn(["success"=>"打款成功","data"=>["status"=>1]]); } + + /** + * 支付详单状态修改 + */ + public function setPayVerifyStatus($change_status,$pay_type,$id) { + + $pay_info = M("pay_statement_info","tab_")->where(['id'=>$id])->find(); + + $info = M("pay_statement_info","tab_")->where("statement_info_id = {$pay_info['statement_info_id']} AND pay_status <> 1")->find(); + + $dbres['pay_status'] = $change_status; + $dbres['pay_type'] = $pay_type; + $dbres['pay_time'] = time(); + if (empty($info)) { + M("company_statement_info","tab_")->where(['id'=>$pay_info['statement_info_id']])->save($dbres); + } + + } + /** * 执行最后聚合表统计 * 整合数据,全部成功则支付成功,否则为支付中 @@ -717,7 +981,7 @@ class PaymentController extends BaseController { if(!isset($_REQUEST['id'])) $this->error("参数错误"); $id = $_REQUEST['id']; - $info = M("company_statement_info","tab_")->field("pay_info")->where("id='{$id}'")->find()['pay_info']; + $info = M("pay_statement_info","tab_")->field("pay_info")->where("id='{$id}'")->find()['pay_info']; $info = json_decode($info,true); $senddata = []; foreach($info as $k => &$v){ @@ -758,7 +1022,7 @@ class PaymentController extends BaseController ($status == 1)?($status_str = '已审核通过'):($status_str = '已审核拒绝'); - $verify = M("pay_statement_info","tab_") + $verify = M("company_statement_info","tab_") ->where([ 'id'=>['in',$id] ]) diff --git a/Application/Payment/View/Payment/lists.html b/Application/Payment/View/Payment/lists.html index 181a5015b..6502d33ba 100644 --- a/Application/Payment/View/Payment/lists.html +++ b/Application/Payment/View/Payment/lists.html @@ -116,6 +116,16 @@ ::-webkit-scrollbar-thumb:active { cursor: pointer; } + + .triangle{ + width:0; + height:0; + border-top:10px solid blue; + border-left:8px solid transparent; + border-right:8px solid transparent; + border-bottom:0; + /*float: left;*/ + }