@ -42,5 +42,10 @@ class Banner extends BaseModel
->bind(['image_url' => 'preview_url']);
}
public function activeInfo(): HasOne
{
return $this->hasOne('ActiveMain', 'id', 'redirect_url');
@ -28,7 +28,7 @@ class Banner extends BannerModel
*/
public function getList(): \think\Paginator
$data = $this->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate();
$data = $this->with(['activeInfo'])->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate();
return self::preload($data, ['image']);