<?php

/**
 * Created by PhpStorm.
 * User: z-yang
 * Date: 2019/7/23
 * Time: 14:47
 */

namespace App\Modules\Book\Services;

use App\Modules\Book\Models\RecoBanner;

class RecoBannerService
{
    public function getByType(array $reco_type, int $type)
    {
        return RecoBanner::whereIn('reco_type', $reco_type)
            ->where('start_time', '<=', date('Y-m-d H:i:s'))
            ->where('end_time', '>=', date('Y-m-d H:i:s'))
            ->where('type', $type)
            ->select('redirect_url', 'banner_url')
            ->get();
    }
}
