@@ -88,12 +99,30 @@ function comments($newsid, $num) {
$list=[];
while($row=$empire->fetchassoc($query)){
$row['reply']=replyComments($row['id']);
$list[]=handelcomment($row);
}
returnmsg(true,'',$list);
}
//回复的评论
functionreplyComments($plid){
global$empire,$dbtbpre;
$tablecomment=$dbtbpre.'ecms_comments';
$tablemember=$dbtbpre.'enewsmember';
$sql="select c.content,c.created_at,u.nickname,u.username from $tablecomment c left join {$tablemember} u on c.user_id=u.userid where reply_id={$plid}";
$query=$empire->query($sql);
$list=[];
while($row=$empire->fetchassoc($query)){
$list[]=handelcomment($row);
}
return$list;
}
//获取评论
functioncomment($id){
global$empire,$dbtbpre;
...
...
@@ -101,11 +130,13 @@ function comment($id) {
$tablemember=$dbtbpre.'enewsmember';
$sql="select c.*,u.avatar,u.nickname,u.username from $tablecomment c left join {$tablemember} u on c.user_id=u.userid where c.id={$id} limit 1";