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
54
commands/TasksController.php
Normal file
54
commands/TasksController.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace app\commands;
|
||||
|
||||
use app\models\Proxy;
|
||||
use yii\console\Controller;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Json;
|
||||
|
||||
class TasksController extends Controller
|
||||
{
|
||||
public function actionUpdateProxies()
|
||||
{
|
||||
$proxies = explode("\n", trim(file_get_contents('http://awmproxy.com/777proxy.txt')));
|
||||
|
||||
if (!$proxies) return;
|
||||
|
||||
Proxy::deleteAll();
|
||||
|
||||
foreach ($proxies as $proxy) {
|
||||
list($host, $port) = explode(':', $proxy);
|
||||
$model = new Proxy();
|
||||
$model->host = $host;
|
||||
$model->port = $port;
|
||||
$model->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSms()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function actionCheckAvito()
|
||||
{
|
||||
$response = file_get_contents("http://rest-app.net/api/info?login=git@anyget.ru&token=a7548861db147975e7b3ad65c09c6398");
|
||||
$response = Json::decode($response);
|
||||
if($response["status"] == "ok") {
|
||||
\Yii::$app->cache->set("avito", ArrayHelper::getValue($response, "data"));
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCheckAntiparkon()
|
||||
{
|
||||
//
|
||||
$response = file_get_contents("http://data.av100.ru/api.ashx?key=9f256387-5260-46b6-b9dc-8abdbfb877ee&phone=79299991975");
|
||||
$response = Json::decode($response);
|
||||
if(ArrayHelper::getValue($response, "error")) {
|
||||
\Yii::$app->cache->set("antiparkon", ArrayHelper::getValue($response, "error_msg"));
|
||||
} else {
|
||||
\Yii::$app->cache->delete("antiparkon");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue