| 123456789101112131415161718192021222324252627 |
- <?php
- /**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2019/1/11
- * Time: 9:50
- */
- namespace App\Modules\YunQi\Services;
- use App\Modules\YunQi\Models\YqZsyTest;
- class YqZsyTestService
- {
- public static function getRandomBooks($num=1):array{
- $books = YqZsyTest::select('bid')->where('type','yunqi')->get();
- if($books->count()<=0){
- return [];
- }
- $num = $books->count()>$num ?$num:$books->count();
- return $books->random($num)->pluck('bid')->all();
- }
- public static function getByBid($bid){
- return YqZsyTest::where('bid',$bid)->select('id','bid','type')->first();
- }
- }
|