예제 #1
0
 /**
  *
  */
 public function actionTicket()
 {
     $params = ApiParams::getPostJsonParams();
     $model = Validation::checkUserAuthorization($params);
     if ($model->errors) {
         Utils::echoErrorResponse($model->getFirstErrors());
     } else {
     }
 }
예제 #2
0
 public function actionViewAlert()
 {
     $params = ApiParams::getPostJsonParams();
     $message = Validation::checkParamsAndGetMessage($params, ApiParams::$ACK_ALERT_PARAMS);
     if ($message->errors) {
         Utils::echoErrorResponse($message->getFirstErrors());
     } else {
         //TODO ......
     }
 }
 public function actionGetRecipientsList()
 {
     $params = ApiParams::getPostJsonParams();
     $model = Validation::checkUserAuthorization($params);
     if ($model->errors) {
         Utils::echoErrorResponse($model->getFirstErrors());
     } else {
         $recipiens = Recipients::find()->asArray()->all();
         $groups = Groups::find()->select('code')->asArray()->all();
         $groups_members = $this->getGroupsMembers($groups);
         Utils::echoSuccessResponse($groups_members);
     }
 }
예제 #4
0
 public function actionChangeProfileInfo()
 {
     $params = ApiParams::getPostJsonParams();
     $model = Validation::checkParams($params, ApiParams::$CHANGE_PROFILE_PARAMS);
     if ($model->errors) {
         Utils::echoErrorResponse($model->getFirstErrors());
     } else {
         $model = RecipientMobileLogin::findOne([RecipientMobileLogin::INDEX => $model->recipient_mobile_index]);
         $setting = RecipientMobileSetting::findOne([RecipientMobileSetting::RECIPIENT_MOBILE_INDEX => $model->index]);
         $recipient = Recipients::find()->where(['code' => $model->recipient_code])->one();
         $recipient->name = $params[ApiParams::USER_NAME];
         $model->recipient_code = $params[ApiParams::USER_CODE];
         $model->mobile_password = $params[ApiParams::USER_PASSWORD];
         $setting->unlock_code = $params[ApiParams::UNLOCK_CODE];
         $setting->location_support = $params[ApiParams::IS_LOCATION];
         if (!$setting->save() || !$model->save() || !$recipient->save()) {
             Utils::echoErrorResponse("something went wrong with the server, please try again later");
         } else {
             $response = $this->userJson($model, $setting);
             Utils::echoSuccessResponse($response);
         }
     }
 }