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
000ea922
Commit
000ea922
authored
Sep 19, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定位
parent
30fdc81d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
46 deletions
+91
-46
AppointmentTime.php
application/api/controller/AppointmentTime.php
+5
-5
GeTuiUtils.php
application/api/untils/GeTuiUtils.php
+2
-1
Location.php
application/api_broker/controller/Location.php
+6
-40
LocationService.php
application/api_broker/service/LocationService.php
+78
-0
No files found.
application/api/controller/AppointmentTime.php
View file @
000ea922
...
...
@@ -360,11 +360,11 @@ class AppointmentTime extends Basic
$field
=
'id,operation_id,house_id,message,type'
;
$id
=
$m_push
->
getListByWhere
(
$field
,
$where
,
1
,
1
);
if
(
empty
(
$id
[
0
][
'id'
]))
{
$data
[
'is_alert'
]
=
0
;
$data
[
'string_1'
]
=
''
;
$data
[
'string_2'
]
=
''
;
}
else
{
if
(
!
empty
(
$id
[
0
][
'id'
]))
{
//
$data['is_alert'] = 0;
//
$data['string_1'] = '';
//
$data['string_2'] = '';
//
} else {
$data
[
'name'
]
=
$id
[
0
][
'message'
];
$data
[
'is_alert'
]
=
1
;
$data
[
'type'
]
=
$id
[
0
][
'type'
];
...
...
application/api/untils/GeTuiUtils.php
View file @
000ea922
...
...
@@ -195,7 +195,8 @@ class GeTuiUtils {
'id'
=>
$user_id
,
'house_id'
=>
$house_id
,
'order_id'
=>
$order_id
,
'imageUrl'
=>
$home_url
.
'notice_android_logo.png'
));
'imageUrl'
=>
$home_url
.
'notice_android_logo.png'
,
'agent_id'
=>
$id
));
return
$this
->
push_message_for_one
(
$data
);
}
...
...
application/api_broker/controller/Location.php
View file @
000ea922
...
...
@@ -3,6 +3,7 @@
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\LocationService
;
use
app\api_broker\service\RedisCacheService
;
use
app\extra\RedisExt
;
use
app\index\service\PositionService
;
...
...
@@ -73,49 +74,13 @@ class Location extends Basic
return
$this
->
response
(
$code
,
'账号异常'
);
}
$m_location
=
new
ALocationListModel
();
$position_service
=
new
PositionService
();
$s_redis
=
new
RedisCacheService
();
$s_location
=
new
LocationService
();
$result
=
$s_location
->
add
(
$params
[
'agent_id'
],
$params
[
'longitude'
],
$params
[
'latitude'
]);
$where
[
'agent_id'
]
=
$params
[
'agent_id'
];
$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'
])
{
return
$this
->
response
(
101
,
'经纬度重复'
);
}
if
(
!
empty
(
$data
))
{
$is_
=
$position_service
->
checkDistance
(
$params
[
'latitude'
],
$params
[
'longitude'
],
$data
[
'latitude'
],
$data
[
'longitude'
],
500
);
if
(
$is_
)
{
return
$this
->
response
(
200
,
'距离没有超过500米'
);
}
}
$agent_data
=
$s_redis
->
getRedisCache
(
2
,
$params
[
'agent_id'
]);
if
(
empty
(
$params
[
'source'
]))
{
$save_data
[
"source"
]
=
0
;
$save_data
[
"source_id"
]
=
0
;
}
else
{
$save_data
[
"source"
]
=
$params
[
'source'
];
$save_data
[
"source_id"
]
=
$params
[
'source_id'
];
}
$save_data
[
"agent_id"
]
=
$params
[
'agent_id'
];
$save_data
[
"store_id"
]
=
$agent_data
[
'store_id'
];
$save_data
[
"district_id"
]
=
$agent_data
[
'district_id'
];
$save_data
[
"location_time"
]
=
date
(
'Y-m-d H:i:s'
);
$save_data
[
"location_date"
]
=
date
(
'Y-m-d'
);
$save_data
[
"longitude"
]
=
$params
[
'longitude'
];
$save_data
[
"latitude"
]
=
$params
[
'latitude'
];
$num
=
$m_location
->
insertData
(
$save_data
);
if
(
$num
>
0
)
{
if
(
$result
[
'status'
]
!=
'fail'
)
{
$code
=
200
;
$msg
=
'操作完成'
;
}
else
{
$msg
=
'插入定位数据失败'
;
}
$msg
=
$result
[
'msg'
];
return
$this
->
response
(
$code
,
$msg
);
}
}
\ No newline at end of file
application/api_broker/service/LocationService.php
0 → 100644
View file @
000ea922
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/9/19
* Time: 10:56
*/
namespace
app\api_broker\service
;
use
app\index\service\PositionService
;
use
app\model\ALocationListModel
;
class
LocationService
{
/**
* 新增定位
*
* @param $agent_id
* @param $longitude
* @param $latitude
* @param int $source
* @param int $source_id
* @return mixed
*/
public
function
add
(
$agent_id
,
$longitude
,
$latitude
,
$source
=
0
,
$source_id
=
0
)
{
$result
[
'status'
]
=
'fail'
;
$m_location
=
new
ALocationListModel
();
$position_service
=
new
PositionService
();
$s_redis
=
new
RedisCacheService
();
$where
[
'agent_id'
]
=
$agent_id
;
$where
[
'location_date'
]
=
date
(
"Y-m-d"
,
time
());
$data
=
$m_location
->
findData
(
'longitude,latitude'
,
$where
,
'id desc'
);
if
(
$longitude
.
$latitude
==
$data
[
'longitude'
]
.
$data
[
'latitude'
])
{
$result
[
'msg'
]
=
'经纬度重复'
;
}
if
(
!
empty
(
$data
))
{
$distance
=
500
;
$is_
=
$position_service
->
checkDistance
(
$latitude
,
$longitude
,
$data
[
'latitude'
],
$data
[
'longitude'
],
$distance
);
if
(
$is_
)
{
$result
[
'msg'
]
=
'距离没有超过'
.
$distance
.
'米'
;
}
}
$agent_data
=
$s_redis
->
getRedisCache
(
2
,
$agent_id
);
if
(
$source
)
{
$save_data
[
"source"
]
=
0
;
$save_data
[
"source_id"
]
=
0
;
}
else
{
$save_data
[
"source"
]
=
$source
;
$save_data
[
"source_id"
]
=
$source_id
;
}
$save_data
[
"agent_id"
]
=
$agent_id
;
$save_data
[
"store_id"
]
=
$agent_data
[
'store_id'
];
$save_data
[
"district_id"
]
=
$agent_data
[
'district_id'
];
$save_data
[
"location_time"
]
=
date
(
'Y-m-d H:i:s'
);
$save_data
[
"location_date"
]
=
date
(
'Y-m-d'
);
$save_data
[
"longitude"
]
=
$longitude
;
$save_data
[
"latitude"
]
=
$latitude
;
$num
=
$m_location
->
insertData
(
$save_data
);
if
(
$num
>
0
)
{
$result
[
'status'
]
=
'successful'
;
$result
[
'msg'
]
=
'操作完成'
;
}
else
{
$result
[
'msg'
]
=
'插入定位数据失败'
;
}
return
$result
;
}
}
\ No newline at end of file
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