<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 竞投热搜词功能
 *
 * 
 */
class hotword_model extends MY_Model
{
	/**
	 * 初始化竞投热搜词数据库和缓存使用
	 *
	 */
	public function __construct() 
	{
        parent::__construct(1,1,0);
	}

	/**
	 * 获取微信二维码信息
	 *
	 */
	public function getHotWordData($type = 1)
	{
		$key = GB_CITY.'HotWordData'.$type;
        $this->mc->delete($key);
        $cache = $this->mc->get($key);

        if($cache['isok'] == 1)
        {
            $data = $cache['data'];
        }
        else
        {
			$growth_bid_hotsearch_set_info = $this->dbback->query("select words from growth_bid_hotsearch_set where type='".$type."' order by position desc limit 0,20")->result_array();
			
			$data = array();
            if(!empty($growth_bid_hotsearch_set_info))
			{
				foreach($growth_bid_hotsearch_set_info as $key => $item)
				{
					$data[] = $item['words'];
				}
			}

			$this->mc->set($key, array('isok'=>1, 'data'=>$data), 86400);
        }

        return $data;
	}
}
?>