#add message

This commit is contained in:
xieshen 2020-12-25 08:55:34 +08:00
parent 4cbdd65caa
commit 0893dc410f
3 changed files with 32 additions and 12 deletions

View File

@ -211,8 +211,12 @@ def timeliness_monitoring_weibo(request):
this_week_end = now + timedelta(days=6 - now.weekday()) this_week_end = now + timedelta(days=6 - now.weekday())
# 本月第一天和最后一天 # 本月第一天和最后一天
this_month_start = datetime.datetime(now.year, now.month, 1) this_month_start = datetime.datetime(now.year, now.month, 1)
if now.month != 12:
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta( this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59) hours=23, minutes=59, seconds=59)
else:
this_month_end = datetime.datetime(now.year, now.month , 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
# 新媒体数量 # 新媒体数量
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int( new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count()) Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count())
@ -286,8 +290,12 @@ def timeliness_monitoring_toutiao(request):
this_week_end = now + timedelta(days=6 - now.weekday()) this_week_end = now + timedelta(days=6 - now.weekday())
# 本月第一天和最后一天 # 本月第一天和最后一天
this_month_start = datetime.datetime(now.year, now.month, 1) this_month_start = datetime.datetime(now.year, now.month, 1)
if now.month != 12:
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta( this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59) hours=23, minutes=59, seconds=59)
else:
this_month_end = datetime.datetime(now.year, now.month, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
# 新媒体数量 # 新媒体数量
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int( new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count()) Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count())
@ -361,8 +369,12 @@ def timeliness_monitoring_douyin(request):
this_week_end = now + timedelta(days=6 - now.weekday()) this_week_end = now + timedelta(days=6 - now.weekday())
# 本月第一天和最后一天 # 本月第一天和最后一天
this_month_start = datetime.datetime(now.year, now.month, 1) this_month_start = datetime.datetime(now.year, now.month, 1)
if now.month != 12:
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta( this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59) hours=23, minutes=59, seconds=59)
else:
this_month_end = datetime.datetime(now.year, now.month , 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
# 新媒体数量 # 新媒体数量
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int( new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count()) Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count())
@ -436,8 +448,12 @@ def timeliness_monitoring_qita(request):
this_week_end = now + timedelta(days=6 - now.weekday()) this_week_end = now + timedelta(days=6 - now.weekday())
# 本月第一天和最后一天 # 本月第一天和最后一天
this_month_start = datetime.datetime(now.year, now.month, 1) this_month_start = datetime.datetime(now.year, now.month, 1)
if now.month != 12:
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta( this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59) hours=23, minutes=59, seconds=59)
else:
this_month_end = datetime.datetime(now.year, now.month, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
# 新媒体数量 # 新媒体数量
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int( new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count()) Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count())

View File

@ -0,0 +1,4 @@
from django.contrib.auth.hashers import check_password
ret = check_password('pbkdf2_sha256$150000$LBaozG7pOJi0$NmnUi3PdroAB5tXlnzu3IARdnzUYE+n5lLEPb0/Zm0I=',encoded='pbkdf2_sha256')
print(ret)

View File

@ -27,7 +27,7 @@ def get_csv_weixin(path):
reader = csv.reader(csvfile) reader = csv.reader(csvfile)
for r in reader: for r in reader:
if r[1] != '单位全称': if r[1] != '单位全称':
if '兰州' in r[10]: if '白银' in r[10]:
p_list.append(r[14]) p_list.append(r[14])
print(len(list(set(p_list)))) print(len(list(set(p_list))))
for l in list(set(p_list)): for l in list(set(p_list)):
@ -42,10 +42,10 @@ def get_csv_weixin(path):
print(c[11]) print(c[11])
id = uuid.uuid4() id = uuid.uuid4()
cursor.execute( cursor.execute(
"insert into dashboard_group_user(id,created, updated, group_id, user_id) values (%s,now(),now(),'dc85d7a7-5c9a-4aa1-b872-ebc16b1eb0e2',%s)", (str(id), c[11])) "insert into dashboard_group_user(id,created, updated, group_id, user_id) values (%s,now(),now(),'4efd485e-2873-440d-b828-b58b39b9b0d2',%s)", (str(id), c[11]))
connection.commit() connection.commit()
except Exception as e: except Exception as e:
print(e) print(e,'+++++++',l)
if __name__ == '__main__': if __name__ == '__main__':
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv') get_csv_weixin('F:/TASK_ALL.csv')