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 f3773981
authored
2021-06-07 14:39:54 +0300
by
san58
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
СТатистика на главной
1 parent
d2576c57
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
9 deletions
commands/WhoisController.php
controllers/SiteController.php
views/site/index.php
commands/WhoisController.php
View file @
f377398
...
...
@@ -42,14 +42,26 @@ class WhoisController extends Controller
*/
public
function
actionIndex
()
{
$hosts
=
(
new
Query
())
$query
=
(
new
Query
());
$hosts
=
$query
->
select
(
'id, domain'
)
->
from
(
'{{%host}}'
)
->
where
([
'in'
,
'wis_status'
,
[
Host
::
STATUS_WIS_NONE
,
Host
::
STATUS_WIS_BUSY
]])
->
andWhere
([
'status'
=>
Filter
::
STATUS_ON
])
->
orderBy
(
'rand()'
)
->
andWhere
(
[
'or'
,
[
'wis_status'
=>
Host
::
STATUS_WIS_NONE
]
]
)
->
orWhere
(
[
'and'
,
[
'wis_status'
=>
Host
::
STATUS_WIS_BUSY
],
[
'<='
,
'domain_expire'
,
new
Expression
(
'NOW()'
)]
]
)
->
orderBy
([
'status'
=>
SORT_DESC
,
'rand()'
=>
SORT_ASC
])
->
limit
(
$this
->
count
)
->
all
();
$domainsArr
=
[];
foreach
(
$hosts
as
$h
)
{
$domainsArr
[]
=
$h
[
'domain'
];
...
...
controllers/SiteController.php
View file @
f377398
...
...
@@ -69,10 +69,11 @@ class SiteController extends Controller
//var_dump(Yii::$app->user->identity);
$statistics
=
[
'csv_date'
=>
''
];
$statistics
[
'c_status'
]
=
(
new
yii\db\Query
())
->
select
([
'COUNT(*) AS cnt'
,
'wis_status'
])
->
select
([
'COUNT(*) AS cnt'
,
'wis_status'
,
'status'
])
->
from
(
'{{%host}}'
)
->
groupBy
([
'
csv_date
'
])
->
groupBy
([
'
wis_status'
,
'status
'
])
->
all
();
$csv
=
Host
::
find
()
->
select
([
'csv_date'
])
->
orderBy
(
'csv_date ASC'
)
->
one
();
if
(
$csv
)
{
$statistics
[
'csv_date'
]
=
$csv
[
'csv_date'
];
...
...
views/site/index.php
View file @
f377398
<?php
use
app\assets\MainAsset
;
use
app\models\Host
;
$this
->
title
=
Yii
::
$app
->
name
.
' -
Главная
'
;
$this
->
title
=
Yii
::
$app
->
name
.
' -
Home
'
;
MainAsset
::
register
(
$this
);
var_dump
(
$statistics
);
/*echo '<pre>';
print_r($statistics);
echo '</pre>';
*/
$domain_count
=
[
Host
::
STATUS_WIS_NONE
=>
[
0
,
0
],
Host
::
STATUS_WIS_FREE
=>
[
0
,
0
],
Host
::
STATUS_WIS_BUSY
=>
[
0
,
0
]
];
foreach
(
$statistics
[
'c_status'
]
as
$st_value
)
$domain_count
[
$st_value
[
'wis_status'
]][(
int
)
$st_value
[
'status'
]]
=
(
int
)
$st_value
[
'cnt'
];
unset
(
$st_value
);
?>
главная страница
\ No newline at end of file
<h3>
Statistics
</h3>
<dl
class=
"dl-horizontal"
>
<dt>
Datatime of CSV-file
</dt>
<dd>
<?php
echo
$statistics
[
'csv_date'
];
?>
</dd>
</dl>
<div
class=
"table-responsive"
>
<table
class=
"table table-bordered table-hover table-striped"
>
<tr>
<th
width=
"40%"
>
Status WhoIs checked
</th>
<th
width=
"20%"
>
Count of Disabled
</th>
<th
width=
"20%"
>
Count of Enabled
</th>
<th
width=
"20%"
>
Count of All
</th>
</tr>
<tr>
<td>
No checked
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_NONE
][
0
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_NONE
][
1
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_NONE
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_NONE
][
1
];
?>
</td>
</tr>
<tr>
<td>
Busy
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
0
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
1
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
1
];
?>
</td>
</tr>
<tr>
<td>
Free
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_FREE
][
0
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_FREE
][
1
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_FREE
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_FREE
][
1
];
?>
</td>
</tr>
<tr>
<th
class=
"text-right"
>
All count
</th>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_NONE
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_FREE
][
0
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_NONE
][
1
]
+
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
1
]
+
$domain_count
[
Host
::
STATUS_WIS_FREE
][
1
];
?>
</td>
<td>
<?php
echo
$domain_count
[
Host
::
STATUS_WIS_NONE
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_NONE
][
1
]
+
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_BUSY
][
1
]
+
$domain_count
[
Host
::
STATUS_WIS_FREE
][
0
]
+
$domain_count
[
Host
::
STATUS_WIS_FREE
][
1
];
?>
</td>
</tr>
</table>
</div>
\ No newline at end of file
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