You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
1.8 KiB
106 lines
1.8 KiB
6 months ago
|
'''后端请求'''
|
||
|
from Model import DataDB as db
|
||
|
from Controller import Data2DB as d2b
|
||
|
from Controller import DataFetch
|
||
|
from Controller import DataMonitor
|
||
|
|
||
|
def login(name,pwd):
|
||
|
'''
|
||
|
登录处理
|
||
|
:param name:
|
||
|
:param pwd:
|
||
|
:return:
|
||
|
'''
|
||
|
status=False
|
||
|
res = db.getDataByName(name=name)
|
||
|
if res:
|
||
|
if pwd==res[2]:status=True
|
||
|
return status
|
||
|
|
||
|
def getDataList(tableName):
|
||
|
'''
|
||
|
获取所有的数据
|
||
|
:param tableName:
|
||
|
:return:
|
||
|
'''
|
||
|
return db.getAllData(tableName=tableName)
|
||
|
|
||
|
def getDataListPage(tableName):
|
||
|
'''
|
||
|
获取数据的分页数量
|
||
|
:param tableName:
|
||
|
:param page:
|
||
|
:return:
|
||
|
'''
|
||
|
return db.getAllDataPage(tableName=tableName)
|
||
|
|
||
|
def getDataListByPage(tableName,page):
|
||
|
'''
|
||
|
获取分页的数据
|
||
|
:param tableName:
|
||
|
:param page:
|
||
|
:return:
|
||
|
'''
|
||
|
return db.getAllDataByPage(tableName=tableName,page=page)
|
||
|
|
||
|
def newsFetch(id):
|
||
|
'''
|
||
|
爬取新闻处理
|
||
|
:param id:
|
||
|
:return:
|
||
|
'''
|
||
|
return d2b.newsAdd(id)
|
||
|
|
||
|
def newsDelete(tableName,id):
|
||
|
'''
|
||
|
删除某一条指定的新闻
|
||
|
:param id:
|
||
|
:return:
|
||
|
'''
|
||
|
return db.delData(tableName,id)
|
||
|
|
||
|
def newsShow(tableName,id):
|
||
|
'''
|
||
|
显示某一条指定的新闻
|
||
|
:param id:
|
||
|
:return:
|
||
|
'''
|
||
|
return db.modifyData(tableName,1,id)
|
||
|
|
||
|
def yqFetch(id):
|
||
|
'''
|
||
|
爬取疫情处理
|
||
|
:param id:
|
||
|
:return:
|
||
|
'''
|
||
|
return d2b.yqAdd(id)
|
||
|
|
||
|
def getTemp():
|
||
|
'''
|
||
|
获取当时的温度
|
||
|
:return:
|
||
|
'''
|
||
|
return DataFetch.getWeatherInfo()
|
||
|
|
||
|
def searchdata(kw):
|
||
|
'''
|
||
|
模糊搜索
|
||
|
:param tablename:
|
||
|
:param kw:
|
||
|
:return:
|
||
|
'''
|
||
|
return db.searchData(kw=kw)
|
||
|
|
||
|
def getsysInfo():
|
||
|
'''
|
||
|
获取硬件信息
|
||
|
:return:
|
||
|
'''
|
||
|
return DataMonitor.getsysInfo()
|
||
|
|
||
|
def getSysLog(page):
|
||
|
'''
|
||
|
获取日志信息
|
||
|
:return:
|
||
|
'''
|
||
|
return DataMonitor.getsysLog(page)
|