コード例 #1
0
 public function actionRecoveryPassword()
 {
     $model = new RecoveryPassword();
     $post = Yii::$app->request->post();
     $validator = new EmailValidator();
     $error = array();
     $msg = array();
     if (isset($post["RecoveryPassword"])) {
         $post = $post["RecoveryPassword"];
         foreach ($post as $key => $value) {
             $model->{$key} = $value;
         }
         $user = Parents::findOne(['email' => $post["email"]]);
         if ($post["email"] == "") {
             $error["email"] = 1;
         }
         if (!$validator->validate($post["email"])) {
             $error["format"] = 1;
         }
         if (count($user) == 0) {
             $error["nouser"] = 1;
         }
         if (count($error) == 0) {
             $mHash = md5($user["hash"]);
             $user["hash"] = $mHash;
             $user->save();
             $this->SendRecoveryEmail($post["email"], $mHash);
             echo "Ссылка успешно отправлена";
         }
     }
     return $this->render('recovery_password', ['model' => $model]);
 }
コード例 #2
0
 function actionGetAllOffers()
 {
     $outputOffers = array();
     $order = Order::find()->limit(40)->offset(5000)->all();
     if ($order) {
         foreach ($order as $val) {
             $outputOfferElement = array();
             $date = $val["date"];
             $id = $val["id"];
             $status = $val["sendMail"];
             $type_ticket = $val["type_ticket"];
             $orderType = "Онлайн";
             $summ = $val["summ"];
             $refundSumm = 0;
             $id_user = $val["id_user"];
             $surname = "";
             $name = "";
             $father_name = "";
             $fullName = "";
             $parents = Parents::findOne(["id" => $id_user]);
             if ($parents) {
                 $name = $parents->name;
                 $surname = $parents->surname;
                 $father_name = $parents->father_name;
                 $fullName = $surname . ' ' . $name . ' ' . $father_name;
             }
             $outputOfferElement["id"] = $id;
             $outputOfferElement["date"] = $date;
             $outputOfferElement["status"] = $status;
             $outputOfferElement["type_ticket"] = $type_ticket;
             $outputOfferElement["orderType"] = $orderType;
             $outputOfferElement["summ"] = $summ;
             $outputOfferElement["refundSumm"] = $refundSumm;
             $outputOfferElement["fullName"] = $fullName;
             $outputOffers[] = $outputOfferElement;
         }
         $r["status"] = "ok";
         $r["offers"] = $outputOffers;
     } else {
         $r = $this->setError(101);
     }
     return json_encode($r);
 }
コード例 #3
0
 public function getParent()
 {
     return $this->hasOne(Parents::className(), ['id' => 'id_parents']);
 }