where('id',$logisticId)->first(); if(!str_starts_with($logistic->name,'新杰')){ $city = app(CityService::class)->findByName($cityName); $province = app(ProvinceService::class)->findByName($provinceName); $logistic = Logistic::query()->where('code','SFTH')->first(); if(isset($city) && isset($province)){ return $this->findByCityIdAndProvinceIdAndLogisticName($city->id,$province->id,$logistic->id); } return null; } $city = app(CityService::class)->findByName($cityName); $province = app(ProvinceService::class)->findByName($provinceName); if($city == null|| $province==null)return null; return $this->findByCityIdAndProvinceIdAndLogisticName($city->id,$province->id,$logisticId); } public function findByCityIdAndProvinceIdAndLogisticName($cityId,$provinceId,$logisticId) { return LogisticTiming::query()->where('to_province_id',$provinceId)->where('to_city_id',$cityId)->where('logistic_id',$logisticId)->first(); } }