From 7e81dc2af0097c5a5ca98a530e41c89a20002476 Mon Sep 17 00:00:00 2001 From: wang hou sheng <76928547+wanghousheng@users.noreply.github.com> Date: Sun, 21 Apr 2024 16:12:46 +0800 Subject: [PATCH] 1 --- app/api/model/ActiveMain.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/api/model/ActiveMain.php b/app/api/model/ActiveMain.php index 4baaa967..0ffda7a9 100644 --- a/app/api/model/ActiveMain.php +++ b/app/api/model/ActiveMain.php @@ -13,7 +13,6 @@ declare (strict_types=1); namespace app\api\model; use app\common\model\ActiveMain as ActiveMainModel; -use think\model\relation\HasMany; /** * 活动模型类 @@ -32,7 +31,8 @@ class ActiveMain extends ActiveMainModel ]; - public function getList($param) { + public function getList($param) + { return $this->with('col.colImage') ->where('status', '=', 1) ->where('id', $param['active_id']) @@ -40,13 +40,15 @@ class ActiveMain extends ActiveMainModel } - public function getIndexIconAttr($value, $data) { + public function getIndexIconAttr($value, $data) + { $file = $this->with('indexImage')->find(); - return $file['index_image_url']; + return !empty($file['index_image_url']) ? $file['index_image_url'] : ''; } - public function getThemePicAttr($value, $data) { + public function getThemePicAttr($value, $data) + { $file = $this->with('themeImage')->find(); - return $file['theme_image_url']; + return !empty($file['theme_image_url']) ? $file['theme_image_url'] : ''; } }