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'] : ''; } }