<?php

namespace app\common\model;
use \Think\Db;

class QuestionModel extends Base{
    protected $table = 'jr_question';
    
    protected function initialize(){
        parent::initialize();
    }
   
    // 随机取4题
    // public function get_rand( $where ){
    //     $query = "(SELECT * FROM jr_question WHERE  grade = ".$where['grade']."  AND lv = '".$where["lv"]."' and level = 0 ORDER BY rand() LIMIT 4) union all (SELECT * FROM jr_question WHERE  grade = ".$where['grade']."  AND lv = '".$where['lv']."' and level = 10 ORDER BY rand() LIMIT 1)";
    //     $list = Db::query($query);
    //     echo $this->getLastSql();
    //     return $list;
    // }
    
}