public function actionUserLogin()
 {
     $params = ApiParams::getPostJsonParams();
     $model = Validation::TheUserLoginCorrectly($params);
     if ($model->errors) {
         RecipientMobileInfo::setNewRecipientInfo($model, InfoTypes::BAD_LOGIN, $params);
         Utils::echoErrorResponse($model->getFirstErrors());
     } else {
         $user_info = RecipientMobileInfo::find()->where([RecipientMobileInfo::RECIPIENT_MOBILE_INDEX => $model->index])->andWhere([RecipientMobileInfo::INFO_TYPE => InfoTypes::LOGIN])->one();
         $last_login = $user_info ? $user_info->occured_at : 0;
         RecipientMobileInfo::setNewRecipientInfo($model, InfoTypes::LOGIN, $params);
         $heartbeat = new RecipientMobileHeartbeat();
         $heartbeat = $heartbeat->setNewLoginSession($model);
         if ($heartbeat->errors) {
             Utils::echoErrorResponse($heartbeat->errors);
         } else {
             $response = [ApiParams::LAST_LOGIN => $last_login, ApiParams::AUTH_KEY => $heartbeat->auth_key];
             Utils::echoSuccessResponse($response);
         }
     }
 }