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
钟尚武
physical
Commits
18ede0b1
Commit
18ede0b1
authored
Aug 20, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
5855c068
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
115 additions
and
10 deletions
+115
-10
pictorial.py
trans2es/models/pictorial.py
+2
-0
topic.py
trans2es/models/topic.py
+25
-9
topic_models.py
trans2es/topic_models.py
+84
-0
true_comment_one.py
vest/reply/true_comment_one.py
+4
-1
No files found.
trans2es/models/pictorial.py
View file @
18ede0b1
...
...
@@ -186,6 +186,8 @@ class PictorialTag(models.Model):
pictorial_id
=
models
.
BigIntegerField
(
verbose_name
=
u'画报ID'
,
max_length
=
20
)
tag_id
=
models
.
BigIntegerField
(
verbose_name
=
u'标签ID'
,
max_length
=
20
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
,
max_length
=
1
)
is_collection
=
models
.
IntegerField
(
verbose_name
=
u"是否编辑标签"
)
class
CommunityPictorialActivity
(
models
.
Model
):
...
...
trans2es/models/topic.py
View file @
18ede0b1
...
...
@@ -319,22 +319,25 @@ class Topic(models.Model):
datetime_list
=
list
()
if
reply_query_results
.
count
()
>
0
:
for
reply
in
reply_query_results
:
UserExtra_results
=
UserExtra
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
user_id
=
reply
[
'user_id'
])
.
values
(
'is_shadow'
)
if
UserExtra_results
.
count
()
>
0
:
if
not
UserExtra_results
[
0
][
'is_shadow'
]:
datetime_list
.
append
(
reply
[
'create_time'
])
if
len
(
datetime_list
)
>
0
:
dt
=
max
(
datetime_list
)
return
datetime
.
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
UserExtra_results
=
UserExtra
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
user_id
=
reply
[
'user_id'
])
.
values
(
'is_shadow'
)
if
UserExtra_results
.
count
()
>
0
:
if
not
UserExtra_results
[
0
][
'is_shadow'
]:
datetime_list
.
append
(
reply
[
'create_time'
])
if
len
(
datetime_list
)
>
0
:
dt
=
max
(
datetime_list
)
return
datetime
.
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
else
:
dt
=
self
.
create_time
return
datetime
.
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
else
:
dt
=
self
.
create_time
return
datetime
.
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
return
datetime
.
datetime
(
dt
.
year
,
dt
.
month
,
dt
.
day
,
dt
.
hour
,
dt
.
minute
,
dt
.
second
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
except
:
return
datetime
.
datetime
(
1980
,
1
,
1
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
return
datetime
.
datetime
(
1980
,
1
,
1
,
0
,
0
,
0
,
tzinfo
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
)))
class
TopicComplaint
(
models
.
Model
):
...
...
@@ -411,6 +414,7 @@ class TopicBillBoard(models.Model):
class
Reply
(
models
.
Model
):
"""帖子回复"""
class
Meta
:
verbose_name
=
"帖子回复"
db_table
=
"reply"
...
...
@@ -421,3 +425,15 @@ class Reply(models.Model):
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u'是否删除'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
u'是否上线'
)
class
CommunityTopicProduct
(
models
.
Model
):
"""帖子商品信息"""
class
Meta
:
verbose_name
=
"帖子商品信息"
db_table
=
"community_topic_product"
topic_id
=
models
.
IntegerField
(
verbose_name
=
u"帖子ID"
)
product_id
=
models
.
IntegerField
(
verbose_name
=
u'商品ID'
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
u'是否删除'
)
trans2es/topic_models.py
0 → 100644
View file @
18ede0b1
import
traceback
import
logging
from
trans2es.models.topic
import
TopicTag
,
TopicImage
,
CommunityTopicProduct
,
Topic
from
django.conf
import
settings
from
trans2es.models.pictorial
import
PictorialTag
from
trans2es.models.user_extra
import
UserExtra
def
get_edit_tag_id_list
(
topic_id
):
try
:
has_edit
=
False
tag_id_list
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
topic_id
,
is_collection
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
)
if
len
(
tag_id_list
)
>
0
:
has_edit
=
True
return
has_edit
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
topic_has_image
(
topic_id
):
try
:
has_image
=
False
query_list
=
TopicImage
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
topic_id
,
is_deleted
=
False
,
is_online
=
True
)
if
len
(
query_list
)
>
0
:
has_image
=
True
return
has_image
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
def
get_topic_product_info
(
topic_id
):
try
:
has_product
=
False
query_list
=
CommunityTopicProduct
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
topic_id
,
is_deleted
=
False
)
if
len
(
query_list
)
>
0
:
has_product
=
True
return
has_product
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_pictorial_tag_by_id
(
self
):
try
:
has_edit
=
False
tag_id_list
=
list
(
PictorialTag
.
objects
.
filter
(
pictorial_id
=
self
.
id
,
is_online
=
True
)
.
values_list
(
"tag_id"
,
flat
=
True
))
if
len
(
tag_id_list
)
>
0
:
has_edit
=
True
return
has_edit
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_topic_data
(
numtime
,
numitme2
):
try
:
result_topic
=
Topic
.
objects
.
filter
(
create_time__lte
=
numitme2
,
create_time__gte
=
numtime
,
is_online
=
True
)
.
values
(
"user_id"
,
"id"
)
if
len
(
result_topic
)
>
0
:
for
i
in
result_topic
:
shadow_judge
=
UserExtra
.
objects
.
filter
(
user_id
=
i
[
0
],
is_online
=
Topic
,
is_deleted
=
False
)
.
values_list
(
"is_shadow"
,
flat
=
True
)
return
has_edit
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
vest/reply/true_comment_one.py
View file @
18ede0b1
...
...
@@ -6,6 +6,7 @@ from vest.request.auto_request import host, user, db, passwd
from
libs.error
import
logging_exception
def
get_data
(
numtime
,
numtime2
):
try
:
print
(
"...."
)
...
...
@@ -44,7 +45,6 @@ def true_comment_one():
logging
.
info
(
"comment one"
)
numtime1
,
numtime2
=
time_conv
(
5
,
0
)
user_id
=
get_data
(
numtime1
,
numtime2
)
dicts
=
{}
if
user_id
:
for
i
in
user_id
:
cook
=
login
()
...
...
@@ -56,3 +56,6 @@ def true_comment_one():
except
:
logging_exception
()
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
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