#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] name = r[1]
zhiwei = r[2] zhiwei = r[2]
phone = r[3] phone = r[3]
print(organization)
o = Organization.objects.get(name=organization) o = Organization.objects.get(name=organization)
password = str(phone)[5:] password = str(phone)[5:]
if phone: if phone:
try: try:
user = User.objects.create_user(username=phone, password=password, last_login=timezone.now()) if User.objects.filter(username=phone).count() == 0:
user.save() user = User.objects.create_user(username=phone, password=password, last_login=timezone.now())
u = Userprofile(user_id=user.id, organization_id=o.id, status=1, image='/profile/user_default.jpg', user.save()
sex='', name=name, zhiwei=zhiwei) u = Userprofile(user_id=user.id, organization_id=o.id, status=1, image='/profile/user_default.jpg',
u.save() 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: except:
print(phone) print(phone)
return HttpResponse('ok') return HttpResponse('ok')

View File

@ -32,11 +32,12 @@ def new_media_public_opinion_weixin(request):
o = dict() o = dict()
o['id'] = str(w.id) o['id'] = str(w.id)
o['code'] = w.weixin.code o['code'] = w.weixin.code
o['mp'] = w.mp
o['title'] = w.title o['title'] = w.title
o['reply'] = w.reply o['content'] = w.content
o['year'] = w.year o['author'] = w.author
o['month'] = w.month o['timestamp'] = w.timestamp
o['day'] = w.day o['link'] = w.link
res.append(o) res.append(o)
return render(request, 'monitor/new-media-public-opinion-weixin.html', return render(request, 'monitor/new-media-public-opinion-weixin.html',
{'res': res, 'weixin': weixin, 'group': group}) {'res': res, 'weixin': weixin, 'group': group})
@ -46,7 +47,7 @@ def new_media_public_opinion_weixin(request):
def new_media_public_opinion_toutiao(request): def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all() toutiao = Toutiao.objects.all()
group = Group.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 = [] res = []
for t in toutiao_data: for t in toutiao_data:
o = dict() 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())) # "delete from dashboard_qita where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit() # connection.commit()
elif r[1] == '新增': 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) t = csv.reader(c)
for i in t: for i in t:
print(re.sub('\s+', '', r[0]).strip(),re.sub('\s+', '', str(i[4]+i[7])).strip()) 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) print(e)
if __name__ == '__main__': 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])) # "delete from dashboard_organization where name = '%s'" %(r[0]))
# connection.commit() # connection.commit()
elif r[1] == '新增': 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) t = csv.reader(c)
for i in t: for i in t:
if r[0].replace(' ', '') == i[1].replace(' ', ''): if r[0].replace(' ', '') == i[1].replace(' ', ''):
@ -51,4 +51,4 @@ def set_csv_weixin(path):
if __name__ == '__main__': 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())) # "delete from dashboard_toutiao where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit() # connection.commit()
elif r[1] == '新增': 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) t = csv.reader(c)
for i in t: for i in t:
print(i[4],r[0]) print(i[4],r[0])
@ -61,4 +61,4 @@ def set_csv_weixin(path):
print(e) print(e)
if __name__ == '__main__': 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() # connection.commit()
elif r[1] == '新增': elif r[1] == '新增':
# s = str(r[2]).split('[')[1].split(']')[0].replace("'","").split(',') # 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) t = csv.reader(c)
for i in t: for i in t:
# print(i[4],r[0]) # print(i[4],r[0])
@ -66,4 +66,4 @@ def set_csv_weixin(path):
if __name__ == '__main__': 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())) # "delete from dashboard_weibo where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit() # connection.commit()
elif r[1] == '新增': 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) t = csv.reader(c)
for i in t: for i in t:
@ -59,4 +59,4 @@ def set_csv_weixin(path):
print(e) print(e)
if __name__ == '__main__': 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())) # "delete from dashboard_douyin where code = '%s'" %(re.sub('\s+', '', r[0]).strip()))
# connection.commit() # connection.commit()
elif r[1] == '新增': 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) t = csv.reader(c)
for i in t: for i in t:
print(i[4],r[0]) print(i[4],r[0])
@ -52,7 +52,7 @@ def set_csv_weixin(path):
print(c[0] + "22222222222222222222222222222222222") print(c[0] + "22222222222222222222222222222222222")
id = uuid.uuid4() id = uuid.uuid4()
cursor.execute( 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])) (str(id), re.sub('\s+', '', i[4]).strip(), c[0], i[13], i[3], i[8], i[12]))
connection.commit() connection.commit()
@ -61,4 +61,4 @@ def set_csv_weixin(path):
print(e) print(e)
if __name__ == '__main__': 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): 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 = csv.writer(csvfile)
qita_code_list = [] qita_code_list = []
csv_code_list = [] csv_code_list = []
@ -57,4 +57,4 @@ def get_csv_weixin(path):
writer.writerow( writer.writerow(
[i, '异常']) [i, '异常'])
if __name__ == '__main__': 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): 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 = csv.writer(csvfile)
o_code_list = [] o_code_list = []
@ -56,4 +56,4 @@ def get_csv_weixin(path):
writer.writerow( writer.writerow(
[i, '异常']) [i, '异常'])
if __name__ == '__main__': 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): 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 = csv.writer(csvfile)
toutiao_code_list = [] toutiao_code_list = []
csv_code_list = [] csv_code_list = []
@ -57,4 +57,4 @@ def get_csv_weixin(path):
writer.writerow( writer.writerow(
[i, '异常']) [i, '异常'])
if __name__ == '__main__': 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): 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 = csv.writer(csvfile)
weixin_code_list = [] weixin_code_list = []
csv_code_list = [] csv_code_list = []
@ -57,4 +57,4 @@ def get_csv_weixin(path):
writer.writerow( writer.writerow(
[i, '异常']) [i, '异常'])
if __name__ == '__main__': 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): 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 = csv.writer(csvfile)
writer.writerow( writer.writerow(
["账号", "备注"]) ["账号", "备注"])
@ -58,4 +58,4 @@ def get_csv_weixin(path):
writer.writerow( writer.writerow(
[i, '异常']) [i, '异常'])
if __name__ == '__main__': 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): 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 = csv.writer(csvfile)
writer.writerow( writer.writerow(
["账号", "备注"]) ["账号", "备注"])
@ -59,4 +59,4 @@ def get_csv_weixin(path):
writer.writerow( writer.writerow(
[i, '异常']) [i, '异常'])
if __name__ == '__main__': if __name__ == '__main__':
get_csv_weixin('D:/2020/舆论监测平台/数据/Task_All.csv') get_csv_weixin('D:/2021/舆论监测平台/数据/Task_All.csv')