Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
geoserver
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
backend
geoserver
Commits
76f7bdb3
Commit
76f7bdb3
authored
Sep 21, 2019
by
王凯
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '刷新数据' into 'meilai'
刷新redis数据 See merge request
!19
parents
5cc43cb3
508a9f42
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
deploy_conf.xml
deploy_conf.xml
+5
-0
views.py
home/views.py
+29
-6
No files found.
deploy_conf.xml
0 → 100644
View file @
76f7bdb3
<?xml version="1.0" encoding="utf-8"?>
<gm_rpcd_config>
<info
config_name=
"deploy"
version=
"1.0"
/>
<config
name=
"log_dir"
value=
"/data/log/geoserver"
/>
</gm_rpcd_config>
home/views.py
View file @
76f7bdb3
...
...
@@ -43,6 +43,23 @@ def nearly_hospitals(q_lat,q_lng,radis=500,unit="km",count=20):
}
return
data
@bind
(
'geoserver/home/refresh'
)
def
refresh
():
'''刷新redis中数据'''
result
=
{
"result"
:
True
,
"data"
:[],
"message"
:
""
}
try
:
refresh_cache_locations
()
except
Exception
as
e
:
result
.
update
({
"result"
:
False
,
"message"
:
str
(
e
)})
return
result
@bind
(
"geoserver/home/hospitals_distance"
)
def
specify_hospitals_distance
(
q_lng
,
q_lat
,
hospital_ids
):
'''
...
...
@@ -51,7 +68,11 @@ def specify_hospitals_distance(q_lng,q_lat,hospital_ids):
cache_key
=
"hospital_location"
#锁定临时的key
result
=
[]
data
=
[]
message
=
""
result
=
True
try
:
temp_key
=
"hospital_location_temp"
lock_key
=
"hospital_location_lock"
with
r
.
lock
(
lock_key
,
blocking_timeout
=
15
)
as
lock
:
...
...
@@ -62,14 +83,16 @@ def specify_hospitals_distance(q_lng,q_lat,hospital_ids):
if
not
distance
:
distance
=
0
result
.
append
({
"id"
:
item
,
"distance"
:
distance
})
data
.
append
({
"id"
:
item
,
"distance"
:
distance
})
#排序
result
=
sorted
(
result
,
key
=
lambda
x
:
x
.
get
(
"distance"
))
data
=
sorted
(
data
,
key
=
lambda
x
:
x
.
get
(
"distance"
))
except
Exception
as
e
:
result
,
message
=
False
,
str
(
e
)
data
=
{
"result"
:
True
,
"data"
:
result
,
"message"
:
""
"result"
:
result
,
"data"
:
data
,
"message"
:
message
}
return
data
...
...
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