mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-09-11 12:07:39 +02:00
v6.8.12
1. Add disk IO information to the homepage 2. Add a clear list button in the upload window 3. Optimize the background task overhead of the panel 4. Optimize the disk information caching mechanism 5. Panel Pro edition is online 6. Optimize panel resource usage 7. Optimize SSL certificate renewal 8. Fix the problem of reporting an error when the security entrance is empty 9. Fix the problem of infinite recursion when copying directories in extreme cases
This commit is contained in:
+59
-3
@@ -4,26 +4,81 @@
|
||||
# +-------------------------------------------------------------------
|
||||
# | Copyright (c) 2015-2099 宝塔软件(http://bt.cn) All rights reserved.
|
||||
# +-------------------------------------------------------------------
|
||||
# | Author: hwliang <hwl@bt.cn>
|
||||
# | Author: hwliang <2020-05-18>
|
||||
# +-------------------------------------------------------------------
|
||||
|
||||
# +-------------------------------------------------------------------
|
||||
# | 消息提醒
|
||||
# +-------------------------------------------------------------------
|
||||
import os,sys,time
|
||||
import public
|
||||
class panelMessage:
|
||||
import public,json
|
||||
if os.environ.get('BT_TASK') != '1':
|
||||
from BTPanel import cache
|
||||
else:
|
||||
import cachelib
|
||||
cache = cachelib.SimpleCache()
|
||||
|
||||
class panelMessage:
|
||||
os = 'linux'
|
||||
|
||||
def __init__(self):
|
||||
# if not public.M('sqlite_master').where('type=? AND name=? AND sql LIKE ?', ('table', 'messages','%retry_num%')).count():
|
||||
# public.M('messages').execute("alter TABLE messages add send integer DEFAULT 0",())
|
||||
# public.M('messages').execute("alter TABLE messages add retry_num integer DEFAULT 0",())
|
||||
pass
|
||||
|
||||
|
||||
def set_send_status(self, id, data):
|
||||
'''
|
||||
@name 设置消息发送状态
|
||||
@author cjxin <2021-04-12>
|
||||
@param args dict_obj{
|
||||
id: 消息标识,
|
||||
data
|
||||
}
|
||||
@return dict
|
||||
'''
|
||||
|
||||
public.M('messages').where('id=?',id).update(data)
|
||||
return public.returnMsg(True,'设置成功!')
|
||||
|
||||
|
||||
"""
|
||||
获取官网推送消息,一小时获取一次
|
||||
"""
|
||||
def get_cloud_messages(self,args):
|
||||
#ret = cache.get('get_cloud_messages')
|
||||
#if ret: return public.returnMsg(True,'同步成功1!')
|
||||
data = {}
|
||||
data['version'] = public.version()
|
||||
data['os'] = self.os
|
||||
sUrl = public.GetConfigValue('home') + '/api/wpanel/get_messages'
|
||||
import http_requests
|
||||
http_requests.DEFAULT_TYPE = 'src'
|
||||
info = http_requests.post(sUrl,data).json()
|
||||
# info = json.loads(public.httpPost(sUrl,data))
|
||||
for x in info:
|
||||
count = public.M('messages').where('level=? and msg=?',(x['level'],x['msg'],)).count()
|
||||
if count: continue
|
||||
|
||||
pdata = {
|
||||
"level":x['level'],
|
||||
"msg":x['msg'],
|
||||
"state":1,
|
||||
"expire":int(time.time()) + (int(x['expire']) * 86400),
|
||||
"addtime": int(time.time())
|
||||
}
|
||||
public.M('messages').insert(pdata)
|
||||
#cache.set('get_cloud_messages',3600)
|
||||
return public.returnMsg(True,'同步成功!')
|
||||
|
||||
def get_messages(self,args = None):
|
||||
'''
|
||||
@name 获取消息列表
|
||||
@author hwliang <2020-05-18>
|
||||
@return list
|
||||
'''
|
||||
self.get_cloud_messages(args)
|
||||
data = public.M('messages').where('state=? and expire>?',(1,int(time.time()))).order("id desc").select()
|
||||
return data
|
||||
|
||||
@@ -33,6 +88,7 @@ class panelMessage:
|
||||
@author hwliang <2020-05-18>
|
||||
@return list
|
||||
'''
|
||||
self.get_cloud_messages(args)
|
||||
data = public.M('messages').order("id desc").select()
|
||||
return data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user