add($data); return $result; } /** * 获取评论 * @param $game_id * @param int $p * @return mixed * author: xmy 280564871@qq.com */ public function getComment($map,$p=0){ $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row = 10; $map['status'] = 1; $data = $this->field("account,create_time,comment,game_id")->where($map)->order("create_time desc")->page($page,$row)->select(); foreach ($data as $key => $val){ $user = D("User")->getUserInfo($val['account']); $data[$key]['nickname'] = $user['nickname']; $data[$key]['head_img'] = $user['head_img'];//get_img_url(get_game_icon_id($val['game_id'])); } $result['data'] = $data; $result['count'] = $this->where($map)->count(); return $result; } /** * 获取所有评论 * @param $game_id * @param int $p * @return mixed * author: xmy 280564871@qq.com */ public function getCommentall($map,$p=0){ $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row = 10; $map['status'] = 1; $data = $this->field("account,create_time,comment,game_id")->where($map)->order("create_time desc")->page($page,$row)->select(); foreach ($data as $key => $val){ $data[$key]['game_name'] = get_game_name($val['game_id']); $data[$key]['head_img'] = get_img_url(get_game_icon_id($val['game_id'])); } $result['data'] = $data; $result['count'] = $this->where($map)->count(); return $result; } }