轮播图添加

wysf
ztt 9 months ago
parent 5b7134a327
commit 9cd2775be3
  1. 5
      app/common/model/Banner.php
  2. 2
      app/store/model/Banner.php

@ -42,5 +42,10 @@ class Banner extends BaseModel
->bind(['image_url' => 'preview_url']); ->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 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']); return self::preload($data, ['image']);
} }

Loading…
Cancel
Save