add daily mode to nikarayan command
This commit is contained in:
@@ -24,7 +24,7 @@ class RoadObservationProblems extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'webservice:roadobserved';
|
||||
protected $signature = 'webservice:roadobserved {--daily-mode}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -63,7 +63,9 @@ class RoadObservationProblems extends Command
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
$result = $nikarayanService->getRoadObservedProblemsByDate();
|
||||
$time = $this->option('daily-mode') ? verta()->subDay() : verta();
|
||||
|
||||
$result = $nikarayanService->getRoadObservedProblemsByDate($time);
|
||||
|
||||
$result = serialize($result);
|
||||
$x = strpos($result, '<Document');
|
||||
@@ -81,7 +83,7 @@ class RoadObservationProblems extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($value->fk_FeatureType >= 1 && $value->fk_FeatureType <= 18) {
|
||||
if ($value->fk_FeatureType >= 1 && $value->fk_FeatureType <= 24) {
|
||||
$mobile = null;
|
||||
|
||||
if ($value->MobileForSendEventSms && (strlen($value->MobileForSendEventSms) == 11)) {
|
||||
@@ -89,7 +91,7 @@ class RoadObservationProblems extends Command
|
||||
}
|
||||
|
||||
$city = findCityFromGeoJson($value->YGeo, $value->XGeo);
|
||||
$cityModel = $city ? City::find($city['city_id']) : null;
|
||||
$cityModel = $city ? City::query()->find($city['city_id']) : City::query()->find(NikarayanComplaints::mapCities((int) $value->fk_Town));
|
||||
$rop = RoadObserved::query()->updateOrCreate(
|
||||
['fk_RegisteredEventMessage' => $value->fk_RegisteredEventMessage],
|
||||
[
|
||||
@@ -130,7 +132,7 @@ class RoadObservationProblems extends Command
|
||||
'province_id' => $city ? $city['province_id'] : null,
|
||||
'city_id' => $city ? $city['city_id'] : null,
|
||||
// 'handler_type' => EdarateShahri::class,
|
||||
'edarate_shahri_id' => $cityModel ? ($cityModel->edarateShahri()->where('is_primary', 1)->exists() ? $cityModel->edarateShahri()->where('is_primary', 1)->first()->id : null) : null,
|
||||
'edarate_shahri_id' => $cityModel->edarateShahri()->first()->id,
|
||||
'province_fa' => (isset($city['province_id']) ? Province::find($city['province_id'])->name_fa : null),
|
||||
'city_fa' => $cityModel ? $cityModel->name_fa : null,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user