<?php
/**
 * Created by PhpStorm.
 * User: xiaofeng
 * Date: 2018/3/4
 * Time: 上午9:25
 */

namespace common\models;

class HouseCommentreply extends Common
{

	 public function rules()
     {
        return [
            [['cid','reply_content'],'required','message'=>'{attribute}不能为空'],
            ['reply_content','string','max'=>200],
            ['label','in','range'=>[1,2]],
            ['label','integer','max'=>1],
        ];
     }

    public function attributeLabels()
    {
        return [
           'cid'=>'点评',
            'reply_content'=>'点评内容',
            'label'=>'标签'
        ];
    }


    public function FindById($id)
    {
        return self::findOne($id);
    }

    public function getCommentReply($comment_id){
	     $query = self::find();
	     $row = $query->andWhere(['cid' => $comment_id])->orderBy(['create_at'=>SORT_DESC])->one();
	     if(!empty($row)){
	         return $row['reply_content'];
         }
         return null;
    }

}