mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
优化IP显示
This commit is contained in:
@@ -4,6 +4,7 @@ declare (strict_types=1);
|
|||||||
|
|
||||||
namespace app\model;
|
namespace app\model;
|
||||||
|
|
||||||
|
use think\facade\Request;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +30,15 @@ class PostVisit extends Model
|
|||||||
$value = $this->getAttr('nickname');
|
$value = $this->getAttr('nickname');
|
||||||
|
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
$value = 'IP用户:'.$this->getAttr('ip');
|
$current_ip = Request::ip();
|
||||||
|
|
||||||
|
$ip = $this->getAttr('ip');
|
||||||
|
|
||||||
|
if ($current_ip == $ip) {
|
||||||
|
$value = '您的IP:' . $ip;
|
||||||
|
} else {
|
||||||
|
$value = 'IP用户:' . $ip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
|||||||
Reference in New Issue
Block a user