У меня есть комментарии строки в базе данных, которая содержит все комментарии к объявлениям. /> < /p>
Моя проблема заключается в дублированном комментарии к рекламе, поэтому, если пользователь передает комментарий к объявлению, сценарий ответит ему текстом «Спасибо за комментарий». /> Мой код такой: < /p>
Код: Выделить всё
$comment_list = $this->basic->get_all_comment_of_ads($adsid);
$commenter_count=isset($comment_list["commenter_info"]) ? count($comment_list["commenter_info"]) : 0 ;
if(isset($comment_list["commenter_info"]))
{
if(isset($comment_list["commenter_info"][$ad_account_id]))
{
$commenter_count--; // if ad account is also commenter
unset($comment_list["commenter_info"][$ad_account_id]);
}
}
Как предотвратить ответ на комментарий от одного и того же комментария?
Код: Выделить всё
$i=0;
$commenter_info=array();
foreach($comment_list as $info){
$time= isset($info['created_time'])?(array)$info['created_time']:"";
$comment_info[$i]['created_time']=isset($time['date'])?$time['date']:"";
$comment_info[$i]['commenter_name']=isset($info['from']['name'])? $info['from']['name']:"";
$comment_info[$i]['commenter_id']=isset($info['from']['id'])?$info['from']['id']:"";
$comment_info[$i]['message']=isset($info['commente_text'])?$info['message']:"";
$comment_info[$i]['comment_id']=isset($info['id'])?$info['id']:"";
/* Store Commenter info as unique */
if(!isset($commenter_info[$comment_info[$i]['commenter_id']])){
$commenter_info[$comment_info[$i]['commenter_id']]['name']=$comment_info[$i]['commenter_name'];
$commenter_info[$comment_info[$i]['commenter_id']]['last_comment']=$comment_info[$i]['message'];
$commenter_info[$comment_info[$i]['commenter_id']]['last_comment_id']=$comment_info[$i]['comment_id'];
$commenter_info[$comment_info[$i]['commenter_id']]['last_comment_time']=$comment_info[$i]['created_time'];
}
$i++;
}
Я остановился на данный момент, и я не могу получить логику о том, как получить комментатор_ид и сохранить его, чтобы проверить, дублировался ли комментарий.>
Подробнее здесь: https://stackoverflow.com/questions/775 ... ue-results
Мобильная версия