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
48
controllers/MController.php
Normal file
48
controllers/MController.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
namespace app\controllers;
|
||||
|
||||
use app\models\RequestResult;
|
||||
use app\models\ResultCache;
|
||||
use app\models\SearchRequest;
|
||||
use yii\helpers\Json;
|
||||
use yii\web\Controller;
|
||||
use yii\web\Response;
|
||||
|
||||
class MController extends Controller {
|
||||
|
||||
public function actionFacebook($id) {
|
||||
\Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
$result = RequestResult::find()->where(["request_id" => $id, "type_id" => ResultCache::TYPE_FACEBOOK])->one();
|
||||
if(is_null($result)) return [];
|
||||
|
||||
$data = Json::decode($result->data);
|
||||
sort($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function actionVk($id) {
|
||||
\Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
$result = RequestResult::find()->where(["request_id" => $id, "type_id" => ResultCache::TYPE_VK])->one();
|
||||
if(is_null($result)) return [];
|
||||
|
||||
$data = Json::decode($result->data);
|
||||
sort($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function actionAvito($id) {
|
||||
\Yii::$app->response->format = Response::FORMAT_JSON;
|
||||
|
||||
$result = RequestResult::find()->where(["request_id" => $id, "type_id" => ResultCache::TYPE_AVITO])->one();
|
||||
if(is_null($result)) return [];
|
||||
|
||||
$data = Json::decode($result->data);
|
||||
//sort($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue