From c2e2ae73ef1b817b6c0e51224805cabfba4182ff Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 13 Dec 2023 13:40:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=A2=E6=9C=8D=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/custom_service/CustomServiceLogic.php | 5 ++++- app/common/model/custom_service/CustomService.php | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/adminapi/logic/custom_service/CustomServiceLogic.php b/app/adminapi/logic/custom_service/CustomServiceLogic.php index 79fe53a3b..5eb4f40e4 100644 --- a/app/adminapi/logic/custom_service/CustomServiceLogic.php +++ b/app/adminapi/logic/custom_service/CustomServiceLogic.php @@ -127,6 +127,9 @@ class CustomServiceLogic extends BaseLogic */ public static function detail($params): array { - return CustomService::findOrEmpty($params['id'])->toArray(); + $customService = CustomService::findOrEmpty($params['id']); + $customService->project = $customService->project; + $customService->custom = $customService->custom; + return $customService->toArray(); } } \ No newline at end of file diff --git a/app/common/model/custom_service/CustomService.php b/app/common/model/custom_service/CustomService.php index 4a4151c71..b4cad227d 100644 --- a/app/common/model/custom_service/CustomService.php +++ b/app/common/model/custom_service/CustomService.php @@ -35,4 +35,14 @@ class CustomService extends BaseModel return empty($value) ? '' : date('Y-m-d H:i:s', $value); } + public function custom() + { + return $this->belongsTo(\app\common\model\custom\Custom::class, 'custom_id'); + } + + public function project() + { + return $this->belongsTo(\app\common\model\project\Project::class, 'project_id'); + } + } \ No newline at end of file