#更换服务器
This commit is contained in:
parent
eb8e1472c6
commit
0d515f46c0
|
@ -34,52 +34,56 @@
|
|||
|
||||
|
||||
<ul class='wraplist'>
|
||||
<li {% if url_name == 'monitor-new-media-public-opinion-weixin' %} class="open" {% endif %} >
|
||||
<a href="{% url 'monitor-new-media-public-opinion-weixin' %}">
|
||||
<i class="fa fa-th"></i>
|
||||
<span class="title">新媒体舆情</span>
|
||||
</a>
|
||||
</li>
|
||||
{# <li class="open">#}
|
||||
<li {% if url_name == 'monitor-timeliness-monitoring-weixin' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-timeliness-monitoring-weixin' %}">
|
||||
<i class="fa fa-map-marker"></i>
|
||||
<span class="title">时效性监测</span>
|
||||
{# <span class="arrow "></span>#}
|
||||
</a>
|
||||
{# <ul class="sub-menu">#}
|
||||
{# <li>#}
|
||||
{# <a class="" href="">新媒体详情监测</a>#}
|
||||
{# </li>#}
|
||||
{# <li>#}
|
||||
{# <a class="" href="">页面详情</a>#}
|
||||
{# </li>#}
|
||||
{# </ul>#}
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-error-monitoring' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-error-monitoring' %}">
|
||||
<i class="fa fa-bar-chart"></i>
|
||||
<span class="title">错别字监测</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-sensitive-word-monitoring' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-sensitive-word-monitoring' %}">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
<span class="title">敏感词监测</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-comment-on-interactive-monitoring' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-comment-on-interactive-monitoring' %}">
|
||||
<i class="fa fa-th"></i>
|
||||
<span class="title">评论互动监测</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-monitoring-report' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-monitoring-report' %}">
|
||||
<i class="fa fa-suitcase"></i>
|
||||
<span class="title">监测报告</span>
|
||||
</a>
|
||||
</li>
|
||||
{% for u in user.userprofile_set.all %}
|
||||
{% if u.organization.level.level == 9 %}
|
||||
<li {% if url_name == 'monitor-new-media-public-opinion-weixin' %} class="open" {% endif %} >
|
||||
<a href="{% url 'monitor-new-media-public-opinion-weixin' %}">
|
||||
<i class="fa fa-th"></i>
|
||||
<span class="title">新媒体舆情</span>
|
||||
</a>
|
||||
</li>
|
||||
{# <li class="open">#}
|
||||
<li {% if url_name == 'monitor-timeliness-monitoring-weixin' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-timeliness-monitoring-weixin' %}">
|
||||
<i class="fa fa-map-marker"></i>
|
||||
<span class="title">时效性监测</span>
|
||||
{# <span class="arrow "></span>#}
|
||||
</a>
|
||||
{# <ul class="sub-menu">#}
|
||||
{# <li>#}
|
||||
{# <a class="" href="">新媒体详情监测</a>#}
|
||||
{# </li>#}
|
||||
{# <li>#}
|
||||
{# <a class="" href="">页面详情</a>#}
|
||||
{# </li>#}
|
||||
{# </ul>#}
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-error-monitoring' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-error-monitoring' %}">
|
||||
<i class="fa fa-bar-chart"></i>
|
||||
<span class="title">错别字监测</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-sensitive-word-monitoring' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-sensitive-word-monitoring' %}">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
<span class="title">敏感词监测</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-comment-on-interactive-monitoring' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-comment-on-interactive-monitoring' %}">
|
||||
<i class="fa fa-th"></i>
|
||||
<span class="title">评论互动监测</span>
|
||||
</a>
|
||||
</li>
|
||||
<li {% if url_name == 'monitor-monitoring-report' %} class="open" {% endif %}>
|
||||
<a href="{% url 'monitor-monitoring-report' %}">
|
||||
<i class="fa fa-suitcase"></i>
|
||||
<span class="title">监测报告</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<li {% if url_name|startswith:'group' %}class="open" {% endif %}>
|
||||
<a href="{% url 'group-management-management-init' %}">
|
||||
<i class="fa fa-sliders"></i>
|
||||
|
@ -186,10 +190,10 @@
|
|||
<a {% if url_name == 'backstage-comment' %} class="active" {% endif %}
|
||||
href="{% url 'backstage-comment' %}">评论</a>
|
||||
</li>
|
||||
{# <li>#}
|
||||
{# <a {% if url_name == 'backstage-user' %} class="active" {% endif %}#}
|
||||
{# href="{% url 'backstage-user' %}">用户</a>#}
|
||||
{# </li>#}
|
||||
{# <li>#}
|
||||
{# <a {% if url_name == 'backstage-user' %} class="active" {% endif %}#}
|
||||
{# href="{% url 'backstage-user' %}">用户</a>#}
|
||||
{# </li>#}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
|
|
@ -21,7 +21,7 @@ import psycopg2 as psycopg2
|
|||
G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
|
||||
|
||||
def get_csv_weixin(path):
|
||||
with open("D:/2020/新媒体监测/新媒体对比结果_其他.csv", "w", newline='') as csvfile:
|
||||
with open("D:/2020/新媒体监测/新媒体对比结果_微信_用户名更改.csv", "w", newline='') as csvfile:
|
||||
writer = csv.writer(csvfile)
|
||||
writer.writerow(
|
||||
["序号", "冲突账号"])
|
||||
|
@ -31,7 +31,7 @@ def get_csv_weixin(path):
|
|||
reader = csv.reader(csvfile)
|
||||
for r in reader:
|
||||
if r[1] != '单位全称':
|
||||
if '头条' not in r[7] and '微信' not in r[7] and '微博' not in r[7] and '抖音' not in r[7]:
|
||||
if '微信' in r[7] :
|
||||
name = r[1]
|
||||
code = r[4]
|
||||
identificationcode = r[3]
|
||||
|
@ -46,43 +46,50 @@ def get_csv_weixin(path):
|
|||
p_name = None
|
||||
|
||||
print(r)
|
||||
try:
|
||||
with connection.cursor() as cursor_p:
|
||||
cursor_p.execute(
|
||||
"select * from dashboard_area_code_2020 where name = '%s'" % (r[9]))
|
||||
for p in cursor_p:
|
||||
province = p[1]
|
||||
p_name = p[2]
|
||||
with connection.cursor() as cursor_c:
|
||||
cursor_c.execute(
|
||||
"select * from dashboard_area_code_2020 where name = '%s'" % (r[10]))
|
||||
for c in cursor_c:
|
||||
cities = c[1]
|
||||
c_name = c[2]
|
||||
with connection.cursor() as cursor_d:
|
||||
cursor_d.execute(
|
||||
"select * from dashboard_area_code_2020 where name = '%s'" % (r[11]))
|
||||
for d in cursor_d:
|
||||
district = d[1]
|
||||
d_name = d[2]
|
||||
print(code)
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute(
|
||||
"select * from dashboard_qita where code = '%s'" % (code))
|
||||
# connection.commit()
|
||||
with connection.cursor() as cursor_p:
|
||||
cursor_p.execute(
|
||||
"select * from dashboard_area_code_2020 where name = '%s' or name = '%s' or name = '%s'" % (r[9],r[10],r[11]))
|
||||
connection.commit()
|
||||
for p in cursor_p:
|
||||
province = p[1]
|
||||
p_name = p[2]
|
||||
# with connection.cursor() as cursor_c:
|
||||
# cursor_c.execute(
|
||||
# "select * from dashboard_area_code_2020 where name = '%s'" % (r[10]))
|
||||
# connection.commit()
|
||||
# for c in cursor_c:
|
||||
# cities = c[1]
|
||||
# c_name = c[2]
|
||||
# with connection.cursor() as cursor_d:
|
||||
# cursor_d.execute(
|
||||
# "select * from dashboard_area_code_2020 where name = '%s'" % (r[11]))
|
||||
# connection.commit()
|
||||
# for d in cursor_d:
|
||||
# district = d[1]
|
||||
# d_name = d[2]
|
||||
print(code)
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute(
|
||||
"select * from dashboard_qita where code = '%s'" % (code))
|
||||
connection.commit()
|
||||
# connection.commit()
|
||||
|
||||
for c in cursor:
|
||||
print(str(c[10]) + "1111111111111111111111")
|
||||
with connection.cursor() as cursor2:
|
||||
for c in cursor:
|
||||
# print(str(c[10]) + "1111111111111111111111")
|
||||
with connection.cursor() as cursor2:
|
||||
try:
|
||||
cursor2.execute(
|
||||
"select * from dashboard_organization where id = '%s'" % (c[10]))
|
||||
connection.commit()
|
||||
for c2 in cursor2:
|
||||
print(str(c2[0]) + "55555555555555555555555")
|
||||
# print(str(c2[0]) + "55555555555555555555555")
|
||||
|
||||
if str(name) == str(c2[1]) and str(province) == str(c2[3]) and str(
|
||||
cities) == str(c2[4]) and str(district) == str(c2[5]) and str(
|
||||
code) == str(c[1]) and str(identificationcode) == str(
|
||||
c[13]) and str(biz) == str(c[9]):
|
||||
# if str(name) == str(c2[1]) and str(province) == str(c2[3]) and str(
|
||||
# cities) == str(c2[4]) and str(district) == str(c2[5]) and str(
|
||||
# code) == str(c[1]) and str(identificationcode) == str(
|
||||
# c[13]) and str(biz) == str(c[9]):
|
||||
print(p_name, c_name, d_name, '444444444444444444444')
|
||||
if str(name) == str(c2[1]):
|
||||
print(c2)
|
||||
else:
|
||||
writer.writerow(
|
||||
|
@ -90,10 +97,17 @@ def get_csv_weixin(path):
|
|||
d_name])
|
||||
writer.writerow(
|
||||
[r[0], c2[1], c[1], c[13], c[9], c2[3], c2[4], c2[5]])
|
||||
except:
|
||||
writer.writerow(
|
||||
[r[0], name, code, identificationcode, biz, p_name, c_name,
|
||||
d_name, 'except'])
|
||||
|
||||
# try:
|
||||
#
|
||||
# except:
|
||||
# writer.writerow(
|
||||
# [r[0], name, code, identificationcode, biz, p_name, c_name,
|
||||
# d_name,'except'])
|
||||
|
||||
except:
|
||||
writer.writerow(
|
||||
[r[0], name, code, identificationcode, biz, p_name, c_name,
|
||||
d_name])
|
||||
if __name__ == '__main__':
|
||||
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')
|
|
@ -0,0 +1,64 @@
|
|||
# 更新新媒体脚本,结果为有出入的新媒体列表。
|
||||
'''
|
||||
1,将excel转为csv,使用utf-8编码集。
|
||||
2、获取csv内容
|
||||
3、与数据库中的数据逐项对比
|
||||
'''
|
||||
import csv
|
||||
import uuid
|
||||
|
||||
import psycopg2 as psycopg2
|
||||
|
||||
# code = None
|
||||
# alias = None
|
||||
# attention = None
|
||||
# remark = None
|
||||
# identificationcode = None
|
||||
# function = None
|
||||
# articleurl = None
|
||||
# weixinid = None
|
||||
# type = None
|
||||
G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
|
||||
|
||||
|
||||
def get_csv_weixin(path):
|
||||
with open("D:/2020/新媒体监测/新媒体对比结果_微信_账号名称更改.csv", "w", newline='',encoding='utf-8') as csvfile:
|
||||
writer = csv.writer(csvfile)
|
||||
writer.writerow(
|
||||
["序号", "冲突账号"])
|
||||
weixin_code_list = []
|
||||
csv_code_list = []
|
||||
with open(path, encoding='utf-8') as csvfile:
|
||||
reader = csv.reader(csvfile)
|
||||
for r in reader:
|
||||
if r[1] != '单位全称':
|
||||
if '微信' in r[7]:
|
||||
print(r)
|
||||
csv_code_list.append(r[4])
|
||||
with psycopg2.connect(G2) as connection:
|
||||
with connection.cursor() as cursor:
|
||||
try:
|
||||
cursor.execute(
|
||||
"select * from dashboard_weixin")
|
||||
connection.commit()
|
||||
for c in cursor:
|
||||
weixin_code_list.append(c[1])
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(len(weixin_code_list),len(csv_code_list))
|
||||
if len(weixin_code_list) <= len(csv_code_list):
|
||||
for c in csv_code_list:
|
||||
if c in weixin_code_list:
|
||||
print(c)
|
||||
else:
|
||||
writer.writerow(
|
||||
[r[0], r[4],c,'c'])
|
||||
else:
|
||||
for w in weixin_code_list:
|
||||
if w in csv_code_list:
|
||||
print(w)
|
||||
else:
|
||||
writer.writerow(
|
||||
[w,'w'])
|
||||
if __name__ == '__main__':
|
||||
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')
|
|
@ -0,0 +1,34 @@
|
|||
# 更新新媒体脚本,结果为有出入的新媒体列表。
|
||||
'''
|
||||
1,将excel转为csv,使用utf-8编码集。
|
||||
2、获取csv内容
|
||||
3、与数据库中的数据逐项对比
|
||||
'''
|
||||
import csv
|
||||
import uuid
|
||||
|
||||
import psycopg2 as psycopg2
|
||||
|
||||
# code = None
|
||||
# alias = None
|
||||
# attention = None
|
||||
# remark = None
|
||||
# identificationcode = None
|
||||
# function = None
|
||||
# articleurl = None
|
||||
# weixinid = None
|
||||
# type = None
|
||||
G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
|
||||
|
||||
|
||||
def get_csv_weixin(path):
|
||||
|
||||
with open(path, encoding='utf-8') as csvfile:
|
||||
reader = csv.reader(csvfile)
|
||||
for r in reader:
|
||||
if r[1] != '单位全称':
|
||||
if '' in r[7]:
|
||||
print(r)
|
||||
|
||||
if __name__ == '__main__':
|
||||
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')
|
Loading…
Reference in New Issue