Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
08faa42d
Commit
08faa42d
authored
Aug 29, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
2ec7bbc9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
group.py
trans2es/models/group.py
+9
-8
pictorial.py
trans2es/models/pictorial.py
+2
-2
pictorial_transfer.py
trans2es/utils/pictorial_transfer.py
+1
-1
No files found.
trans2es/models/group.py
View file @
08faa42d
...
...
@@ -9,31 +9,33 @@ from libs.es import ESPerform
from
django.db
import
models
import
datetime
class
Group
(
models
.
Model
):
class
Meta
:
verbose_name
=
u'小组'
db_table
=
'group'
id
=
models
.
IntegerField
(
verbose_name
=
u"小组ID"
,
primary_key
=
True
)
id
=
models
.
IntegerField
(
verbose_name
=
u"小组ID"
,
primary_key
=
True
)
name
=
models
.
CharField
(
verbose_name
=
u'名称'
,
max_length
=
100
,
default
=
''
)
description
=
models
.
CharField
(
verbose_name
=
u'描述'
,
max_length
=
200
,
default
=
''
)
creator_id
=
models
.
IntegerField
(
verbose_name
=
u'创建者ID'
)
#icon = ImgUrlField('图标', max_length=255, img_type=IMG_TYPE.WATERMARK, default='')
#
icon = ImgUrlField('图标', max_length=255, img_type=IMG_TYPE.WATERMARK, default='')
icon
=
models
.
CharField
(
verbose_name
=
u'图标'
,
max_length
=
128
,
default
=
''
)
topic_num
=
models
.
IntegerField
(
verbose_name
=
u'帖子数'
,
default
=
0
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u"是否有效"
,
default
=
True
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
"是否删除"
)
is_recommend
=
models
.
BooleanField
(
verbose_name
=
u"是否推荐"
,
default
=
False
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
#获取前一天4,5星发帖数
#
获取前一天4,5星发帖数
def
get_high_quality_topic_num
(
self
):
yesterday
=
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
1
)
yesterday
=
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
1
)
yesterday_begin_time
=
"
%
s-
%
s-
%
s 00:00:00"
%
(
yesterday
.
year
,
yesterday
.
month
,
yesterday
.
day
)
yesterday_end_time
=
"
%
s-
%
s-
%
s 23:59:59"
%
(
yesterday
.
year
,
yesterday
.
month
,
yesterday
.
day
)
topic_num
=
self
.
group_topics
.
filter
(
content_level__in
=
(
"4"
,
"5"
),
create_time__gte
=
yesterday_begin_time
,
create_time__lte
=
yesterday_end_time
)
.
count
()
topic_num
=
self
.
group_topics
.
filter
(
content_level__in
=
(
"4"
,
"5"
),
create_time__gte
=
yesterday_begin_time
,
create_time__lte
=
yesterday_end_time
)
.
count
()
return
topic_num
...
...
@@ -48,4 +50,4 @@ class Group(models.Model):
'create_time'
:
self
.
create_time
.
timestamp
(),
'update_time'
:
self
.
update_time
.
timestamp
(),
}
return
result
\ No newline at end of file
return
result
trans2es/models/pictorial.py
View file @
08faa42d
...
...
@@ -93,7 +93,7 @@ class Pictorial(models.Model):
return
False
# 获取前一天4,5星发帖数
def
get_high_quality_topic_num
(
self
):
def
get_high_quality_topic_num
_pictorial
(
self
):
try
:
yesterday
=
datetime
.
datetime
.
now
()
-
datetime
.
timedelta
(
days
=
1
)
yesterday_begin_time
=
"
%
s-
%
s-
%
s 00:00:00"
%
(
yesterday
.
year
,
yesterday
.
month
,
yesterday
.
day
)
...
...
@@ -108,7 +108,7 @@ class Pictorial(models.Model):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
return
0
def
get_tag_by_id
(
self
):
try
:
...
...
trans2es/utils/pictorial_transfer.py
View file @
08faa42d
...
...
@@ -59,7 +59,7 @@ class PictorialTransfer(object):
update_time
=
instance
.
update_time
tzlc_udpate_time
=
tzlc
(
update_time
)
res
[
"update_time"
]
=
tzlc_udpate_time
res
[
"high_quality_topic_num"
]
=
instance
.
get_high_quality_topic_num
()
res
[
"high_quality_topic_num"
]
=
instance
.
get_high_quality_topic_num
_pictorial
()
tag_id_list
=
instance
.
get_tag_by_id
()
res
[
"tag_id"
]
=
tag_id_list
res
[
"tag_name"
]
=
instance
.
get_tag_by_name
(
tag_id_list
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment