From b41294a3ea9c847ca748dbfd8429fd862251f3dc Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 13 Dec 2023 14:36:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/contract/SubcontractingContractLogic.php | 1 + app/adminapi/logic/custom/CustomContactsLogic.php | 4 +++- app/common/model/contract/SubcontractingContract.php | 10 +++++----- app/common/model/custom/CustomContacts.php | 5 +++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/adminapi/logic/contract/SubcontractingContractLogic.php b/app/adminapi/logic/contract/SubcontractingContractLogic.php index 4e2858df7..3c011afe7 100644 --- a/app/adminapi/logic/contract/SubcontractingContractLogic.php +++ b/app/adminapi/logic/contract/SubcontractingContractLogic.php @@ -162,6 +162,7 @@ class SubcontractingContractLogic extends BaseLogic { $subcontractingContract = SubcontractingContract::findOrEmpty($params['id']); $subcontractingContract->project = $subcontractingContract->project; + $subcontractingContract->work = $subcontractingContract->work; return $subcontractingContract->toArray(); } } \ No newline at end of file diff --git a/app/adminapi/logic/custom/CustomContactsLogic.php b/app/adminapi/logic/custom/CustomContactsLogic.php index 4ce40be75..1734c2de4 100644 --- a/app/adminapi/logic/custom/CustomContactsLogic.php +++ b/app/adminapi/logic/custom/CustomContactsLogic.php @@ -115,6 +115,8 @@ class CustomContactsLogic extends BaseLogic */ public static function detail($params): array { - return CustomContacts::with(['customName'])->findOrEmpty($params['id'])->toArray(); + $customContacts = CustomContacts::findOrEmpty($params['id']); + $customContacts->custom = $customContacts->custom; + return $customContacts->toArray(); } } \ No newline at end of file diff --git a/app/common/model/contract/SubcontractingContract.php b/app/common/model/contract/SubcontractingContract.php index 5aa6ed1bd..45e504028 100644 --- a/app/common/model/contract/SubcontractingContract.php +++ b/app/common/model/contract/SubcontractingContract.php @@ -30,16 +30,16 @@ class SubcontractingContract extends BaseModel protected $name = 'subcontracting_contract'; protected $deleteTime = 'delete_time'; - public function project() - { - return $this->belongsTo(\app\common\model\project\Project::class, 'project_id'); - } - public function getSigningDateAttr($value) { return empty($value) ? '' : date('Y-m-d H:i:s', $value); } + public function project() + { + return $this->belongsTo(\app\common\model\project\Project::class, 'project_id'); + } + public function work() { return $this->hasMany(\app\common\model\contract\SubcontractingContractDetail::class, 'subcontracting_contract_id', 'id'); diff --git a/app/common/model/custom/CustomContacts.php b/app/common/model/custom/CustomContacts.php index eaaebefbe..2ad0853e8 100644 --- a/app/common/model/custom/CustomContacts.php +++ b/app/common/model/custom/CustomContacts.php @@ -42,4 +42,9 @@ class CustomContacts extends BaseModel return $this->hasOne(\app\common\model\custom\Custom::class, 'id', 'custom_id')->bind(['custom_name'=>'name']); } + public function custom() + { + return $this->belongsTo(\app\common\model\custom\Custom::class, 'custom_id'); + } + } \ No newline at end of file