<?php
/**
 * Created by PhpStorm.
 * User: z-yang
 * Date: 2019/6/14
 * Time: 15:21
 */

namespace App\Modules\Book\Services;

use App\Modules\Book\Models\SignBook;

class SignBookService
{
    public static function getRandomBook($sex,$num=2){
        $model = new SignBook();
        return $model->join('books','sign_book.bid','=','books.id')
            ->join('book_categories','books.category_id','=','book_categories.id')
            ->select('sign_book.bid','sign_book.desc','sign_book.name','books.first_cid','book_categories.category_name')
            ->get()
            ->random($num);
    }
}