RecoBannerService.php 560 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: z-yang
  5. * Date: 2019/7/23
  6. * Time: 14:47
  7. */
  8. namespace App\Modules\Book\Services;
  9. use App\Modules\Book\Models\RecoBanner;
  10. class RecoBannerService
  11. {
  12. public function getByType(array $reco_type, int $type)
  13. {
  14. return RecoBanner::whereIn('reco_type', $reco_type)
  15. ->where('start_time', '<=', date('Y-m-d H:i:s'))
  16. ->where('end_time', '>=', date('Y-m-d H:i:s'))
  17. ->where('type', $type)
  18. ->select('id','redirect_url', 'banner_url')
  19. ->get();
  20. }
  21. }