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
ddbf3b99
Commit
ddbf3b99
authored
Aug 21, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
69504c7f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
21 deletions
+52
-21
topic_models.py
vest/data/topic_models.py
+7
-15
true_comment_one.py
vest/reply/true_comment_one.py
+9
-6
auto_request.py
vest/request/auto_request.py
+36
-0
No files found.
vest/data/topic_models.py
View file @
ddbf3b99
...
@@ -3,21 +3,17 @@ import logging
...
@@ -3,21 +3,17 @@ import logging
from
trans2es.models.topic
import
TopicTag
,
TopicImage
,
CommunityTopicProduct
,
Topic
from
trans2es.models.topic
import
TopicTag
,
TopicImage
,
CommunityTopicProduct
,
Topic
from
django.conf
import
settings
from
django.conf
import
settings
from
trans2es.models.pictorial
import
PictorialTag
from
trans2es.models.pictorial
import
PictorialTag
from
random
import
randint
from
random
import
randint
from
trans2es.models.user_extra
import
UserExtra
from
trans2es.models.user_extra
import
UserExtra
from
django.db
import
models
def
get_edit_tag_id_list
(
topic_id
):
def
get_edit_tag_id_list
(
topic_id
):
try
:
try
:
has_edit
=
False
tag_id_list
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
topic_id
,
tag_id_list
=
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
topic_id
,
is_collection
=
1
)
.
values_list
(
"tag_id"
,
is_collection
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
)
flat
=
True
)
return
tag_id_list
if
len
(
tag_id_list
)
>
0
:
has_edit
=
True
return
has_edit
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
return
[]
...
@@ -53,20 +49,16 @@ def get_topic_product_info(topic_id):
...
@@ -53,20 +49,16 @@ def get_topic_product_info(topic_id):
return
[]
return
[]
def
get_pictorial_tag_by_id
(
self
):
def
get_pictorial_tag_by_id
(
pictorial_id
):
try
:
try
:
has_edit
=
False
tag_id_list
=
list
(
PictorialTag
.
objects
.
filter
(
pictorial_id
=
pictorial_id
,
is_online
=
True
,
is_collection
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
))
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
:
return
tag_id_list
has_edit
=
True
return
has_edit
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
return
[]
# def get_topic_data(numtime, numitme2):
# def get_topic_data(numtime, numitme2):
# try:
# try:
#
#
...
...
vest/reply/true_comment_one.py
View file @
ddbf3b99
import
pymysql
import
pymysql
import
traceback
import
traceback
import
logging
import
logging
from
vest.request.auto_request
import
login
,
time_conv
,
get_comment
,
reply
from
vest.request.auto_request
import
login
,
time_conv
,
get_comment
,
reply
,
get_product_comment
,
get_face_comment
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
vest.request.auto_request
import
host
,
user
,
db
,
passwd
from
libs.error
import
logging_exception
from
libs.error
import
logging_exception
from
vest.data.topic_models
import
get_edit_tag_id_list
,
get_pictorial_tag_by_id
,
get_topic_product_info
,
\
from
vest.data.topic_models
import
get_edit_tag_id_list
,
get_pictorial_tag_by_id
,
get_topic_product_info
,
\
topic_has_image
topic_has_image
import
random
def
get_data
(
numtime
,
numtime2
):
def
get_data
(
numtime
,
numtime2
):
...
@@ -67,20 +68,22 @@ def true_comment_one():
...
@@ -67,20 +68,22 @@ def true_comment_one():
if
user_id
:
if
user_id
:
for
i
in
user_id
:
for
i
in
user_id
:
comment
=
""
comment
=
""
#先判断是不是编辑标签
#
先判断是不是编辑标签
edit_judge
=
get_edit_tag_id_list
(
i
[
1
])
edit_judge
=
get_edit_tag_id_list
(
i
[
1
])
if
edit_judge
:
if
len
(
edit_judge
)
>
0
:
rand_tag_id
=
random
.
randint
(
0
,
len
(
edit_judge
)
-
1
)
comment
=
get_comment
()
comment
=
get_comment
()
else
:
else
:
# 判断有没有商品信息
# 判断有没有商品信息
product_judge
=
get_topic_product_info
(
i
[
1
])
product_judge
=
get_topic_product_info
(
i
[
1
])
if
product_judge
:
if
product_judge
:
comment
=
get_comment
()
comment
=
get_
product_
comment
()
else
:
else
:
#判断有没有人脸
#
判断有没有人脸
face_judge
=
topic_has_image
(
i
[
1
])
face_judge
=
topic_has_image
(
i
[
1
])
if
face_judge
:
if
face_judge
:
comment
=
get_comment
()
comment
=
get_
face_
comment
()
else
:
else
:
comment
=
get_comment
()
comment
=
get_comment
()
...
...
vest/request/auto_request.py
View file @
ddbf3b99
...
@@ -469,3 +469,39 @@ def get_pictorial_comment():
...
@@ -469,3 +469,39 @@ def get_pictorial_comment():
except
:
except
:
return
None
return
None
def
get_product_comment
():
try
:
data
=
open
(
"/srv/apps/physical/vest/data/pictorial_reply_data.txt"
,
"r"
)
list_guanshui
=
[]
for
i
in
data
:
list_guanshui
.
append
(
i
)
num
=
random
.
randint
(
0
,
len
(
list_guanshui
))
comment
=
list_guanshui
[
num
-
1
]
return
comment
except
:
return
None
def
get_face_comment
():
try
:
data
=
open
(
"/srv/apps/physical/vest/data/pictorial_reply_data.txt"
,
"r"
)
list_guanshui
=
[]
for
i
in
data
:
list_guanshui
.
append
(
i
)
num
=
random
.
randint
(
0
,
len
(
list_guanshui
))
comment
=
list_guanshui
[
num
-
1
]
return
comment
except
:
return
None
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