mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-04 00:24:29 +08:00
ip脱敏处理
This commit is contained in:
@@ -42,7 +42,7 @@ class PostVisit extends Model
|
|||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
$current_ip = Request::ip();
|
$current_ip = Request::ip();
|
||||||
|
|
||||||
$ip = $this->getAttr('ip');
|
$ip = $this->getAttr('ip_title');
|
||||||
|
|
||||||
if ($current_ip == $ip) {
|
if ($current_ip == $ip) {
|
||||||
$value = '您的IP:' . $ip;
|
$value = '您的IP:' . $ip;
|
||||||
@@ -54,6 +54,24 @@ class PostVisit extends Model
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIpTitleAttr()
|
||||||
|
{
|
||||||
|
$value = $this->getAttr('ip');
|
||||||
|
|
||||||
|
if (empty($value)) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ip_pieces = explode('.', $value);
|
||||||
|
|
||||||
|
$ip_pieces = array_slice($ip_pieces, 0, -2);
|
||||||
|
|
||||||
|
$ip_pieces[] = '*';
|
||||||
|
$ip_pieces[] = '*';
|
||||||
|
|
||||||
|
return implode('.', $ip_pieces);
|
||||||
|
}
|
||||||
|
|
||||||
public function getCreateTimeTitleAttr()
|
public function getCreateTimeTitleAttr()
|
||||||
{
|
{
|
||||||
$value = $this->getData('create_time');
|
$value = $this->getData('create_time');
|
||||||
|
|||||||
Reference in New Issue
Block a user