<?php
/**
 * Created by PhpStorm.
 * User: xmy 280564871@qq.com
 * Date: 2017/4/14
 * Time: 19:45
 */

namespace Admin\Model;


class CommentModel extends TabModel
{

	public function getLists($map = "", $order = "create_time desc", $p = 1)
	{
		$page = intval($p);
		$page = $page ? $page : 1; //默认显示第一页数据
		$row = 10;
		$data['data'] = $this
			->where($map)
			->order($order)
			->page($page, $row)
			->select();
		$data['count'] = $this->where($map)->count();
		return $data;
	}
	
	
	/*
	 * 未审核评论列表
	 * @return array   检测结果数据集
	 * @author 鹿文学
	 */
	public function checkComment() {
		
		$list = $this->field('id,account,game_id')
		
				->where(array('status'=>0))->select();
		$type = 404;
		if ($list[0]) {
			
			$list = D('check')->dealWithCheckList($type,$list);
			
			if (empty($list[0])) {return '';}
			
			foreach ($list as $k => $v) {
				$data[$k]['info'] = '玩家:'.$v['account'].',评论未审核';				
				$data[$k]['type'] = $type;
				$data[$k]['url'] = U('Comment/lists',array('account'=>$v['account'],'game_id'=>$v['game_id'],'status'=>0));
				$data[$k]['create_time'] = time();
				$data[$k]['status']=0;
				$data[$k]['position'] = $v['id'];
			}
			return $data;
		}else {
			D('check')->dealWithCheckListOnNull($type);
			return '';
		}
		
	}
	
	
}