Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mouday committed Apr 29, 2023
1 parent 3d818f9 commit 37266d5
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 更新日志

- v1.2.16(2023-04-29)
- 新增:增加筛选功能: 筛选域名状态、证书状态、网站状态
- 新增:增加批量删除域名的功能

- v1.2.15(2023-04-28)
- 优化:更新whois-servers.txt,感谢[@poctopus](https://github.com/poctopus)贡献代码

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ www.baidu.com:8080
- `已完成` webhook支持变量
- `已完成` 异步操作的前端状态显示
- 暗黑模式
- 支持内网用户自己设置过期时间
- 增加筛选功能: 筛选域名状态,筛选过期的域名
- 增加批量删除域名的功能
- `已完成` 支持内网用户自己设置过期时间
- `已完成` 增加筛选功能: 筛选域名状态、证书状态、网站状态
- `已完成` 增加批量删除域名的功能
证书测试:[https://badssl.com/](https://badssl.com/)
Expand Down
54 changes: 54 additions & 0 deletions domain_admin/api/domain_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-

from flask import request, g
from peewee import fn
from playhouse.shortcuts import model_to_dict

from domain_admin.model.domain_model import DomainModel
from domain_admin.model.group_model import GroupModel
from domain_admin.service import async_task_service
from domain_admin.service import domain_service, global_data_service
from domain_admin.service import file_service
Expand Down Expand Up @@ -110,6 +112,22 @@ def delete_domain_by_id():
DomainModel.delete_by_id(domain_id)


def delete_domain_by_ids():
"""
批量删除
@since v1.2.16
:return:
"""
current_user_id = g.user_id

domain_ids = request.json['ids']

DomainModel.delete().where(
DomainModel.id.in_(domain_ids),
DomainModel.user_id == current_user_id
).execute()


def get_domain_list():
"""
获取域名列表
Expand All @@ -124,6 +142,10 @@ def get_domain_list():

order_prop = request.json.get('order_prop', 'expire_days')
order_type = request.json.get('order_type', 'ascending')
group_ids = request.json.get('group_ids')
expire_days = request.json.get('expire_days')
domain_expire_days = request.json.get('domain_expire_days')
connect_status = request.json.get('connect_status')

query = DomainModel.select().where(
DomainModel.user_id == current_user_id
Expand All @@ -135,6 +157,38 @@ def get_domain_list():
if keyword:
query = query.where(DomainModel.domain.contains(keyword))

if group_ids:
query = query.where(DomainModel.group_id.in_(group_ids))

if expire_days is not None:
if expire_days[0] is None:
query = query.where(DomainModel.expire_days <= expire_days[1])
elif expire_days[1] is None:
query = query.where(DomainModel.expire_days >= expire_days[0])
else:
query = query.where(DomainModel.expire_days.between(expire_days[0], expire_days[1]))

if domain_expire_days is not None:
if domain_expire_days[0] is None:
query = query.where(DomainModel.domain_expire_days <= domain_expire_days[1])
elif domain_expire_days[1] is None:
query = query.where(DomainModel.domain_expire_days >= domain_expire_days[0])
else:
query = query.where(DomainModel.domain_expire_days.between(domain_expire_days[0], domain_expire_days[1]))

if connect_status is not None:
# 连接正常
if connect_status == 'success':
connect_status = True
# 连接异常
elif connect_status == 'error':
connect_status = False
# 状态未知
elif connect_status == 'unknown':
connect_status = None

query = query.where(DomainModel.connect_status == connect_status)

ordering = []
if order_prop == 'expire_days':
if order_type == 'descending':
Expand Down
1 change: 1 addition & 0 deletions domain_admin/router/api_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"/api/addDomain": domain_api.add_domain,
"/api/updateDomainById": domain_api.update_domain_by_id,
"/api/deleteDomainById": domain_api.delete_domain_by_id,
"/api/deleteDomainByIds": domain_api.delete_domain_by_ids,
"/api/getDomainList": domain_api.get_domain_list,
"/api/getDomainById": domain_api.get_domain_by_id,
"/api/updateDomainCertInfoById": domain_api.update_domain_cert_info_by_id,
Expand Down
2 changes: 2 additions & 0 deletions domain_admin/utils/cert_util/cert_openssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import ssl
import OpenSSL
import socket

from domain_admin.log import logger
from domain_admin.utils.cert_util import cert_common, cert_consts


Expand Down
2 changes: 1 addition & 1 deletion domain_admin/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"""
版本号
"""
VERSION = '1.2.15'
VERSION = '1.2.16'

0 comments on commit 37266d5

Please sign in to comment.