Browse Source

初始化骑手位置

master
lanzu_qinsheng 5 years ago
parent
commit
b8629f8bdf
  1. 12
      app/Admin/Forms/SelectHorseman.php

12
app/Admin/Forms/SelectHorseman.php

@ -3,6 +3,8 @@
namespace App\Admin\Forms;
use App\Admin\Common\Auth;
use App\Libs\SsdbClient;
use App\Models\ImsCjdcMarket;
use App\Models\ImsCjdcOrderMain;
use App\Models\LanzuServiceHorseman;
use App\Models\v3\LanzuEmployees;
@ -25,12 +27,20 @@ class SelectHorseman extends Form
public function handle(array $input)
{
$hid = request()->input('horseman_id');
$oid = request()->input('order_id');
$current_page = request()->input('current_page');
$horseman = LanzuEmployees::getName($hid);//骑手名称
$result = ImsCjdcOrderMain::where('id',$oid)->update(['shipping_type'=>1,'horseman_id'=>$hid,'shipping_name'=>$horseman,'updated_at'=>time()]);
if ($result){
//指定骑手后,初始化骑手位置,默认将市场经纬做为骑手默认经纬
$mid = ImsCjdcOrderMain::where('id',$oid)->pluck('market_id');
$market = ImsCjdcMarket::where('id',$mid)->first();
$ssdb = SsdbClient::client(env('SSDB_HOST'), env('SSDB_PORT'));
$coordinate = $market->lng.','.$market->lat;
$ssdb->set("horseman_coordinate_{$hid}",$coordinate);
return $this->success('操作成功',"order?page={$current_page}");
}else{
return $this->error('操作失败');

Loading…
Cancel
Save