<?php 
namespace Common\Model;
use Think\Model;
class FollowQuestionModel extends Model
{
	//统计关注数量
 	public function get_follow_count($qid='')
	{
		$map['qid']=intval($qid);
		$n=$this->where($map)->count();
		return $n;
	}
	//检测是否关注过
	public function chenk_follow_question($uid='',$qid='')
	{
		$map['uid']=intval($uid);
		$map['qid']=intval($qid);
		$n=$this->where($map)->count();
		if ($n)
		{
		return true;
		}
		return false;  
	}
 	//关注
	public function follow_question($uid='',$qid='')
	{
		$data['uid']=intval($uid);
		$data['qid']=intval($qid);
		$data['addtime']=time();
		$this->add($data);
		return true;  
	}
	//取消关注
	public function clear_follow_question($uid='',$qid='')
	{
		$map['uid']=intval($uid);
		$map['qid']=intval($qid);
		$this->where($map)->delete();
		return true;  
	}
}
?>