diff --git a/app/api/model/ActiveCol.php b/app/api/model/ActiveCol.php index 51bfa851..3d420357 100644 --- a/app/api/model/ActiveCol.php +++ b/app/api/model/ActiveCol.php @@ -20,7 +20,15 @@ use app\common\model\ActiveCol as ActiveColModel; */ class ActiveCol extends ActiveColModel { + //追加字段 + protected $append = [ + 'col_pic' + ]; + public function getColPicAttr($value, $data) { + $file = $this->with(['colImage'])->find(); + return $file['col_image_url']; + } } diff --git a/app/api/model/ActiveMain.php b/app/api/model/ActiveMain.php index 4934e2d1..8e07748e 100644 --- a/app/api/model/ActiveMain.php +++ b/app/api/model/ActiveMain.php @@ -42,11 +42,11 @@ class ActiveMain extends ActiveMainModel public function getIndexIconAttr($value, $data) { $file = $this->with('indexImage')->find(); - return $file['indexImage']['preview_url']; + return $file['index_image_url']; } public function getThemePicAttr($value, $data) { $file = $this->with('themeImage')->find(); - return $file['themeImage']['preview_url']; + return $file['theme_image_url']; } }