diff options
| author | handingkang <[email protected]> | 2024-01-12 22:23:56 +0800 |
|---|---|---|
| committer | handingkang <[email protected]> | 2024-01-12 22:23:56 +0800 |
| commit | d746216c620d8e200f7843a6bf8be0905e302264 (patch) | |
| tree | 4ad9307ea5581d23ba2d730a6827f8f706e72122 | |
| parent | 200cd83d621eb30f04808c4ab028d119a1a81dcc (diff) | |
1. sys接口v6count开发尝试
2. neomodel模型定义
| -rw-r--r-- | apps/model.py | 34 | ||||
| -rw-r--r-- | apps/sys.py | 4 |
2 files changed, 37 insertions, 1 deletions
diff --git a/apps/model.py b/apps/model.py new file mode 100644 index 0000000..b473391 --- /dev/null +++ b/apps/model.py @@ -0,0 +1,34 @@ +from neomodel import StructuredNode, StringProperty, DateTimeFormatProperty, IntegerProperty, BooleanProperty, \ + RelationshipTo, StructuredRel + + +class RelResolver53(StructuredRel): + W = IntegerProperty() + LTIME = DateTimeFormatProperty(default_now=True, format="%Y-%m-%d %H:%M:%S") + + +class RelResolverQuery(StructuredRel): + W = IntegerProperty() + + +class NodeResolverQuery(StructuredNode): + QNAME = StringProperty(required=True) + QTYPE = StringProperty() + + +class NodeResolver53(StructuredNode): + IP = StringProperty(required=True, unique_index=True) + AS = StringProperty() + ISP = StringProperty() + COU = StringProperty() + CCODE = StringProperty() + PROV = StringProperty() + LAT = StringProperty() + LNG = StringProperty() + IPType = StringProperty() + FTIME = DateTimeFormatProperty(format="%Y-%m-%d %H:%M:%S") + LTIME = DateTimeFormatProperty(default_now=True, format="%Y-%m-%d %H:%M:%S") + W = IntegerProperty() + ISPUBLIC = BooleanProperty(default=False) + LINK = RelationshipTo("NodeResolver53", "IP_LINK", model=RelResolver53) + QLINK = RelationshipTo("NodeResolverQuery", "Q_LINK", model=RelResolverQuery) diff --git a/apps/sys.py b/apps/sys.py index cce9986..9688608 100644 --- a/apps/sys.py +++ b/apps/sys.py @@ -5,6 +5,8 @@ import pymysql from apiflask import APIBlueprint from neomodel import db, config +import model + bp = APIBlueprint('sys', __name__, url_prefix='/sys', description='获取系统运行时间、v6&双栈数据总数、每日增长') @@ -59,4 +61,4 @@ def sysdays(): @bp.get("/v6count") def sysv6count(): - cypher = "" + return len(model.NodeResolver53.nodes.filter(IPType="v6")) |
