55 lines
1.3 KiB
PHP
Executable File
55 lines
1.3 KiB
PHP
Executable File
<?php
|
|
namespace app\model;
|
|
|
|
/**
|
|
* 朋友圈评论模型
|
|
* @property integer $id 主键(ID)
|
|
* @property integer $circle_id 朋友圈动态ID
|
|
* @property integer $user_id 用户ID
|
|
* @property integer $reply_user_id 回复的用户ID(0表示直接评论)
|
|
* @property string $body 评论内容
|
|
* @property integer $created_at 创建时间
|
|
* @property integer $updated_at 更新时间
|
|
* @property integer $status 状态(0:隐藏 1:正常)
|
|
*/
|
|
class FriendCircleComment extends Base
|
|
{
|
|
protected $name = 'friend_circle_comment';
|
|
protected $autoWriteTimestamp = true;
|
|
|
|
protected function getOptions(): array
|
|
{
|
|
return array_merge(parent::getOptions(), [
|
|
'insert' => [
|
|
'status' => 1,
|
|
'reply_user_id' => 0,
|
|
],
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 关联朋友圈动态
|
|
*/
|
|
public function circle()
|
|
{
|
|
return $this->belongsTo('\\app\\model\\FriendCircle', 'circle_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* 关联评论用户
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo('\\app\\model\\User', 'user_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* 关联被回复的用户
|
|
*/
|
|
public function replyUser()
|
|
{
|
|
return $this->belongsTo('\\app\\model\\User', 'reply_user_id', 'id');
|
|
}
|
|
}
|
|
|