From 28eedef4ed4ceda637d3411491b20ea5f1d34af2 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 19 Jan 2021 16:05:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=94=AF=E4=BB=98=E5=AE=9D?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PaymentController.class.php | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 45b3e7f79..01ebd1997 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -236,18 +236,8 @@ class PaymentController extends BaseController public function IsCanChangeCompanyInfo($id = 0) { //获取原值 - $oldInfo = M("company_statement_info","tab_")->field("company_info,company_id,company_type,company_name")->where("id = {$id}")->find(); - if(empty($oldInfo)){ - $this->ajaxReturn(['status' =>0 ,'msg'=>'未找到此结算单信息','data'=>[]]); - } + list($oldInfo, $newCompanyInfo) = $this->getStatementCompanyInfo($id); $oldCompanyInfo = json_decode($oldInfo['company_info'],true); - //获取新值 - if($oldInfo['company_type'] == 3){ - $Model = M("partner","tab_"); - }else{ - $Model = M("promote_company","tab_"); - } - $newCompanyInfo = $Model->field("ali_user,ali_account")->where("id = {$oldInfo['company_id']}")->find(); if( ($oldCompanyInfo['ali_user'] == $newCompanyInfo['ali_user']) && ($oldCompanyInfo['ali_account'] == $newCompanyInfo['ali_account']) ){ $this->ajaxReturn(['status' =>0 ,'msg'=>'支付宝打款信息已是最新,无需更新','data'=>[]]); } @@ -264,29 +254,21 @@ class PaymentController extends BaseController public function DoChangeCompanyInfo() { $id = I("post.id",0); - $oldInfo = M("company_statement_info","tab_")->field("id,company_info,company_id,company_type,company_name,pool_id,withdraw_type")->where("id = {$id}")->find(); - $oldCompanyInfo = json_decode($oldInfo['company_info'],true); - //获取新值 - if($oldInfo['company_type'] == 3){ - $Model = M("partner","tab_"); - }else{ - $Model = M("promote_company","tab_"); - } - $newCompanyInfo = $Model->field("ali_user,ali_account")->where("id = {$oldInfo['company_id']}")->find(); + list($oldInfo, $newCompanyInfo) = $this->getStatementCompanyInfo($id); //子单修改 $sWhere = [ 'company_id' => $oldInfo['company_id'], 'pay_status'=> ['neq',1], 'statement_info_id' => $id ]; - $StatementDB = M("pay_statement_info","tab_"); - $statementInfo = $StatementDB + $PayStatementDB = M("pay_statement_info","tab_"); + $statementInfo = $PayStatementDB ->where($sWhere) ->field('id,company_info') ->select(); foreach ($statementInfo as $k => $v) { $v['company_info'] = $this->changeAliInfo($v['company_info'],$newCompanyInfo); - $StatementDB->save($v); + $PayStatementDB->save($v); } //修改结算单 if($oldInfo['company_type'] != 2 || $oldInfo['withdraw_type'] == 3){ @@ -312,6 +294,22 @@ class PaymentController extends BaseController $this->ajaxReturn(['status' =>1 ,'msg'=>'支付信息更新成功','data'=>[]]); } + //获取新旧公司信息 + protected function getStatementCompanyInfo($id = 0){ + $oldInfo = M("company_statement_info","tab_")->field("id,company_info,company_id,company_type,company_name,pool_id,withdraw_type")->where("id = {$id}")->find(); + if(empty($oldInfo)){ + $this->ajaxReturn(['status' =>0 ,'msg'=>'未找到此结算单信息','data'=>[]]); + } + //获取新值 + if($oldInfo['company_type'] == 3){ + $Model = M("partner","tab_"); + }else{ + $Model = M("promote_company","tab_"); + } + $newCompanyInfo = $Model->field("ali_user,ali_account")->where("id = {$oldInfo['company_id']}")->find(); + return [$oldInfo,$newCompanyInfo]; + } + //改变支付宝信息 protected function changeAliInfo($item,$newInfo) { $companyInfo = json_decode($item,true);