Archived
重写了app内的主函数, 并支持了MySQL数据库, 将所有关于数据库操作的代码全部重写
This commit is contained in:
19 files changed
+839
-516
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/28
|
||||
# @File Name: features.py
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from flask import jsonify
|
||||
from flask import Response
|
||||
|
||||
|
||||
class Features:
|
||||
"""特殊操作"""
|
||||
|
||||
def __init__(self, db) -> None:
|
||||
"""
|
||||
初始化
|
||||
:param db:
|
||||
"""
|
||||
self.db = db
|
||||
self.response = {'code': Optional[int],
|
||||
'msg': Optional[str],
|
||||
'data': Optional[list]}
|
||||
|
||||
def theme_list(self) -> Response:
|
||||
"""
|
||||
读取已有数据库并返回一个列表
|
||||
:return:
|
||||
"""
|
||||
table_list = self.db().show_tables
|
||||
self.response['code'] = 200
|
||||
self.response['msg'] = '当前已保存到数据库的主题如下'
|
||||
self.response['data'] = table_list
|
||||
return jsonify(self.response)
|
||||
Reference in New Issue
Block a user