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 b2d03962
authored
2021-06-02 20:40:47 +0300
by
Скуратович Александр
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
срок действия домена
1 parent
61d6dfcc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
6 deletions
commands/WhoisController.php
migrations/m210602_172731_add.php
models/Host.php
models/HostSearch.php
modules/admin/views/host/index.php
commands/WhoisController.php
View file @
b2d0396
...
@@ -67,8 +67,9 @@ class WhoisController extends Controller
...
@@ -67,8 +67,9 @@ class WhoisController extends Controller
foreach
(
$trArr
as
$tr
)
{
foreach
(
$trArr
as
$tr
)
{
$domain
=
$tr
->
find
(
'td'
)[
0
]
->
text
;
$domain
=
$tr
->
find
(
'td'
)[
0
]
->
text
;
$status
=
$tr
->
find
(
'td'
)[
1
]
->
text
;
$status
=
$tr
->
find
(
'td'
)[
1
]
->
text
;
$expired
=
$tr
->
find
(
'td'
)[
6
]
->
text
;
$hasAnswer
[]
=
$domain
;
$hasAnswer
[]
=
$domain
;
$this
->
upWhois
(
$domain
,
$status
);
$this
->
upWhois
(
$domain
,
$status
,
$expired
);
}
}
foreach
(
array_diff
(
$domainsArr
,
$hasAnswer
)
as
$domainDisable
)
{
foreach
(
array_diff
(
$domainsArr
,
$hasAnswer
)
as
$domainDisable
)
{
$this
->
upWhois
(
$domainDisable
);
$this
->
upWhois
(
$domainDisable
);
...
@@ -79,8 +80,11 @@ class WhoisController extends Controller
...
@@ -79,8 +80,11 @@ class WhoisController extends Controller
}
}
}
}
private
function
upWhois
(
$domain
,
$statusStr
=
'Занят'
)
private
function
upWhois
(
$domain
,
$statusStr
=
'Занят'
,
$expired
=
''
)
{
{
echo
$domain
.
' => '
.
$statusStr
.
"
\n
"
;
switch
(
$statusStr
)
{
switch
(
$statusStr
)
{
case
'Свободен'
:
case
'Свободен'
:
$status
=
Host
::
STATUS_FREE
;
$status
=
Host
::
STATUS_FREE
;
...
@@ -88,9 +92,15 @@ class WhoisController extends Controller
...
@@ -88,9 +92,15 @@ class WhoisController extends Controller
default
:
default
:
$status
=
Host
::
STATUS_BUSY
;
$status
=
Host
::
STATUS_BUSY
;
}
}
$update
=
[
'wis_status'
=>
$status
,
'wis_date'
=>
new
Expression
(
'NOW()'
)];
if
(
$expired
)
{
$expired
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
$expired
));
if
(
$expired
)
{
$update
[
'domain_expire'
]
=
$expired
;
}
}
Yii
::
$app
->
db
->
createCommand
()
Yii
::
$app
->
db
->
createCommand
()
->
update
(
'{{%host}}'
,
[
'wis_status'
=>
$status
,
'wis_date'
=>
new
Expression
(
'NOW()'
)]
,
[
'domain'
=>
$domain
])
->
update
(
'{{%host}}'
,
$update
,
[
'domain'
=>
$domain
])
->
execute
();
->
execute
();
}
}
...
...
migrations/m210602_172731_add.php
0 → 100644
View file @
b2d0396
<?php
use
yii\db\Migration
;
/**
* Class m210602_172731_add
*/
class
m210602_172731_add
extends
Migration
{
/**
* {@inheritdoc}
*/
public
function
safeUp
()
{
// creates index for column `author_id`
$this
->
createIndex
(
'idx-host-status'
,
'{{%host}}'
,
'wis_status'
);
$this
->
addColumn
(
'{{%host}}'
,
'domain_expire'
,
$this
->
dateTime
()
->
null
()
->
comment
(
'Дата действия'
));
}
/**
* {@inheritdoc}
*/
public
function
safeDown
()
{
$this
->
dropIndex
(
'idx-host-status'
,
'{{%host}}'
);
$this
->
dropColumn
(
'{{%host}}'
,
'domain_expire'
);
}
}
models/Host.php
View file @
b2d0396
...
@@ -53,7 +53,7 @@ class Host extends \yii\db\ActiveRecord
...
@@ -53,7 +53,7 @@ class Host extends \yii\db\ActiveRecord
return
[
return
[
[[
'domain'
],
'required'
],
[[
'domain'
],
'required'
],
[
'status_id'
,
'in'
,
'range'
=>
array_keys
(
self
::
getStatus
())],
[
'status_id'
,
'in'
,
'range'
=>
array_keys
(
self
::
getStatus
())],
[[
'created_at'
,
'csv_date'
,
'wis_date'
],
'safe'
],
[[
'created_at'
,
'csv_date'
,
'wis_date'
,
'domain_expire'
],
'safe'
],
[[
'wis_status'
,
'tix'
],
'integer'
],
[[
'wis_status'
,
'tix'
],
'integer'
],
[[
'domain'
],
'string'
,
'max'
=>
256
],
[[
'domain'
],
'string'
,
'max'
=>
256
],
[[
'domain'
],
'unique'
],
[[
'domain'
],
'unique'
],
...
@@ -72,6 +72,7 @@ class Host extends \yii\db\ActiveRecord
...
@@ -72,6 +72,7 @@ class Host extends \yii\db\ActiveRecord
'csv_date'
=>
'Date CSV'
,
'csv_date'
=>
'Date CSV'
,
'wis_date'
=>
'Date WHOIS'
,
'wis_date'
=>
'Date WHOIS'
,
'wis_status'
=>
'Status'
,
'wis_status'
=>
'Status'
,
'domain_expire'
=>
'Date expired'
,
'tix'
=>
'TIX'
,
'tix'
=>
'TIX'
,
];
];
}
}
...
...
models/HostSearch.php
View file @
b2d0396
...
@@ -18,7 +18,7 @@ class HostSearch extends Host
...
@@ -18,7 +18,7 @@ class HostSearch extends Host
{
{
return
[
return
[
[[
'id'
,
'wis_status'
,
'tix'
],
'integer'
],
[[
'id'
,
'wis_status'
,
'tix'
],
'integer'
],
[[
'domain'
,
'created_at'
,
'csv_date'
,
'wis_date'
,
'wis_status'
],
'safe'
],
[[
'domain'
,
'created_at'
,
'csv_date'
,
'wis_date'
,
'wis_status'
,
'domain_expire'
],
'safe'
],
];
];
}
}
...
@@ -63,6 +63,7 @@ class HostSearch extends Host
...
@@ -63,6 +63,7 @@ class HostSearch extends Host
//'csv_date' => $this->csv_date,
//'csv_date' => $this->csv_date,
//'wis_date' => $this->wis_date,
//'wis_date' => $this->wis_date,
'wis_status'
=>
$this
->
wis_status
,
'wis_status'
=>
$this
->
wis_status
,
'domain_expire'
=>
$this
->
wis_status
,
'tix'
=>
$this
->
tix
,
'tix'
=>
$this
->
tix
,
]);
]);
...
...
modules/admin/views/host/index.php
View file @
b2d0396
...
@@ -54,6 +54,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -54,6 +54,7 @@ $this->params['breadcrumbs'][] = $this->title;
},
},
],
],
'wis_date'
,
'wis_date'
,
'domain_expire'
,
'tix'
,
'tix'
,
[
[
'class'
=>
'yii\grid\ActionColumn'
,
'class'
=>
'yii\grid\ActionColumn'
,
...
...
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