From 87fbad724ae99ab321e4ca01528f883cdea9c007 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 21 Aug 2023 10:16:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/contract/ContractLogic.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/common/logic/contract/ContractLogic.php b/app/common/logic/contract/ContractLogic.php index 1f1bcd625..6cecbcb0b 100644 --- a/app/common/logic/contract/ContractLogic.php +++ b/app/common/logic/contract/ContractLogic.php @@ -125,7 +125,12 @@ class ContractLogic extends BaseLogic $field = ['id,company_name,company_type,company_type company_type_name,organization_code, province,city,area,street,village,brigade,address,province province_name,city city_name,area area_name,street street_name,village village_name,brigade brigade_name,master_phone,master_name, qualification']; - $company = Company::where(['id' => $data['party_b']])->field($field)->find()->toArray(); + $company = Company::where(['id' => $data['party_b']])->field($field)->find(); + if(empty($company)){ + return self ::setError('公司不存在'); + }else{ + $user=$company->toArray(); + } $company['qualification'] = json_decode($company['qualification'], true); if($company['qualification'] && isset($company['qualification']['other_qualifications'])){ $company['qualification']['other_qualifications']=json_decode($company['qualification']['other_qualifications'],true); @@ -135,7 +140,12 @@ class ContractLogic extends BaseLogic $filed = ['id,id_card,avatar,nickname,sex,mobile, province,city,area,street,village,brigade,address,province province_name,city city_name,area area_name,street street_name,village village_name,brigade brigade_name,nickname master_name, qualification']; - $user = User::where('id', $data['party_b'])->field($filed)->find()->toArray(); + $user = User::where('id', $data['party_b'])->field($filed)->find(); + if(empty($user)){ + return self ::setError('用户不存在'); + }else{ + $user=$user->toArray(); + } $user['qualification'] = json_decode($user['qualification'], true); if($user['qualification'] && isset($user['qualification']['other_qualifications'])){ $user['qualification']['other_qualifications']=json_decode($user['qualification']['other_qualifications'],true);