diff --git a/app/common/model/custom/CustomService.php b/app/common/model/custom/CustomService.php index c073f4c98..0c2947962 100644 --- a/app/common/model/custom/CustomService.php +++ b/app/common/model/custom/CustomService.php @@ -33,27 +33,27 @@ class CustomService extends BaseModel public function getDateAttr($value): string { - return empty($value) ? '' : date('Y-m-d', $value); + return !empty($value) ? date('Y-m-d', $value) : ''; } public function getDoneDateAttr($value): string { - return empty($value) ? '' : date('Y-m-d', $value); + return !empty($value) ? date('Y-m-d', $value) : ''; } public function getClassificationTextAttr($value,$data){ - $dictData = DictData::where('type_value','classification')->column('name','value'); - return $dictData[$data['classification']]; + $dict = DictData::where('type_value','classification')->column('name','value'); + return !empty($data['classification']) ? $dict[$data['classification']] : ''; } public function getUrgencyTextAttr($value,$data){ - $dictData = DictData::where('type_value','urgency')->column('name','value'); - return $dictData[$data['urgency']]; + $dict = DictData::where('type_value','urgency')->column('name','value'); + return !empty($data['urgency']) ? $dict[$data['urgency']] : ''; } public function getProcessingResultTextAttr($value,$data){ - $dictData = DictData::where('type_value','custom_service_solv_result')->column('name','value'); - return $dictData[$data['processing_result']]; + $dict = DictData::where('type_value','custom_service_solv_result')->column('name','value'); + return !empty($data['processing_result']) ? $dict[$data['processing_result']] : ''; } public function getIsSolveTextAttr($value,$data): string @@ -64,7 +64,7 @@ class CustomService extends BaseModel public function getAnnexAttr($value) { - return empty($value) ? null : json_decode($value,true); + return !empty($value) ? json_decode($value,true) : ''; } } \ No newline at end of file