This commit is contained in:
xieshen 2021-03-29 09:14:57 +08:00
commit 04641c02d3
5 changed files with 57 additions and 30 deletions

View File

@ -114,6 +114,8 @@ class Organizationtype(models.Model):
return self.organizationtype return self.organizationtype
# 单位 # 单位
class Organization(models.Model): class Organization(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
name = models.CharField('单位名', max_length=256, null=True, blank=True) name = models.CharField('单位名', max_length=256, null=True, blank=True)
@ -375,6 +377,7 @@ class NewMedia(models.Model):
result['alias'] = o.alias result['alias'] = o.alias
result['status'] = o.status result['status'] = o.status
result['type'] = 'weixin' result['type'] = 'weixin'
result['subtype'] = ''
results.append(result) results.append(result)
for o in weibo: for o in weibo:
result = dict() result = dict()
@ -383,6 +386,7 @@ class NewMedia(models.Model):
result['alias'] = o.alias result['alias'] = o.alias
result['status'] = o.status result['status'] = o.status
result['type'] = 'weibo' result['type'] = 'weibo'
result['subtype'] = ''
results.append(result) results.append(result)
for o in toutiao: for o in toutiao:
result = dict() result = dict()
@ -391,6 +395,7 @@ class NewMedia(models.Model):
result['alias'] = o.alias result['alias'] = o.alias
result['status'] = o.status result['status'] = o.status
result['type'] = 'toutiao' result['type'] = 'toutiao'
result['subtype'] = ''
results.append(result) results.append(result)
for o in douyin: for o in douyin:
result = dict() result = dict()
@ -399,6 +404,7 @@ class NewMedia(models.Model):
result['alias'] = o.alias result['alias'] = o.alias
result['status'] = o.status result['status'] = o.status
result['type'] = 'douyin' result['type'] = 'douyin'
result['subtype'] = ''
results.append(result) results.append(result)
for o in qita: for o in qita:
result = dict() result = dict()
@ -407,6 +413,7 @@ class NewMedia(models.Model):
result['alias'] = o.alias result['alias'] = o.alias
result['status'] = o.status result['status'] = o.status
result['type'] = 'qita' result['type'] = 'qita'
result['subtype'] = o.type
results.append(result) results.append(result)
return results return results
@ -428,7 +435,8 @@ class Weixin_data(models.Model):
title = models.CharField('标题', max_length=256, null=True, blank=True) title = models.CharField('标题', max_length=256, null=True, blank=True)
content = models.TextField('content', null=True, blank=True) content = models.TextField('content', null=True, blank=True)
author = models.CharField('author', max_length=256, null=True, blank=True) author = models.CharField('author', max_length=256, null=True, blank=True)
timestamp = models.CharField('timestamp',max_length=256,null=True,blank=True) timestamp = models.CharField(
'timestamp', max_length=256, null=True, blank=True)
link = models.CharField('link', max_length=2560, null=True, blank=True) link = models.CharField('link', max_length=2560, null=True, blank=True)
created = models.DateTimeField('创建时间', auto_now_add=True) created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True) updated = models.DateTimeField('更新时间', auto_now=True)
@ -526,7 +534,8 @@ class Toutiao_data(models.Model):
toutiao = models.ForeignKey( toutiao = models.ForeignKey(
Toutiao, on_delete=models.CASCADE, null=True, blank=True) Toutiao, on_delete=models.CASCADE, null=True, blank=True)
tid = models.CharField('tid', max_length=256, null=True, blank=True) tid = models.CharField('tid', max_length=256, null=True, blank=True)
celltype = models.CharField('celltype', max_length=256, null=True, blank=True) celltype = models.CharField(
'celltype', max_length=256, null=True, blank=True)
title = models.CharField('标题', max_length=256, null=True, blank=True) title = models.CharField('标题', max_length=256, null=True, blank=True)
content = models.TextField('内容', null=True, blank=True) content = models.TextField('内容', null=True, blank=True)
time = models.CharField('时间', max_length=256, null=True, blank=True) time = models.CharField('时间', max_length=256, null=True, blank=True)
@ -556,7 +565,8 @@ class Toutiao_comment(models.Model):
tid = models.CharField('tid', max_length=256, null=True, blank=True) tid = models.CharField('tid', max_length=256, null=True, blank=True)
cid = models.CharField('cid', max_length=256, null=True, blank=True) cid = models.CharField('cid', max_length=256, null=True, blank=True)
rid = models.CharField('rid', max_length=256, null=True, blank=True) rid = models.CharField('rid', max_length=256, null=True, blank=True)
username = models.CharField('username',max_length=256,null=True,blank=True) username = models.CharField(
'username', max_length=256, null=True, blank=True)
content = models.TextField('content', null=True, blank=True) content = models.TextField('content', null=True, blank=True)
time = models.CharField('time', max_length=256, null=True, blank=True) time = models.CharField('time', max_length=256, null=True, blank=True)
reply_count = models.IntegerField('reply_count', null=True, blank=True) reply_count = models.IntegerField('reply_count', null=True, blank=True)
@ -741,7 +751,8 @@ class TimelinessMonitoring(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
n_type = models.CharField('新媒体类型', max_length=256, null=True, blank=True) n_type = models.CharField('新媒体类型', max_length=256, null=True, blank=True)
# name = models.ForeignKey(NewMedia,on_delete=models.CASCADE) # name = models.ForeignKey(NewMedia,on_delete=models.CASCADE)
identificationcode = models.CharField('新媒体标识码', max_length=256, null=True, blank=True) identificationcode = models.CharField(
'新媒体标识码', max_length=256, null=True, blank=True)
results = models.CharField('监测结果', max_length=256, null=True, blank=True) results = models.CharField('监测结果', max_length=256, null=True, blank=True)
update = models.IntegerField('更新次数', null=True, blank=True) update = models.IntegerField('更新次数', null=True, blank=True)
silent = models.IntegerField('静默日数', null=True, blank=True) silent = models.IntegerField('静默日数', null=True, blank=True)
@ -773,6 +784,8 @@ class Wrongly(models.Model):
def __str__(self): def __str__(self):
return self.title return self.title
# 评论临时表 # 评论临时表
class Comment(models.Model): class Comment(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
comment = models.TextField('评论', null=True, blank=True) comment = models.TextField('评论', null=True, blank=True)
@ -789,13 +802,20 @@ class Comment(models.Model):
return self.user return self.user
# 新媒体更新表(国办) # 新媒体更新表(国办)
class Newmediaupdate(models.Model): class Newmediaupdate(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
organization_name = models.CharField('单位全称',max_length=256,null=True,blank=True) organization_name = models.CharField(
organization_id_code = models.CharField('单位唯一标识码',max_length=256,null=True,blank=True) '单位全称', max_length=256, null=True, blank=True)
identificationcode = models.CharField('新媒体标识码',max_length=256,null=True,blank=True) organization_id_code = models.CharField(
newmedia_name = models.CharField('账号名称',max_length=256,null=True,blank=True) '单位唯一标识码', max_length=256, null=True, blank=True)
newmedia_type = models.CharField('账号类型',max_length=256,null=True,blank=True) identificationcode = models.CharField(
'新媒体标识码', max_length=256, null=True, blank=True)
newmedia_name = models.CharField(
'账号名称', max_length=256, null=True, blank=True)
newmedia_type = models.CharField(
'账号类型', max_length=256, null=True, blank=True)
function = models.CharField('功能', max_length=256, null=True, blank=True) function = models.CharField('功能', max_length=256, null=True, blank=True)
province = models.CharField('', max_length=256, null=True, blank=True) province = models.CharField('', max_length=256, null=True, blank=True)
cities = models.CharField('', max_length=256, null=True, blank=True) cities = models.CharField('', max_length=256, null=True, blank=True)

View File

@ -148,6 +148,7 @@ def update_media(request):
result['code'] = instance.code result['code'] = instance.code
result['alias'] = instance.alias result['alias'] = instance.alias
result['status'] = instance.status result['status'] = instance.status
result['type'] = instance.type
result['attention'] = instance.attention result['attention'] = instance.attention
result['remark'] = instance.remark result['remark'] = instance.remark
result['organization'] = instance.organization.name result['organization'] = instance.organization.name
@ -162,18 +163,23 @@ def media_detail(request, type, media_id):
if type == 'weixin': if type == 'weixin':
media = Weixin.objects.get(pk=media_id) media = Weixin.objects.get(pk=media_id)
result['media_id'] = media.weixinid result['media_id'] = media.weixinid
result['type'] = '微信',
elif type == 'weibo': elif type == 'weibo':
media = Weibo.objects.get(pk=media_id) media = Weibo.objects.get(pk=media_id)
result['media_id'] = media.weiboid result['media_id'] = media.weiboid
result['type'] = '微博',
elif type == 'toutiao': elif type == 'toutiao':
media = Toutiao.objects.get(pk=media_id) media = Toutiao.objects.get(pk=media_id)
result['media_id'] = media.toutiaoid result['media_id'] = media.toutiaoid
result['type'] = '头条',
elif type == 'douyin': elif type == 'douyin':
media = Douyin.objects.get(pk=media_id) media = Douyin.objects.get(pk=media_id)
result['media_id'] = media.douyinid result['media_id'] = media.douyinid
result['type'] = '抖音',
else: else:
media = Qita.objects.get(pk=media_id) media = Qita.objects.get(pk=media_id)
result['media_id'] = media.qitaid result['media_id'] = media.qitaid
result['type'] = media.type,
admins = [] admins = []
for admin in media.organization.userprofile_set.exclude(admin_status=0): for admin in media.organization.userprofile_set.exclude(admin_status=0):

View File

@ -56,6 +56,7 @@ def polls_login(request):
profile = u.userprofile_set.first() profile = u.userprofile_set.first()
result['phone'] = u.username result['phone'] = u.username
result['token'] = token.key result['token'] = token.key
result['last_login'] = u.last_login
if profile: if profile:
result['name'] = profile.name result['name'] = profile.name
result['department'] = profile.department result['department'] = profile.department