#add message

This commit is contained in:
xieshen 2021-02-06 14:50:55 +08:00
parent 1eff922cd4
commit 519ef557fa
14 changed files with 42 additions and 35 deletions

View File

@ -423,15 +423,21 @@ def import_user(request):
name = r[1]
zhiwei = r[2]
phone = r[3]
print(organization)
o = Organization.objects.get(name=organization)
password = str(phone)[5:]
if phone:
try:
user = User.objects.create_user(username=phone, password=password, last_login=timezone.now())
user.save()
u = Userprofile(user_id=user.id, organization_id=o.id, status=1, image='/profile/user_default.jpg',
sex='', name=name, zhiwei=zhiwei)
u.save()
if User.objects.filter(username=phone).count() == 0:
user = User.objects.create_user(username=phone, password=password, last_login=timezone.now())
user.save()
u = Userprofile(user_id=user.id, organization_id=o.id, status=1, image='/profile/user_default.jpg',
sex='', name=name, zhiwei=zhiwei)
u.save()
else:
if '平凉' in organization:
print(organization)
Userprofile.objects.filter(user__username=phone).update(organization_id=o.id)
except:
print(phone)
return HttpResponse('ok')

View File

@ -32,11 +32,12 @@ def new_media_public_opinion_weixin(request):
o = dict()
o['id'] = str(w.id)
o['code'] = w.weixin.code
o['mp'] = w.mp
o['title'] = w.title
o['reply'] = w.reply
o['year'] = w.year
o['month'] = w.month
o['day'] = w.day
o['content'] = w.content
o['author'] = w.author
o['timestamp'] = w.timestamp
o['link'] = w.link
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weixin.html',
{'res': res, 'weixin': weixin, 'group': group})
@ -46,7 +47,7 @@ def new_media_public_opinion_weixin(request):
def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all()
group = Group.objects.all()
toutiao_data = Toutiao_data.objects.all().order_by('-count')
toutiao_data = Toutiao_data.objects.all().order_by('-likenum')
res = []
for t in toutiao_data:
o = dict()

View File

