You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
990 B
35 lines
990 B
<?php
|
|
|
|
namespace app\enterprise\model;
|
|
|
|
use think\Model;
|
|
|
|
class Comment extends Model
|
|
{
|
|
|
|
public static function getPostsComment($relevance_id, $uid, $userIdArr = [])
|
|
{
|
|
$playWhere = [
|
|
['type', '=', 1],
|
|
['relevance_id', '=', $relevance_id],
|
|
['user_id', 'in', $userIdArr]
|
|
];
|
|
|
|
$comment = self::where($playWhere)->field('id,content,user_id,reply_user_id')->select();
|
|
foreach ($comment as &$commentValue) {
|
|
|
|
$friend = Friend::getFriendName($uid, $commentValue['user_id']);
|
|
$commentValue['nickname'] = $friend['nickname'];
|
|
|
|
$commentValue['reply_user_name'] = '';
|
|
if ($commentValue['reply_user_id']) {
|
|
$friend = Friend::getFriendName($uid, $commentValue['reply_user_id']);
|
|
$commentValue['reply_user_name'] = $friend['nickname'];
|
|
}
|
|
|
|
unset($commentValue['reply_user_id']);
|
|
}
|
|
return $comment;
|
|
}
|
|
|
|
}
|