Commit 69504c7f authored by lixiaofang's avatar lixiaofang

add

parent 5d237e6d
...@@ -3,6 +3,7 @@ import logging ...@@ -3,6 +3,7 @@ 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 trans2es.models.user_extra import UserExtra from trans2es.models.user_extra import UserExtra
...@@ -81,3 +82,15 @@ def get_pictorial_tag_by_id(self): ...@@ -81,3 +82,15 @@ def get_pictorial_tag_by_id(self):
# 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_recomment_data():
try:
last = Topic.objects.count() - 1
index1 = randint(0, last)
MyObj1 = Topic.objects.all()[index1]
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return []
...@@ -4,6 +4,7 @@ import traceback ...@@ -4,6 +4,7 @@ import traceback
import logging import logging
from vest.request.auto_request import logins, pictorial_reply, get_majia, get_pictorial_comment, time_conv_minute from vest.request.auto_request import logins, pictorial_reply, get_majia, get_pictorial_comment, time_conv_minute
from vest.request.auto_request import host, user, db, passwd from vest.request.auto_request import host, user, db, passwd
from vest.data.topic_models import get_pictorial_tag_by_id
""" """
榜单新增内容(仅限在线的) 榜单新增内容(仅限在线的)
...@@ -60,7 +61,7 @@ def principal_online_comment1(): ...@@ -60,7 +61,7 @@ def principal_online_comment1():
logging.info("comment offline pictorial") logging.info("comment offline pictorial")
numtime1, numtime2, minute = time_conv_minute(30, 0) numtime1, numtime2, minute = time_conv_minute(30, 0)
user_id, data_vote = get_data(numtime1, numtime2) user_id, data_vote = get_data(numtime1, numtime2)
dicts = {}
random_num = 0 random_num = 0
if user_id: if user_id:
for i in user_id: for i in user_id:
...@@ -73,7 +74,13 @@ def principal_online_comment1(): ...@@ -73,7 +74,13 @@ def principal_online_comment1():
for num in range(random_num): for num in range(random_num):
majia_user_id = get_majia() majia_user_id = get_majia()
cook = logins(majia_user_id) cook = logins(majia_user_id)
comment = get_pictorial_comment() comment = ""
# 判断是不是编辑标签
edit_judge = get_pictorial_tag_by_id(i[0])
if edit_judge:
comment = get_pictorial_comment()
else:
comment = get_pictorial_comment()
if cook is not None: if cook is not None:
pictorial_reply(cook, i[0], comment) pictorial_reply(cook, i[0], comment)
if data_vote: if data_vote:
...@@ -82,7 +89,11 @@ def principal_online_comment1(): ...@@ -82,7 +89,11 @@ def principal_online_comment1():
for num in range(random_num): for num in range(random_num):
majia_user_id = get_majia() majia_user_id = get_majia()
cook = logins(majia_user_id) cook = logins(majia_user_id)
comment = get_pictorial_comment() edit_judge = get_pictorial_tag_by_id(i[0])
if edit_judge:
comment = get_pictorial_comment()
else:
comment = get_pictorial_comment()
if cook is not None: if cook is not None:
pictorial_reply(cook, i[0], comment) pictorial_reply(cook, i[0], comment)
......
...@@ -4,7 +4,8 @@ import logging ...@@ -4,7 +4,8 @@ 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
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, \
topic_has_image
def get_data(numtime, numtime2): def get_data(numtime, numtime2):
...@@ -40,6 +41,24 @@ def get_data(numtime, numtime2): ...@@ -40,6 +41,24 @@ def get_data(numtime, numtime2):
return [] return []
# def true_comment_one():
# try:
# logging.info("comment one")
# numtime1, numtime2 = time_conv(5, 0)
# user_id = get_data(numtime1, numtime2)
# if user_id:
# for i in user_id:
# cook = login()
# comment = get_comment()
# if cook is not None:
# reply(cook, i[1], comment)
# else:
# logging.error("catch exception,main:%s" % traceback.format_exc())
# except:
# logging_exception()
# logging.error("catch exception,main:%s" % traceback.format_exc())
def true_comment_one(): def true_comment_one():
try: try:
logging.info("comment one") logging.info("comment one")
...@@ -47,15 +66,29 @@ def true_comment_one(): ...@@ -47,15 +66,29 @@ def true_comment_one():
user_id = get_data(numtime1, numtime2) user_id = get_data(numtime1, numtime2)
if user_id: if user_id:
for i in user_id: for i in user_id:
cook = login() comment = ""
comment = get_comment() #先判断是不是编辑标签
if cook is not None: edit_judge = get_edit_tag_id_list(i[1])
reply(cook, i[1], comment) if edit_judge:
comment = get_comment()
else:
# 判断有没有商品信息
product_judge = get_topic_product_info(i[1])
if product_judge:
comment = get_comment()
else:
#判断有没有人脸
face_judge = topic_has_image(i[1])
if face_judge:
comment = get_comment()
else:
comment = get_comment()
cookie = login()
if cookie is not None:
reply(cookie, i[1], comment)
else: else:
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
except: except:
logging_exception() logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc()) logging.error("catch exception,main:%s" % traceback.format_exc())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment