You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
PHTML
32 lines
1.1 KiB
PHTML
4 years ago
|
<?php
|
||
|
|
||
|
namespace Admin\Model;
|
||
|
|
||
|
use Think\Model;
|
||
|
|
||
|
class CompanyRelationModel extends Model
|
||
|
{
|
||
|
protected $db = 'company_relation';
|
||
|
|
||
|
// 数据表前缀
|
||
|
protected $tablePrefix = 'tab_';
|
||
|
public $InvoiceType=[
|
||
|
"1"=>"专票",
|
||
|
"2"=>"普票"
|
||
|
];
|
||
|
//返回公司基础信息
|
||
|
public function getCompanyRelation($company_type,$company_id)
|
||
|
{
|
||
|
$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;
|
||
|
}else{
|
||
|
if($res["first_company_type"] == $company_type){
|
||
|
$s = ($res['collection'] == 1 ? 1 :0);
|
||
|
}else{
|
||
|
$s = ($res['collection'] == 2 ? 1 :0);
|
||
|
}
|
||
|
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']];
|
||
|
}
|
||
|
}
|
||
|
}
|