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
a6894792
Commit
a6894792
authored
Sep 11, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
fcf04bf8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
hellolike.txt
vest/data/hellolike.txt
+0
-0
topic_models.py
vest/data/topic_models.py
+14
-2
auto_request.py
vest/request/auto_request.py
+25
-2
No files found.
vest/data/hellolike.txt
0 → 100644
View file @
a6894792
This diff is collapsed.
Click to expand it.
vest/data/topic_models.py
View file @
a6894792
...
...
@@ -12,8 +12,8 @@ from django.db import models
def
get_edit_tag_id_list
(
topic_id
):
try
:
tag_id_list
=
list
(
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
topic_id
,
is_collection
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
))
is_collection
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
))
logging
.
info
(
"get ---tag_id_list:
%
s"
%
tag_id_list
)
logging
.
info
(
"get ---topic_id:
%
s"
%
topic_id
)
...
...
@@ -23,6 +23,18 @@ def get_edit_tag_id_list(topic_id):
return
[]
def
get_tag_id_list
(
topic_id
):
try
:
tag_id_list
=
list
(
TopicTag
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
topic_id
=
topic_id
,
tag_id
=
123
)
.
values_list
(
"tag_id"
,
flat
=
True
))
return
tag_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
topic_has_image
(
topic_id
):
try
:
has_image
=
Topic
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
id
=
topic_id
,
is_deleted
=
False
,
...
...
vest/request/auto_request.py
View file @
a6894792
...
...
@@ -13,7 +13,7 @@ from email.utils import formataddr
from
physical.settings_local
import
DATABASES
from
physical.settings_local
import
REDIS_URL
from
vest.data.topic_models
import
get_pictorial_tag_by_id
,
get_topic_product_info
,
get_edit_tag_id_list
,
\
get_category_tag_id
,
topic_has_image
get_category_tag_id
,
topic_has_image
,
get_tag_id_list
from
django.conf
import
settings
my_sender
=
'lixiaofang@igengmei.com'
...
...
@@ -493,6 +493,24 @@ def get_face_comment():
return
None
def
get_hellolike_comment
():
try
:
data
=
open
(
"/srv/apps/physical/vest/data/hellolike.txt.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_category_reply_commtent
(
category_id
):
try
:
# 发型42、穿搭46、美妆3、护肤4、美甲21972、香水17576、瘦身32605、配饰5305608
...
...
@@ -531,7 +549,11 @@ def judge_topic_info_get_comment(topic_id):
# 先判断是不是编辑标签
edit_tag_list
=
get_edit_tag_id_list
(
topic_id
)
logging
.
info
(
"get topic_tag:
%
s"
%
edit_tag_list
)
if
len
(
edit_tag_list
)
>
0
:
tag_list
=
get_tag_id_list
(
topic_id
)
if
len
(
tag_list
)
>
0
:
comment
=
get_hellolike_comment
()
elif
len
(
edit_tag_list
)
>
0
:
# 如果有编辑标签
# 去拿他的所属分类 根据分类去拿对应的标签(随机拿一个)
category_tag_id
=
get_category_tag_id
(
edit_tag_list
)
...
...
@@ -554,6 +576,7 @@ def judge_topic_info_get_comment(topic_id):
else
:
comment
=
get_comment
()
else
:
# 判断有没有商品信息
product_judge
=
get_topic_product_info
(
topic_id
)
...
...
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