repository = $repository; $this->areaCode = $this->request->param('areaCode', ''); $this->streetCode = $this->request->param('streetCode', ''); if ($this->areaCode == '' && $this->streetCode == '') { throw new ValidateException('请选择地区'); } } // 三轮车列表 从供销系统获取 public function vehicleList() { // 请求供销,供销查区域下的公司,在通过公司查三轮车列表 $client = new \GuzzleHttp\Client(); $getUrl = env('TASK_WORKER_HOST_URL') . '/api/index/vehicleCarList?areaCode='.$this->areaCode.'&streetCode='.$this->streetCode; $response = $client->request('GET', $getUrl); $result = json_decode($response->getBody(), true); $list = $result['data']; $count = count($list); return app('json')->success(compact('count', 'list')); } // 镇级最新物流配送详情 public function latestLogistics() { if ($this->streetCode == '') { return app('json')->fail('未获取到位置信息'); } $detail = Db::name('store_order')->alias('o') ->field(['o.order_sn', 'o.real_name', 'o.user_phone', 'o.user_address', 'o.user_address_code', 'p.store_name', 'm.mer_name', 'o.create_time', 'o.status','m.area_id', 'm.street_id', 'm.village_id', 'm.mer_address', 'm.long as mer_long', 'm.lat as mer_lat']) ->leftJoin('product_order_log og', 'o.order_id = og.order_id') ->leftJoin('merchant m', 'o.mer_id = m.mer_id') ->leftJoin('store_order_product op', 'o.order_id = op.order_id') ->leftJoin('product_library p', 'op.product_id = p.id') ->where('og.street_code', $this->streetCode) ->order('o.order_id', 'desc') ->find(); // 拼接商户的详细地址 area_id street_id village_id $area = Db::name('geo_area')->where('area_code', $detail['area_id'])->find(); $city = Db::name('geo_city')->where('city_code', $area['city_code'])->find(); $province = Db::name('geo_province')->where('province_code', $city['province_code'])->find(); $street = Db::name('geo_street')->where('street_code', $detail['street_id'])->find(); $village = Db::name('geo_village')->where('village_id', $detail['village_id'])->find(); $merAddress = $province['province_name'] . $city['city_name'] . $area['area_name'] . $street['street_name'].$village['village_name'].$detail['mer_address']; $detail['mer_address'] = $merAddress; $detail['status'] = app()->make(Order::class)->getStatusDesc($detail['status']); return app('json')->success($detail); } }