Commit 93ddb338 authored by lvshibao's avatar lvshibao

static_rule第一次刷新task_id没有赋值

parent 3903486d
......@@ -493,6 +493,8 @@ class TasksApi(viewsets.ViewSet):
task_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date}
if task_id:
task_condition['task'] = task_id
elif username:
task_condition['task'] = username
# tasks = RulesStat.objects.filter(**task_condition).values('rule', 'sessionCollectionId', 'rule_num')
tasks = RulesStat.objects.all().filter(**task_condition)\
.extra(select={'rule': "rule", 'sessionCollectionId': 'sessionCollectionId'})\
......
import mysql.connector
my_db = mysql.connector.connect(host="172.17.1.74", user="root", passwd='123456', port=3309, database="b774563252")
my_cursor = my_db.cursor()
print(my_cursor)
my_cursor.execute("SET FOREIGN_KEY_CHECKS = 0;")
my_cursor.execute("SHOW TABLES;")
name_list = list()
for name in my_cursor:
name_list.append(name)
# 1。 解除关系,关系接触之后注释掉
# for name in name_list:
# sql = "alter table " + name[0] + " discard tablespace;"
# print(sql)
# my_cursor.execute(sql)
# 将备份的ibd文件解压到b774563252文件夹,并将权限和用户及组改为660和polkitd input
# 2. 建立关系,跑解除关系的时候这里注释掉
for name in name_list:
sql = "alter table " + name[0] + " import tablespace;"
print(sql)
my_cursor.execute(sql)
my_cursor.execute("SET FOREIGN_KEY_CHECKS = 1;")
import hashlib
import time
import requests
def get_md5_value(src):
myMd5 = hashlib.md5()
myMd5.update(src.encode(encoding='UTF-8'))
myMd5_Digest = myMd5.hexdigest()
return myMd5_Digest
if __name__ == '__main__':
now = time.localtime()
timestamp = time.mktime(now)
key = 'znzjxt4132'
seqno = str(int(timestamp * 1000))
flowintime = time.strftime("%Y-%m-%d %H:%M:%S", now).replace('-', '').replace(' ', '').replace(':', '')
headers = {
'cmd': 'SendTemplateMsg',
'seqno': seqno,
'flowintime': flowintime,
'userid': 'znzjxt',
'token': get_md5_value('znzjxt' + seqno + key)
}
data = {
'startTimestamp': "2020-04-01 00:00:01",
'endTimestamp': "2020-04-01 23:59:59",
'from': 1,
'to': 10
}
resp = requests.post('https://38.1.32.58:8443/biwebback/inface/quality/getJhTrack',
json={'head': headers, 'body': data}, verify=False)
src = resp.json()['body']
desc = list()
for iterm in src:
if int(iterm['recordTime']) >= 60:
desc.append(iterm)
print(len(desc))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment