zhangnaiwen 2 лет назад
Родитель
Сommit
28ac424736

+ 2 - 0
src/app/api/__init__.py

@@ -5,6 +5,7 @@ from app.api.users import ns as users
 from app.api.organization import ns as organization
 from app.api.organization import ns as organization
 from app.api.role import ns as role
 from app.api.role import ns as role
 from app.api.data import ns as data
 from app.api.data import ns as data
+from app.api.log import ns as log
 
 
 api = Api(version='v1.0', title='operation_management_center', description='运营管理中心', doc='/api')
 api = Api(version='v1.0', title='operation_management_center', description='运营管理中心', doc='/api')
 
 
@@ -13,3 +14,4 @@ api.add_namespace(users)
 api.add_namespace(organization)
 api.add_namespace(organization)
 api.add_namespace(role)
 api.add_namespace(role)
 api.add_namespace(data)
 api.add_namespace(data)
+api.add_namespace(log)

+ 39 - 0
src/app/api/log.py

@@ -0,0 +1,39 @@
+from flask import request, jsonify
+from flask_restx import Resource, Namespace, reqparse
+
+from app.defines import StatesCode
+
+ns = Namespace('log', description='日志管理接口')
+
+log_list = reqparse.RequestParser(bundle_errors=True)
+log_list.add_argument(name='page_size', type=int, location='args', required=False, help='每页记录数量,默认:20')
+log_list.add_argument(name='page', type=int, location='args', required=False, help='第几页')
+
+
+@ns.route('/log_list')
+class LogList(Resource):
+    def get(self):
+        """获取日志列表"""
+        data = [
+            {'id': 1, 'module': '系统模块', 'methods': 'post', 'people': '张三', 'ip': '127.0.0.1', 'place': '内网',
+             'status': 'ok', 'time': '2020-10-10'}
+        ]
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
+
+
+@ns.route('/log_search')
+class LogSearchApi(Resource):
+    def get(self):
+        """查询日志"""
+        data = [
+            {'id': 2, 'module': '系统模块', 'methods': 'post', 'people': '张三', 'ip': '127.0.0.1', 'place': '内网',
+             'status': 'ok', 'time': '2020-10-10'}
+        ]
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
+
+
+@ns.route('/log_export')
+class LogExportApi(Resource):
+    def get(self):
+        """日志导出"""
+        return 'logfile'

+ 76 - 0
src/app/api/meaasge.py

@@ -0,0 +1,76 @@
+from flask import request, jsonify
+from flask_restx import Resource, Namespace, reqparse
+
+from app.defines import StatesCode
+
+ns = Namespace('message', description='消息管理接口')
+
+
+class MessageApi(Resource):
+    def get(self):
+        """获取消息"""
+        data = {
+            'name': '年度消息',
+            'superior': None,
+            'config': '钉钉',
+            'personnel': '全体',
+            'time': '2020-10-10',
+            'title': '标题',
+            'content': '内容',
+            'style': '样式'
+        }
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
+
+    def put(self):
+        """修改消息"""
+        data = {
+            'name': '年度消息',
+            'superior': None,
+            'config': '钉钉',
+            'personnel': '全体',
+            'time': '2020-10-10',
+            'title': '标题',
+            'content': '内容',
+            'style': '样式'
+        }
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
+
+    def delete(self):
+        """删除消息"""
+
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data='')
+
+
+class InformationApi(Resource):
+    def get(self):
+        """获取信息"""
+        data = {
+            'name': '年度消息',
+            'superior': None,
+            'config': '钉钉',
+            'personnel': '全体',
+            'time': '2020-10-10',
+            'title': '标题',
+            'content': '内容',
+            'style': '样式'
+        }
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
+
+    def put(self):
+        """修改信息"""
+        data = {
+            'name': '年度消息',
+            'superior': None,
+            'config': '钉钉',
+            'personnel': '全体',
+            'time': '2020-10-10',
+            'title': '标题',
+            'content': '内容',
+            'style': '样式'
+        }
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
+
+    def delete(self):
+        """删除信息"""
+
+        return jsonify(code=StatesCode.SUCCESS, message='成功', data='')

+ 6 - 0
src/app/api/strategy.py

@@ -0,0 +1,6 @@
+from flask import request
+from flask_restx import Resource, Namespace, reqparse
+
+from app.defines import StatesCode
+
+ns = Namespace('strategy', description='策略管理接口')

+ 2 - 2
src/app/helpers/request_handlers.py

@@ -1,6 +1,6 @@
 from flask import request, abort
 from flask import request, abort
 
 
-from app.services.redis_service import get_uid_from_token
+# from app.services.redis_service import get_uid_from_token
 
 
 
 
 def configure(app):
 def configure(app):
@@ -12,7 +12,7 @@ def configure(app):
         """
         """
         token = request.headers.get('token')
         token = request.headers.get('token')
         if token:
         if token:
-            if get_uid_from_token(token):
+            # if get_uid_from_token(token):
                 abort(200)
                 abort(200)
 
 
         else:
         else:

+ 0 - 0
src/app/modle/__init__.py


+ 1 - 1
src/app/services/redis_service.py

@@ -1,6 +1,6 @@
 import redis
 import redis
 
 
-from configs.globals import REDIS_HOST, REDIS_PORT, REDIS_DB, REDIS_PWD, MOBILE_VERIFICATION_CODE_EXPIRED
+from app.configs.config import REDIS_HOST, REDIS_PORT, REDIS_DB
 
 
 # Redis使用连接池
 # Redis使用连接池
 redis_pool = redis.ConnectionPool(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB)
 redis_pool = redis.ConnectionPool(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB)