Browse Source

ip地址返回优化

author
wanghongjun 8 months ago
parent
commit
13a1513308
  1. 12
      app/enterprise/controller/Posts.php

12
app/enterprise/controller/Posts.php

@ -74,7 +74,11 @@ class Posts extends BaseController
$item['location_address'] = '';
if ($item['location']) {
$item['location_address'] = trim(implode(" ", array_unique(\Ip::find($item['location']))));
$ipArr = \Ip::find($item['location']);
if (is_array($ipArr)) {
$ipArr = array_unique($ipArr);
}
$item['location_address'] = trim(implode(" ", $ipArr));
}
$item['files'] = PostsFile::getPostsFile($item['id']);
@ -300,7 +304,11 @@ class Posts extends BaseController
$data = PostsModel::where($existsWhere)->field($field)->find()->toArray();
if ($data) {
if ($data['location']) {
$data['location_address'] = trim(implode(" ", array_unique(\Ip::find($data['location']))));
$ipArr = \Ip::find($data['location']);
if (is_array($ipArr)) {
$ipArr = array_unique($ipArr);
}
$data['location_address'] = trim(implode(" ", $ipArr));
}
$fileWhere = [
'posts_id' => $data['posts_id'],

Loading…
Cancel
Save