<?php
class beautifulActivityModule extends commonModule
{
    public function __construct()
    {
        parent::__construct("sl_beaultiful_activity");
    }

    //查看活动是否开启
    public function ActivityIsOpen($time){
        $one = $this->findBySql("SELECT * FROM sl_beaultiful_activity WHERE start_time<'{$time}' AND end_time>'{$time}'");
        if (!empty($one[0])){
            $data['type'] = true;
            return $data;
        }else{
            $data['data'] = $this->orderBy('id desc')->one();
            $data['type'] = false;
            return $data;
        }
    }
    //随机获取八条靓号数据
    public function getList(){
        $data = $this->findBySql("SELECT * FROM sl_beautiful_number where is_sell=2 and type=1 ORDER BY  RAND() LIMIT 8");
        return $data;
    }
    public function getLists(){
        $time = date('Y-m-d H:i:s');
        $data = $this->findBySql("SELECT * FROM sl_beautiful_number where is_sell=2 and type=2 and sell_time>'{$time}' ORDER BY  sort desc LIMIT 8");
        return $data;
    }

}