@ -34,7 +34,7 @@ def set_csv_weixin(path):
# "delete from dashboard_qita where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit()
elif r[1] == '新增':
with open('D:/2020/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
with open('D:/2021/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
t = csv.reader(c)
for i in t:
print(re.sub('\s+', '', r[0]).strip(),re.sub('\s+', '', str(i[4]+i[7])).strip())
@ -62,4 +62,4 @@ def set_csv_weixin(path):
print(e)
if __name__ == '__main__':
set_csv_weixin('D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_其他_账号名称更改.csv')
set_csv_weixin('D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_其他_账号名称更改.csv')

View File

@ -33,7 +33,7 @@ def set_csv_weixin(path):
# "delete from dashboard_organization where name = '%s'" %(r[0]))
# connection.commit()
elif r[1] == '新增':
with open('D:/2020/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
with open('D:/2021/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
t = csv.reader(c)
for i in t:
if r[0].replace(' ', '') == i[1].replace(' ', ''):
@ -51,4 +51,4 @@ def set_csv_weixin(path):
if __name__ == '__main__':
set_csv_weixin('D:/2020/舆论监测平台/数据/数据库更新/单位名称对比结果.csv')
set_csv_weixin('D:/2021/舆论监测平台/数据/数据库更新/单位名称对比结果.csv')

View File

@ -34,7 +34,7 @@ def set_csv_weixin(path):
# "delete from dashboard_toutiao where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit()
elif r[1] == '新增':
with open('D:/2020/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
with open('D:/2021/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
t = csv.reader(c)
for i in t:
print(i[4],r[0])
@ -61,4 +61,4 @@ def set_csv_weixin(path):
print(e)
if __name__ == '__main__':
set_csv_weixin('D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_头条_账号名称更改.csv')
set_csv_weixin('D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_头条_账号名称更改.csv')

View File

@ -35,7 +35,7 @@ def set_csv_weixin(path):
# connection.commit()
elif r[1] == '新增':
# s = str(r[2]).split('[')[1].split(']')[0].replace("'","").split(',')
with open('D:/2020/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
with open('D:/2021/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
t = csv.reader(c)
for i in t:
# print(i[4],r[0])
@ -66,4 +66,4 @@ def set_csv_weixin(path):
if __name__ == '__main__':
set_csv_weixin('D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_微信_账号名称更改.csv')
set_csv_weixin('D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_微信_账号名称更改.csv')

View File

@ -34,7 +34,7 @@ def set_csv_weixin(path):
# "delete from dashboard_weibo where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit()
elif r[1] == '新增':
with open('D:/2020/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
with open('D:/2021/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
t = csv.reader(c)
for i in t:
@ -59,4 +59,4 @@ def set_csv_weixin(path):
print(e)
if __name__ == '__main__':
set_csv_weixin('D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_微博_账号名称更改.csv')
set_csv_weixin('D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_微博_账号名称更改.csv')

View File

@ -34,7 +34,7 @@ def set_csv_weixin(path):
# "delete from dashboard_douyin where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit()
elif r[1] == '新增':
with open('D:/2020/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
with open('D:/2021/舆论监测平台/数据/Task_All.csv',encoding='utf-8') as c:
t = csv.reader(c)
for i in t:
print(i[4],r[0])
@ -52,7 +52,7 @@ def set_csv_weixin(path):
print(c[0] + "22222222222222222222222222222222222")
id = uuid.uuid4()
cursor.execute(
"insert into dashboard_douyin(id,code, created, updated,organization_id,image,alias,status,douyinid,attention, remark,identificationcode,function,articleurl) values (%s,%s,now(),now(),%s,'douyin.png','',3,%s,'','',%s,%s,%s)",
"insert into dashboard_douyin(id,code, created, updated,organization_id,image,alias,status,douyinid,attention, remark,identificationcode,function,articleurl) values (%s,%s,now(),now(),%s,'douyin.jpg','',3,%s,'','',%s,%s,%s)",
(str(id), re.sub('\s+', '', i[4]).strip(), c[0], i[13], i[3], i[8], i[12]))
connection.commit()
@ -61,4 +61,4 @@ def set_csv_weixin(path):
print(e)
if __name__ == '__main__':
set_csv_weixin('D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_抖音_账号名称更改.csv')
set_csv_weixin('D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_抖音_账号名称更改.csv')

View File

@ -22,7 +22,7 @@ G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=new
def get_csv_weixin(path):
with open("D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_其他_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
with open("D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_其他_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
qita_code_list = []
csv_code_list = []
@ -57,4 +57,4 @@ def get_csv_weixin(path):
writer.writerow(
[i, '异常'])
if __name__ == '__main__':
get_csv_weixin('D:/2020/舆论监测平台/数据/Task_All.csv')
get_csv_weixin('D:/2021/舆论监测平台/数据/Task_All.csv')

View File

@ -22,7 +22,7 @@ G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=new
def get_csv_weixin(path):
with open("D:/2020/舆论监测平台/数据/数据库更新/单位名称对比结果.csv", "w", newline='',encoding='utf-8') as csvfile:
with open("D:/2021/舆论监测平台/数据/数据库更新/单位名称对比结果.csv", "w", newline='',encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
o_code_list = []
@ -56,4 +56,4 @@ def get_csv_weixin(path):
writer.writerow(
[i, '异常'])
if __name__ == '__main__':
get_csv_weixin('D:/2020/舆论监测平台/数据/Task_All.csv')
get_csv_weixin('D:/2021/舆论监测平台/数据/Task_All.csv')

View File

@ -22,7 +22,7 @@ G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=new
def get_csv_weixin(path):
with open("D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_头条_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
with open("D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_头条_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
toutiao_code_list = []
csv_code_list = []
@ -57,4 +57,4 @@ def get_csv_weixin(path):
writer.writerow(
[i, '异常'])
if __name__ == '__main__':
get_csv_weixin('D:/2020/舆论监测平台/数据/Task_All.csv')
get_csv_weixin('D:/2021/舆论监测平台/数据/Task_All.csv')

View File

@ -22,7 +22,7 @@ G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=new
def get_csv_weixin(path):
with open("D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_微信_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
with open("D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_微信_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
weixin_code_list = []
csv_code_list = []
@ -57,4 +57,4 @@ def get_csv_weixin(path):
writer.writerow(
[i, '异常'])
if __name__ == '__main__':
get_csv_weixin('D:/2020/舆论监测平台/数据/Task_All.csv')
get_csv_weixin('D:/2021/舆论监测平台/数据/Task_All.csv')

View File

@ -22,7 +22,7 @@ G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=new
def get_csv_weixin(path):
with open("D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_微博_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
with open("D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_微博_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(
["账号", "备注"])
@ -58,4 +58,4 @@ def get_csv_weixin(path):
writer.writerow(
[i, '异常'])
if __name__ == '__main__':
get_csv_weixin('D:/2020/舆论监测平台/数据/Task_All.csv')
get_csv_weixin('D:/2021/舆论监测平台/数据/Task_All.csv')

View File

@ -22,7 +22,7 @@ G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=new
def get_csv_weixin(path):
with open("D:/2020/舆论监测平台/数据/数据库更新/新媒体对比结果_抖音_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
with open("D:/2021/舆论监测平台/数据/数据库更新/新媒体对比结果_抖音_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(
["账号", "备注"])
@ -59,4 +59,4 @@ def get_csv_weixin(path):
writer.writerow(
[i, '异常'])
if __name__ == '__main__':
get_csv_weixin('D:/2020/舆论监测平台/数据/Task_All.csv')
get_csv_weixin('D:/2021/舆论监测平台/数据/Task_All.csv')