public function stageTicketingRepeat() { $this->status('ticketingError'); return; //pass; $this->flightBooker->tryCount++; $this->flightBooker->save(); if ($this->flightBooker->tryCount > 3) { $this->status('ticketingError'); } else { $flightTicketingParams = new FlightTicketingParams(); $flightTicketingParams->nemoBookId = $this->flightBooker->nemoBookId; $flightTicketingParams->pnr = $this->flightBooker->pnr; /** @var FlightTicketingResponse $flightTicketingResponse */ $flightTicketingResponse = Yii::app()->gdsAdapter->FlightTicketing($flightTicketingParams); SWLogActiveRecord::$requestIds = array_merge(SWLogActiveRecord::$requestIds, GDSNemoAgency::$requestIds); GDSNemoAgency::$requestIds = array(); if ($flightTicketingResponse->status == 1) { $this->status('ticketReady'); } else { //TODO: переставить стутус через время T + считать количество раз. $res = Yii::app()->cron->add(time() + appParams('flight_repeat_time'), 'flightbooking', 'ChangeState', array('flightBookerId' => $this->flightBooker->id, 'newState' => 'ticketingRepeat')); if ($res) { $this->flightBooker->saveTaskInfo('ticketingRepeat', $res); return true; } //$this->status('ticketingRepeat'); } } }