master
ELF 4 years ago
parent e4854aca3a
commit 296e378501

@ -496,6 +496,11 @@ class PartnerController extends ThinkController
}else{
$data['validity_end_time']='';
}
$selfCompanies = M('company_info', 'tab_')->field('id,partner company_name,link_man,link_phone')->where(['status' => 1])->select();
$this->assign('selfCompanies', $selfCompanies);
$this->assign('relation', $data['relation'] ?? null);
$this->assign('data', $data);
$this->assign('action', $action);

@ -15,11 +15,11 @@ class PartnerService
public function adminAgree($application)
{
$adminInfo = $_SESSION['onethink_admin']['user_auth'];
$application['verify_log'] = json_decode($application['verify_log'],true);
$application['verify_log']['verify_user'] = $admininfo["username"];
$application['verify_log'] = json_decode($application['verify_log'], true);
$application['verify_log']['verify_user'] = $adminInfo["username"];
$application['verify_log']['verify_time'] = date("Y-m-d H:i:s");
$application['verify_log'] = json_encode($application['verify_log']);
$application['verify_status']=1;
$application['verify_status'] = 1;
$application["create_time"] = time();
$partnerInfo = json_decode($application['partner_info'], true);
@ -43,15 +43,15 @@ class PartnerService
protected function saveRelation($relation, $company)
{
$selfCompany = M('company_info', 'tab_')->where(['id' => $relation['self_company_id']])->find();
$where = '(first_company_type=2 and first_company_id=' . $company['id'] .
') or (second_company_type=2 and second_company_id=' . $company['id'] . ')';
$relation = M('company_relation', 'tab_')->where($where)->find();
$where = '(first_company_type=1 and first_company_id=' . $company['id'] .
') or (second_company_type=1 and second_company_id=' . $company['id'] . ')';
$oldRelation = M('company_relation', 'tab_')->where($where)->find();
$data = [];
if ($relation['collaborate_way'] == 1) {
$data['first_company_id'] = $company['id'];
$data['first_company_name'] = $company['partner'];
$data['first_company_type'] = 2;
$data['first_company_type'] = 1;
$data['second_company_id'] = $selfCompany['id'];
$data['second_company_name'] = $selfCompany['partner'];
$data['second_company_type'] = 0;
@ -61,7 +61,7 @@ class PartnerService
$data['first_company_type'] = 0;
$data['second_company_id'] = $company['id'];
$data['second_company_name'] = $company['partner'];
$data['second_company_type'] = 2;
$data['second_company_type'] = 1;
}
$data['settlement_type'] = $relation['settlement_type'];
@ -69,8 +69,8 @@ class PartnerService
$data['collection'] = $relation['collection'];
$data['is_payment'] = $relation['is_payment'];
$data['invoice_content'] = $relation['invoice_content'];
if ($relation) {
M('company_relation', 'tab_')->where(['id' => $relation['id']])->save($data);
if ($oldRelation) {
M('company_relation', 'tab_')->where(['id' => $oldRelation['id']])->save($data);
} else {
M('company_relation', 'tab_')->add($data);
}

Loading…
Cancel
Save