mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
36 lines
552 B
PHP
36 lines
552 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\model;
|
|
|
|
use app\index\controller\Common;
|
|
use think\Model;
|
|
|
|
/**
|
|
* @mixin \think\Model
|
|
*/
|
|
class PostComment extends Model
|
|
{
|
|
//
|
|
|
|
public function post()
|
|
{
|
|
return $this->belongsTo(Post::class, 'post_id');
|
|
}
|
|
|
|
public function getUserAttr()
|
|
{
|
|
return Common::getUserInfo($this->getData('user_uid'));
|
|
}
|
|
|
|
public function getReadUrlAttr()
|
|
{
|
|
$model_post = $this->getAttr('post');
|
|
|
|
$read_url = $model_post->read_url . '#comment-' . $this->getData('id');
|
|
|
|
return $read_url;
|
|
}
|
|
}
|