Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehco1996 committed Nov 10, 2020
1 parent c3e9560 commit 9004f15
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 76 deletions.
63 changes: 14 additions & 49 deletions apps/sspanel/migrations/0001_squashed_0055_auto_20200726_0847.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,7 @@ class Migration(migrations.Migration):
"verbose_name_plural": "用户",
"abstract": False,
},
managers=[
("objects", django.contrib.auth.models.UserManager()),
],
managers=[("objects", django.contrib.auth.models.UserManager()),],
),
migrations.CreateModel(
name="Announcement",
Expand All @@ -317,10 +315,7 @@ class Migration(migrations.Migration):
("time", models.DateTimeField(auto_now_add=True, verbose_name="时间")),
("body", models.TextField(verbose_name="主体")),
],
options={
"verbose_name_plural": "系统公告",
"ordering": ("-time",),
},
options={"verbose_name_plural": "系统公告", "ordering": ("-time",),},
),
migrations.CreateModel(
name="Donate",
Expand Down Expand Up @@ -361,10 +356,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "捐赠记录",
"ordering": ("-time",),
},
options={"verbose_name_plural": "捐赠记录", "ordering": ("-time",),},
),
migrations.CreateModel(
name="Goods",
Expand Down Expand Up @@ -438,10 +430,7 @@ class Migration(migrations.Migration):
models.PositiveSmallIntegerField(default=1, verbose_name="排序"),
),
],
options={
"verbose_name_plural": "商品",
"ordering": ["order"],
},
options={"verbose_name_plural": "商品", "ordering": ["order"],},
),
migrations.CreateModel(
name="InviteCode",
Expand Down Expand Up @@ -517,10 +506,7 @@ class Migration(migrations.Migration):
),
("isused", models.BooleanField(default=False, verbose_name="是否使用")),
],
options={
"verbose_name_plural": "充值码",
"ordering": ("isused",),
},
options={"verbose_name_plural": "充值码", "ordering": ("isused",),},
),
migrations.CreateModel(
name="PurchaseHistory",
Expand Down Expand Up @@ -557,10 +543,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "购买记录",
"ordering": ("-created_at",),
},
options={"verbose_name_plural": "购买记录", "ordering": ("-created_at",),},
),
migrations.CreateModel(
name="RebateRecord",
Expand Down Expand Up @@ -597,10 +580,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"ordering": ("-created_at",),
"verbose_name_plural": "返利记录",
},
options={"ordering": ("-created_at",), "verbose_name_plural": "返利记录",},
),
migrations.CreateModel(
name="Ticket",
Expand Down Expand Up @@ -632,10 +612,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "工单",
"ordering": ("-time",),
},
options={"verbose_name_plural": "工单", "ordering": ("-time",),},
),
migrations.CreateModel(
name="UserOrder",
Expand Down Expand Up @@ -839,9 +816,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "邮件发送记录",
},
options={"verbose_name_plural": "邮件发送记录",},
),
migrations.CreateModel(
name="NodeOnlineLog",
Expand Down Expand Up @@ -1032,9 +1007,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "Vmess节点",
},
options={"verbose_name_plural": "Vmess节点",},
),
migrations.CreateModel(
name="SSNode",
Expand Down Expand Up @@ -1180,9 +1153,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "SS节点",
},
options={"verbose_name_plural": "SS节点",},
),
migrations.CreateModel(
name="RelayNode",
Expand Down Expand Up @@ -1300,9 +1271,7 @@ class Migration(migrations.Migration):
),
("level", models.PositiveIntegerField(default=0)),
],
options={
"verbose_name_plural": "中转节点",
},
options={"verbose_name_plural": "中转节点",},
),
migrations.CreateModel(
name="SSRelayRule",
Expand Down Expand Up @@ -1356,9 +1325,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "SS转发规则",
},
options={"verbose_name_plural": "SS转发规则",},
),
migrations.CreateModel(
name="VmessRelayRule",
Expand Down Expand Up @@ -1412,8 +1379,6 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "Vmess转发规则",
},
options={"verbose_name_plural": "Vmess转发规则",},
),
]
8 changes: 2 additions & 6 deletions apps/sspanel/migrations/0004_auto_20201108_0400.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "Trojan节点",
},
options={"verbose_name_plural": "Trojan节点",},
),
migrations.AddField(
model_name="relaynode",
Expand Down Expand Up @@ -285,8 +283,6 @@ class Migration(migrations.Migration):
),
),
],
options={
"verbose_name_plural": "Trojan转发规则",
},
options={"verbose_name_plural": "Trojan转发规则",},
),
]
10 changes: 2 additions & 8 deletions apps/sspanel/migrations/0005_auto_20201110_2208.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RemoveField(
model_name="trojannode",
name="certificateFile",
),
migrations.RemoveField(
model_name="trojannode",
name="keyFile",
),
migrations.RemoveField(model_name="trojannode", name="certificateFile",),
migrations.RemoveField(model_name="trojannode", name="keyFile",),
migrations.AddField(
model_name="trojannode",
name="certificate_file",
Expand Down
9 changes: 2 additions & 7 deletions apps/sspanel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,7 @@ class BaseAbstractNode(models.Model):
total_traffic = models.BigIntegerField("总流量", default=settings.GB)
enable = models.BooleanField("是否开启", default=True, db_index=True)
enlarge_scale = models.DecimalField(
"倍率",
default=Decimal("1.0"),
decimal_places=2,
max_digits=10,
"倍率", default=Decimal("1.0"), decimal_places=2, max_digits=10,
)

ehco_listen_host = models.CharField("隧道监听地址", max_length=64, blank=True, null=True)
Expand Down Expand Up @@ -1167,9 +1164,7 @@ def trojan_inbound(self):
"protocol": "trojan",
"listen": self.listen_host,
"tag": self.inbound_tag,
"settings": {
"clients": [],
},
"settings": {"clients": [],},
"streamSettings": {
"network": self.network,
"security": self.security,
Expand Down
9 changes: 3 additions & 6 deletions apps/sspanel/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def sync_user_ss_traffic_task(node_id, data):

# 用户流量
m.User.objects.bulk_update(
user_model_list,
["download_traffic", "upload_traffic", "last_use_time"],
user_model_list, ["download_traffic", "upload_traffic", "last_use_time"],
)
# 节点流量记录
m.SSNode.increase_used_traffic(node_id, node_total_traffic)
Expand Down Expand Up @@ -130,8 +129,7 @@ def sync_user_vmess_traffic_task(node_id, data):
m.UserTrafficLog.objects.bulk_create(trafficlog_model_list)
# 个人流量记录
m.User.objects.bulk_update(
user_model_list,
["download_traffic", "upload_traffic", "last_use_time"],
user_model_list, ["download_traffic", "upload_traffic", "last_use_time"],
)
# 节点在线人数
m.NodeOnlineLog.add_log(m.NodeOnlineLog.NODE_TYPE_VMESS, node_id, len(data))
Expand Down Expand Up @@ -184,8 +182,7 @@ def sync_user_trojan_traffic_task(node_id, data):
m.UserTrafficLog.objects.bulk_create(trafficlog_model_list)
# 个人流量记录
m.User.objects.bulk_update(
user_model_list,
["download_traffic", "upload_traffic", "last_use_time"],
user_model_list, ["download_traffic", "upload_traffic", "last_use_time"],
)
# 节点在线人数
m.NodeOnlineLog.add_log(m.NodeOnlineLog.NODE_TYPE_TROJAN, node_id, len(data))
Expand Down

0 comments on commit 9004f15

Please sign in to comment.