mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
32
controllers/GoogleController.php
Normal file
32
controllers/GoogleController.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
namespace app\controllers;
|
||||
|
||||
use app\models\SearchRequest;
|
||||
use app\models\User;
|
||||
use yii\web\BadRequestHttpException;
|
||||
use yii\web\Controller;
|
||||
|
||||
class GoogleController extends Controller {
|
||||
|
||||
public function actionIndex() {
|
||||
$id = \Yii::$app->request->get("id");
|
||||
$uuid = \Yii::$app->request->get("uuid");
|
||||
$user = User::find()->where(["uuid" => $uuid])->one();
|
||||
|
||||
if(!$user) {
|
||||
throw new BadRequestHttpException("Пользователь с uuid: ".$uuid." не найден");
|
||||
}
|
||||
|
||||
$searchRequest = SearchRequest::getDb()->cache(function () use ($id, $user) {
|
||||
return SearchRequest::find()->where(["id" => $id, "user_id" => $user->id])->one();
|
||||
});
|
||||
|
||||
if(!$searchRequest) {
|
||||
throw new BadRequestHttpException("Запрос с ID: ".$id." не найден");
|
||||
}
|
||||
|
||||
return $this->render("index", [
|
||||
"searchRequest" => $searchRequest
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue