public static function setNewRecipientInfo($model, $info_type, $params) { try { $user_info = new RecipientMobileInfo(); $user_info->recipient_mobile_index = $model->index; $user_info->info_type = $info_type; $user_info->occured_at = Utils::getCurrentTime(); if (ApiParams::checkLocationParams($params)) { $user_info->pos_lat = $params[ApiParams::POS_LNG]; $user_info->pos_lng = $params[ApiParams::POS_LAT]; } elseif (ApiParams::checkIfThereAreNote($params)) { $user_info->note = $params[ApiParams::NOTE]; } return $user_info->save(); } catch (\Exception $e) { return $e; } }
public function logOut($model) { $this->auth_key = $this->setNewAuthKey(); $this->device_id = $model->device_id; $this->heartbeat_time = Utils::getCurrentTime(); $this->recipient_mobile_index = $model->recipient_mobile_index; if (!$this->save()) { $this->addError(self::AUTH_KEY, $error = "c'not save new session"); } return $this; }