Browse Source

骑手定位

master
lanzu_qinsheng 5 years ago
parent
commit
d6565b8d9a
  1. 20
      app/Admin/Controllers/ImsCjdcOrderMainController.php
  2. 40
      app/Admin/Extensions/MyDetailPage.php
  3. 1
      app/Admin/routes.php

20
app/Admin/Controllers/ImsCjdcOrderMainController.php

@ -14,6 +14,7 @@ use App\Admin\Extensions\OrderPrint;
use App\Admin\Extensions\OrderRefund;
use App\Admin\Extensions\OrderStateHandle;
use App\Admin\Repositories\ImsCjdcOrderMain;
use App\Libs\SsdbClient;
use App\Models\ImsCjdcMarket;
use App\Models\LanzuStore;
use Dcat\Admin\Admin;
@ -215,4 +216,23 @@ class ImsCjdcOrderMainController extends AdminController
return Map::routeInfo($m_lat,$m_lng,$u_lat,$u_lng,$type);
}
/**
* 获取骑手定位
* @return false|string
*/
public function getHorsemanPosition()
{
$ssdb = SsdbClient::client(env('SSDB_HOST'), env('SSDB_PORT'));
$hid = request()->get('horseman_id');
$coordinate= $ssdb->get("horseman_coordinate_{$hid}");
$data = [];
$code = 200;
if ($coordinate){
list($data['lng'],$data['lat']) = explode(',',$coordinate);
}else{
$code = 0;
}
return json_encode(['code'=>$code,'data'=>$data]);
}
}

40
app/Admin/Extensions/MyDetailPage.php

@ -67,6 +67,7 @@ class MyDetailPage extends LazyRenderable
coupon_money: "{$order['coupon_money']}",
delivery_money: "{$order['delivery_money']}",
horseman_name: "{$order['horseman_name']}",
horseman_id:"{$order['horseman_id']}",
distance: "{$order['delivery_distance']}",
orders: JSON.parse(orders),
show_refund: JSON.parse(show_refund),
@ -83,7 +84,9 @@ class MyDetailPage extends LazyRenderable
show_map:false,
close_map:true,
is_show:true,
map:""
map:"",
h_lng:0,
h_lat:0
},
methods: {
refundNote(name,order_goods_id,order_child_id) {
@ -136,6 +139,31 @@ class MyDetailPage extends LazyRenderable
});
},
showMap() {
that = this;
if (that.state==3&&that.horseman_id>0){
$.ajax({
url: "coordinate",
type: "get",
contentType: "text/html; charset=utf-8",
dataType: "json",
data: {
horseman_id: that.horseman_id
},
success: function (res) {
if (res.code==200){
that.h_lng = res.data.lng;
that.h_lat = res.data.lat;
}
},
error: function (xhr, err) {
console.log("错误", err)
}
});
}
this.is_show=true;
if (!this.show_map){
this.show_map = true;
@ -223,11 +251,11 @@ class MyDetailPage extends LazyRenderable
"anchor": { x: 16, y: 32 },
"src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/end.png'
}),
"marker": new TMap.MarkerStyle({
"horseman": new TMap.MarkerStyle({
"width": 45,
"height": 52,
"anchor": { x: 16, y: 32 },
"src": "../uploads/map/561.png"
"src": "../uploads/map/56.png"
})
},
geometries: [{
@ -240,10 +268,10 @@ class MyDetailPage extends LazyRenderable
"position": new TMap.LatLng(that.user_lat,that.user_lng)
},{ //点标注数据数组
"id": "horseman",
"styleId": "marker",
"position": new TMap.LatLng(22.805566,108.412079),
"styleId": "horseman",
"position": new TMap.LatLng(that.h_lat,that.h_lng),
"properties": {
"title": "marker"
"title": "horseman"
}
}]
});

1
app/Admin/routes.php

@ -71,6 +71,7 @@ Route::group([
$router->any('/detail', 'ImsCjdcOrderMainController@orderDetail');
$router->any('/order_goods_refund', 'ImsCjdcOrderMainController@orderGoodsRefund');
$router->any('/map_route', 'ImsCjdcOrderMainController@mapRoute');
$router->any('/coordinate', 'ImsCjdcOrderMainController@getHorsemanPosition');
$router->any('ops/files', 'v3\FileController@handle');

Loading…
Cancel
Save