Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Alto
/
rkn
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit b036aba8
authored
2021-06-02 16:48:50 +0300
by
san58
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Обновление даты CSV у доменов
1 parent
2659413c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
29 deletions
commands/ScanController.php
config/web.php
models/Host.php
modules/admin/views/host/index.php
modules/admin/views/layouts/admin.php
commands/ScanController.php
View file @
b036aba
...
@@ -7,7 +7,7 @@ use yii\console\Controller;
...
@@ -7,7 +7,7 @@ use yii\console\Controller;
use
yii\db\Expression
;
use
yii\db\Expression
;
use
yii\helpers\Console
;
use
yii\helpers\Console
;
use
app\components\Collection
;
use
app\components\Collection
;
use
app\
jobs\HostJob
;
use
app\
models\Host
;
/**
/**
* Парсинг запрещенных ресурсов в РФ.
* Парсинг запрещенных ресурсов в РФ.
...
@@ -40,18 +40,31 @@ class ScanController extends Controller
...
@@ -40,18 +40,31 @@ class ScanController extends Controller
public
function
actionIndex
()
public
function
actionIndex
()
{
{
$hosts
=
Collection
::
getHostsByCsv
(
Yii
::
$app
->
params
[
'csv_url'
]);
$hosts
=
Collection
::
getHostsByCsv
(
Yii
::
$app
->
params
[
'csv_url'
]);
$grabUrls
=
Yii
::
$app
->
params
[
'registrators_urls'
];
$csv_date
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
$hosts
[
'csv_date'
]));
foreach
(
$hosts
[
'data'
]
as
$host
)
{
foreach
(
$hosts
[
'data'
]
as
$host
)
$res
=
Yii
::
$app
->
db
->
createCommand
()
->
insert
(
'{{%host}}'
,
[
{
'domain'
=>
utf8
(
$host
),
$host_utf8
=
utf8_encode
(
$host
);
'created_at'
=>
new
Expression
(
'NOW()'
),
$res
=
Yii
::
$app
->
db
->
createCommand
();
'csv_date'
=>
date
(
"Y-m-d H:i:s"
,
strtotime
(
$hosts
[
'csv_date'
])),
if
(
Host
::
find
()
->
where
([
'domain'
=>
$host_utf8
])
->
count
()
)
])
->
execute
();
$res
->
update
(
/* $ids[] = (int)Yii::$app->queue->push(new HostJob([
'{{%host}}'
,
'host' => $host,
[
'grabSource' => $grabUrls[array_rand($grabUrls)]
'csv_date'
=>
$csv_date
],
]));*/
[
}
'domain'
=>
$host_utf8
]
);
else
$res
->
insert
(
'{{%host}}'
,
[
'domain'
=>
$host_utf8
,
'created_at'
=>
new
Expression
(
'NOW()'
),
'csv_date'
=>
$csv_date
,
]
);
$res
->
execute
();
}
echo
"
\n
"
.
$this
->
ansiFormat
(
'Количество полученных хостов'
,
Console
::
FG_CYAN
)
.
' => '
.
$this
->
ansiFormat
(
count
(
$hosts
[
'data'
]),
Console
::
BOLD
,
Console
::
FG_GREEN
)
.
"
\n
"
;
echo
"
\n
"
.
$this
->
ansiFormat
(
'Количество полученных хостов'
,
Console
::
FG_CYAN
)
.
' => '
.
$this
->
ansiFormat
(
count
(
$hosts
[
'data'
]),
Console
::
BOLD
,
Console
::
FG_GREEN
)
.
"
\n
"
;
}
}
...
...
config/web.php
View file @
b036aba
...
@@ -5,7 +5,7 @@ $db = require __DIR__ . '/db.php';
...
@@ -5,7 +5,7 @@ $db = require __DIR__ . '/db.php';
$config
=
[
$config
=
[
'id'
=>
'basic'
,
'id'
=>
'basic'
,
'name'
=>
'
Новый проект
'
,
'name'
=>
'
РКН
'
,
'basePath'
=>
dirname
(
__DIR__
),
'basePath'
=>
dirname
(
__DIR__
),
'bootstrap'
=>
[
'log'
],
'bootstrap'
=>
[
'log'
],
'language'
=>
'en-EN'
,
'language'
=>
'en-EN'
,
...
...
models/Host.php
View file @
b036aba
...
@@ -67,12 +67,12 @@ class Host extends \yii\db\ActiveRecord
...
@@ -67,12 +67,12 @@ class Host extends \yii\db\ActiveRecord
{
{
return
[
return
[
'id'
=>
'ID'
,
'id'
=>
'ID'
,
'domain'
=>
'
Домен
'
,
'domain'
=>
'
Domain
'
,
'created_at'
=>
'
Дата записи
'
,
'created_at'
=>
'
Date
'
,
'csv_date'
=>
'
Дата
CSV'
,
'csv_date'
=>
'
Date
CSV'
,
'wis_date'
=>
'
Дата проверки домена
'
,
'wis_date'
=>
'
Date WHOIS
'
,
'wis_status'
=>
'
Статус
'
,
'wis_status'
=>
'
Status
'
,
'tix'
=>
'
Показатель
'
,
'tix'
=>
'
TIX
'
,
];
];
}
}
...
@@ -89,9 +89,9 @@ class Host extends \yii\db\ActiveRecord
...
@@ -89,9 +89,9 @@ class Host extends \yii\db\ActiveRecord
public
static
function
getStatus
(
$status
=
false
)
public
static
function
getStatus
(
$status
=
false
)
{
{
$arr
=
[
$arr
=
[
self
::
STATUS_NONE
=>
'
Неизвестный
'
,
self
::
STATUS_NONE
=>
'
No checked
'
,
self
::
STATUS_FREE
=>
'
Свободный
'
,
self
::
STATUS_FREE
=>
'
FREE
'
,
self
::
STATUS_BUSY
=>
'
Занятый
'
,
self
::
STATUS_BUSY
=>
'
BUSY
'
,
];
];
if
(
is_numeric
(
$status
))
{
if
(
is_numeric
(
$status
))
{
if
(
array_key_exists
(
$status
,
$arr
))
{
if
(
array_key_exists
(
$status
,
$arr
))
{
...
...
modules/admin/views/host/index.php
View file @
b036aba
...
@@ -8,16 +8,16 @@ use yii\widgets\Pjax;
...
@@ -8,16 +8,16 @@ use yii\widgets\Pjax;
/* @var $searchModel app\models\HostSearch */
/* @var $searchModel app\models\HostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this
->
title
=
'
Host
s'
;
$this
->
title
=
'
List of domain
s'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
?>
<div
class=
"host-index"
>
<div
class=
"host-index"
>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<h1>
<?=
Html
::
encode
(
$this
->
title
)
?>
</h1>
<p>
<
!--
p>
<?=
Html
::
a
(
'Create Host'
,
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
<?=
Html
::
a
(
'Create Host'
,
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
</p>
</p
--
>
<?php
Pjax
::
begin
();
?>
<?php
Pjax
::
begin
();
?>
<?php
// echo $this->render('_search', ['model' => $searchModel]); ?>
<?php
// echo $this->render('_search', ['model' => $searchModel]); ?>
...
...
modules/admin/views/layouts/admin.php
View file @
b036aba
...
@@ -38,8 +38,8 @@ AdminAsset::register($this);
...
@@ -38,8 +38,8 @@ AdminAsset::register($this);
echo
Nav
::
widget
([
echo
Nav
::
widget
([
'options'
=>
[
'class'
=>
'navbar-nav navbar-right'
],
'options'
=>
[
'class'
=>
'navbar-nav navbar-right'
],
'items'
=>
[
'items'
=>
[
[
'label'
=>
'
Главная
'
,
'url'
=>
[
'/site/index'
]],
[
'label'
=>
'
Home
'
,
'url'
=>
[
'/site/index'
]],
[
'label'
=>
'
Выйти
('
.
Yii
::
$app
->
user
->
identity
->
name
.
')'
,
'url'
=>
[
'/auth/logout'
]],
[
'label'
=>
'
Logout
('
.
Yii
::
$app
->
user
->
identity
->
name
.
')'
,
'url'
=>
[
'/auth/logout'
]],
],
],
]);
]);
NavBar
::
end
();
NavBar
::
end
();
...
@@ -69,7 +69,7 @@ AdminAsset::register($this);
...
@@ -69,7 +69,7 @@ AdminAsset::register($this);
<div
class=
"container"
>
<div
class=
"container"
>
<p
class=
"pull-left"
>
©
<?php
echo
Yii
::
$app
->
name
;
?>
<?php
<p
class=
"pull-left"
>
©
<?php
echo
Yii
::
$app
->
name
;
?>
<?php
$d
=
date
(
'Y'
);
$d
=
date
(
'Y'
);
echo
((
$d
-
202
0
)
?
'2020
- '
.
$d
:
$d
);
?>
echo
((
$d
-
202
1
)
?
'2021
- '
.
$d
:
$d
);
?>
</p>
</p>
</div>
</div>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment