Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
dfd4efc6
Commit
dfd4efc6
authored
Sep 18, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
18d19cbe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
33 deletions
+35
-33
Location.php
application/api_broker/controller/Location.php
+35
-33
No files found.
application/api_broker/controller/Location.php
View file @
dfd4efc6
...
@@ -31,24 +31,24 @@ class Location extends Basic
...
@@ -31,24 +31,24 @@ class Location extends Basic
public
function
saveSiteCity
()
public
function
saveSiteCity
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/* $params = array(
/* $params = array(
"agent_id" => 1,
"agent_id" => 1,
"city" => "上海市"
"city" => "上海市"
);*/
);*/
/* $checkResult = $this->validate($params, "LocationValidate.saveSiteCityVerify");
/* $checkResult = $this->validate($params, "LocationValidate.saveSiteCityVerify");
if (true !== $checkResult) {
if (true !== $checkResult) {
return $this->response("101", $checkResult);
return $this->response("101", $checkResult);
}
}
$city = "上海市";
$city = "上海市";
$agent_id = $params["agent_id"];
$agent_id = $params["agent_id"];
if ($params["city"] == "杭州市" || $params["city"] == "杭州") {
if ($params["city"] == "杭州市" || $params["city"] == "杭州") {
$city = "杭州市";
$city = "杭州市";
}
}
if ($this->redis_) {
if ($this->redis_) {
$this->redis_->set(self::CITY_AGENTS . $agent_id, $city);
$this->redis_->set(self::CITY_AGENTS . $agent_id, $city);
} else {
} else {
return $this->response("101", "redis service not found");
return $this->response("101", "redis service not found");
}*/
}*/
return
$this
->
response
(
"200"
,
"success"
,
[]);
return
$this
->
response
(
"200"
,
"success"
,
[]);
...
@@ -61,7 +61,7 @@ class Location extends Basic
...
@@ -61,7 +61,7 @@ class Location extends Basic
*/
*/
public
function
addLocation
()
public
function
addLocation
()
{
{
$code
=
101
;
$code
=
101
;
$params
=
&
$this
->
params
;
$params
=
&
$this
->
params
;
if
(
!
isset
(
$params
[
'longitude'
])
||
!
isset
(
$params
[
'latitude'
])
||
if
(
!
isset
(
$params
[
'longitude'
])
||
!
isset
(
$params
[
'latitude'
])
||
!
isset
(
$params
[
'source'
])
!
isset
(
$params
[
'source'
])
...
@@ -73,14 +73,15 @@ class Location extends Basic
...
@@ -73,14 +73,15 @@ class Location extends Basic
return
$this
->
response
(
$code
,
'账号异常'
);
return
$this
->
response
(
$code
,
'账号异常'
);
}
}
$m_location
=
new
ALocationListModel
();
$m_location
=
new
ALocationListModel
();
$position_service
=
new
PositionService
();
$position_service
=
new
PositionService
();
$s_redis
=
new
RedisCacheService
();
$s_redis
=
new
RedisCacheService
();
$where
[
'agent_id'
]
=
$params
[
'agent_id'
];
$where
[
'agent_id'
]
=
$params
[
'agent_id'
];
$data
=
$m_location
->
findData
(
'longitude,latitude'
,
$where
,
'id desc'
);
$where
[
'location_date'
]
=
date
(
"Y-m-d"
,
time
());
$data
=
$m_location
->
findData
(
'longitude,latitude'
,
$where
,
'id desc'
);
if
(
$params
[
'longitude'
]
.
$params
[
'latitude'
]
==
$data
[
'longitude'
]
.
$data
[
'latitude'
])
{
if
(
$params
[
'longitude'
]
.
$params
[
'latitude'
]
==
$data
[
'longitude'
]
.
$data
[
'latitude'
])
{
return
$this
->
response
(
101
,
'经纬度重复'
);
return
$this
->
response
(
101
,
'经纬度重复'
);
}
}
...
@@ -94,24 +95,25 @@ class Location extends Basic
...
@@ -94,24 +95,25 @@ class Location extends Basic
$agent_data
=
$s_redis
->
getRedisCache
(
2
,
$params
[
'agent_id'
]);
$agent_data
=
$s_redis
->
getRedisCache
(
2
,
$params
[
'agent_id'
]);
if
(
empty
(
$params
[
'source'
]))
{
if
(
empty
(
$params
[
'source'
]))
{
$save_data
[
"source"
]
=
0
;
$save_data
[
"source"
]
=
0
;
$save_data
[
"source_id"
]
=
0
;
$save_data
[
"source_id"
]
=
0
;
}
else
{
}
else
{
$save_data
[
"source"
]
=
$params
[
'source'
];
$save_data
[
"source"
]
=
$params
[
'source'
];
$save_data
[
"source_id"
]
=
$params
[
'source_id'
];
$save_data
[
"source_id"
]
=
$params
[
'source_id'
];
}
}
$save_data
[
"agent_id"
]
=
$params
[
'agent_id'
];
$save_data
[
"agent_id"
]
=
$params
[
'agent_id'
];
$save_data
[
"store_id"
]
=
$agent_data
[
'store_id'
];
$save_data
[
"store_id"
]
=
$agent_data
[
'store_id'
];
$save_data
[
"district_id"
]
=
$agent_data
[
'district_id'
];
$save_data
[
"district_id"
]
=
$agent_data
[
'district_id'
];
$save_data
[
"location_time"
]
=
date
(
'Y-m-d H:i:s'
);
$save_data
[
"location_time"
]
=
date
(
'Y-m-d H:i:s'
);
$save_data
[
"longitude"
]
=
$params
[
'longitude'
];
$save_data
[
"location_date"
]
=
date
(
'Y-m-d'
);
$save_data
[
"latitude"
]
=
$params
[
'latitude'
];
$save_data
[
"longitude"
]
=
$params
[
'longitude'
];
$num
=
$m_location
->
insertData
(
$data
);
$save_data
[
"latitude"
]
=
$params
[
'latitude'
];
$num
=
$m_location
->
insertData
(
$data
);
if
(
$num
>
0
)
{
if
(
$num
>
0
)
{
$code
=
200
;
$code
=
200
;
$msg
=
'操作完成'
;
$msg
=
'操作完成'
;
}
else
{
}
else
{
$msg
=
'插入定位数据失败'
;
$msg
=
'插入定位数据失败'
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment