9 changed files with 92 additions and 36 deletions
-
14abonapp/templates/abonapp/peoples.html
-
21abonapp/test.sql
-
34abonapp/views.py
-
2accounts_app/models.py
-
9agent/netflow/mysql_install.sql
-
8agent/netflow/netflow_handler.py
-
1djing/lib/__init__.py
-
30statistics/migrations/0003_auto_20180814_1921.py
-
9statistics/models.py
@ -0,0 +1,21 @@ |
|||||
|
SELECT |
||||
|
`base_accounts`.`username`, |
||||
|
`base_accounts`.`telephone`, |
||||
|
`abonent`.`ballance`, |
||||
|
`abonent_tariff`.`tariff_id`, |
||||
|
`tariffs`.`title`, |
||||
|
`tariffs`.`speedIn`, |
||||
|
`tariffs`.`speedOut`, |
||||
|
`tariffs`.`amount`, |
||||
|
`groups`.`title`, |
||||
|
`abon_street`.`name` |
||||
|
FROM `abonent` |
||||
|
INNER JOIN `base_accounts` ON (`abonent`.`baseaccount_ptr_id` = `base_accounts`.`id`) |
||||
|
INNER JOIN `groups` ON (`abonent`.`group_id` = `groups`.`id`) |
||||
|
LEFT OUTER JOIN `abonent_tariff` ON (`abonent`.`current_tariff_id` = `abonent_tariff`.`id`) |
||||
|
LEFT OUTER JOIN `tariffs` ON (`abonent_tariff`.`tariff_id` = `tariffs`.`id`) |
||||
|
LEFT OUTER JOIN `abon_street` ON (`abonent`.`street_id` = `abon_street`.`id`) |
||||
|
LEFT OUTER JOIN `flowcache` ON (`abonent`.`baseaccount_ptr_id` = `flowcache`.`abon_id`) |
||||
|
WHERE (`base_accounts`.`is_admin` = 0 AND `abonent`.`group_id` = 46) |
||||
|
ORDER BY `base_accounts`.`fio` ASC |
||||
|
LIMIT 20; |
||||
@ -0,0 +1,9 @@ |
|||||
|
CREATE TABLE `flowcache` ( |
||||
|
`last_time` INT(10) UNSIGNED NOT NULL, |
||||
|
`abon_id` INT(11) DEFAULT NULL UNIQUE, |
||||
|
`octets` INT(10) UNSIGNED NOT NULL, |
||||
|
`packets` INT(10) UNSIGNED NOT NULL, |
||||
|
KEY `flowcache_abon_id_91e1085d` (`abon_id`) |
||||
|
) |
||||
|
ENGINE = MEMORY |
||||
|
DEFAULT CHARSET = utf8; |
||||
@ -0,0 +1,30 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.11 on 2018-08-14 19:21 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
from statistics.fields import UnixDateTimeField |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('abonapp', '0002_auto_20180808_1448'), |
||||
|
('statistics', '0002_auto_20180808_1236'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.DeleteModel('StatCache'), |
||||
|
migrations.CreateModel( |
||||
|
name='StatCache', |
||||
|
fields=[ |
||||
|
('last_time', UnixDateTimeField()), |
||||
|
('abon', models.OneToOneField(on_delete=models.deletion.CASCADE, primary_key=True, serialize=False, to='abonapp.Abon')), |
||||
|
('octets', models.PositiveIntegerField(default=0)), |
||||
|
('packets', models.PositiveIntegerField(default=0)), |
||||
|
], |
||||
|
options={ |
||||
|
'db_table': 'flowcache', |
||||
|
}, |
||||
|
) |
||||
|
] |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue