mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
增加访问记录功能
This commit is contained in:
44
app/model/PostVisit.php
Normal file
44
app/model/PostVisit.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class PostVisit extends Model
|
||||
{
|
||||
//
|
||||
|
||||
public function getAvatarSrcAttr()
|
||||
{
|
||||
$value = $this->getAttr('avatar');
|
||||
|
||||
if(empty($value)) {
|
||||
$value = '/static/images/avatar.png';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getNicknameTitleAttr()
|
||||
{
|
||||
$value = $this->getAttr('nickname');
|
||||
|
||||
if(empty($value)) {
|
||||
$value = 'IP用户:'.$this->getAttr('ip');
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getCreateTimeTitleAttr()
|
||||
{
|
||||
$value = $this->getData('create_time');
|
||||
|
||||
return show_time_ago($value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user