From 296b5a0d8f2ef078e4875eca6ef67eb8e0356cb7 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Sat, 11 Jul 2020 17:27:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=B3=E7=B3=BB=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PartnerController.class.php | 20 +++----- .../Model/CompanyRelationModel.class.php | 51 ++++++++++++++++--- 2 files changed, 52 insertions(+), 19 deletions(-) diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index 05028576c..b19187062 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -145,19 +145,12 @@ class PartnerController extends ThinkController $parseData = array(); foreach ($partners as $key =>$value) { $tmpr = D("CompanyRelation")->getCompanyRelation(1,$value['id']); - if(!$tmpr){ - $value['settlement_type'] = '未配置'; - $value['is_collection'] = "未配置"; - }else{ - $value['is_collection'] = $tmpr['collection'] ? '是' : '否'; - if ($tmpr['settlement_type'] == 1) { - $value['settlement_type'] = '周结'; - } elseif ($tmpr['settlement_type'] == 2) { - $value['settlement_type'] = '月结'; - }else{ - $value['settlement_type'] = '无'; - } - } + + $value['is_collection'] = $tmpr['collection']; + $value['settlement_type'] = $tmpr['settlement_type']; + $value['invoice_type'] = $tmpr['invoice_type']; + $value['invoice_content'] = $tmpr['invoice_content']; + $value['game'] = $parseGames[$value['id']]; $value['has_advance_charge'] = $value['has_advance_charge'] ? '是' : '否'; $value['channel_rate'] *= 100; @@ -173,6 +166,7 @@ class PartnerController extends ThinkController $value['row'] = empty($row2) ? 1: $row2; $parseData[] = $value; } + dd($parseData); if($is_export){ $this->assign('listData', $parseData); $GetData = $_GET; diff --git a/Application/Admin/Model/CompanyRelationModel.class.php b/Application/Admin/Model/CompanyRelationModel.class.php index ba097fc33..c5988fa8a 100644 --- a/Application/Admin/Model/CompanyRelationModel.class.php +++ b/Application/Admin/Model/CompanyRelationModel.class.php @@ -11,22 +11,61 @@ class CompanyRelationModel extends Model // 数据表前缀 protected $tablePrefix = 'tab_'; public $InvoiceType=[ + "0"=>"无", "1"=>"专票", "2"=>"普票" ]; - //返回公司基础信息 - public function getCompanyRelation($company_type,$company_id) + public $SettlementType=[ + "0"=>"无", + "1"=>"周结", + "2"=>"月结" + ]; + public $empty = "--"; + + /** + * 返回公司基础信息 + * + * @param [type] $company_type 公司类型 + * @param [type] $company_id 公司id + * @param boolean $type true:返回映射后的中午,false:返回原字段 + * @return void + */ + public function getCompanyRelation($company_type,$company_id,$type = true) { $res = $this->where("(first_company_type = '{$company_type}' AND first_company_id = '{$company_id}') OR (second_company_type = '{$company_type}' AND second_company_id = '{$company_id}')")->find(); if(empty($res)){ - return false; + if($type){ + $senddata = [ + 'company_id'=>$company_id, + "is_payment"=>$this->empty, + "collection"=>$this->empty, + "invoice_type"=>$this->empty, + "invoice_content"=>$this->empty, + "settlement_type"=>$this->empty + ]; + }else{ + return false; + } }else{ + $senddata = [ + 'company_id'=>$company_id, + "is_payment"=>$res['is_payment'], + "invoice_content"=>$res['invoice_content'] + ]; if($res["first_company_type"] == $company_type){ - $s = ($res['collection'] == 1 ? 1 :0); + $s = ($res['collection'] == 1 ? "是" : "否"); + }else{ + $s = ($res['collection'] == 2 ? "是" : "否"); + } + $senddata["collection"] = $s; + if($type){ + $senddata["invoice_type"] = $this->InvoiceType[$res['invoice_type']]; + $senddata["settlement_type"] = $this->SettlementType[$res['settlement_type']]; }else{ - $s = ($res['collection'] == 2 ? 1 :0); + $senddata["invoice_type"] = $res['invoice_type']; + $senddata["settlement_type"]=$res['settlement_type']; } - return ['company_id'=>$company_id,"settlement_type"=>$res['settlement_type'],"collection"=>$s,"invoice_type"=>$this->InvoiceType[$res['invoice_type']],"invoice_content"=>$res['invoice_content'],"is_payment"=>$res['is_payment']]; } + return $senddata; } } \ No newline at end of file