Commit 69504c7f authored by lixiaofang's avatar lixiaofang

add

parent 5d237e6d
......@@ -3,6 +3,7 @@ import logging
from trans2es.models.topic import TopicTag, TopicImage, CommunityTopicProduct, Topic
from django.conf import settings
from trans2es.models.pictorial import PictorialTag
from random import randint
from trans2es.models.user_extra import UserExtra
......@@ -81,3 +82,15 @@ def get_pictorial_tag_by_id(self):
# except:
# logging.error("catch exception,err_msg:%s" % traceback.format_exc())
# 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
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 host, user, db, passwd
from vest.data.topic_models import get_pictorial_tag_by_id
"""
榜单新增内容(仅限在线的)
......@@ -60,7 +61,7 @@ def principal_online_comment1():
logging.info("comment offline pictorial")
numtime1, numtime2, minute = time_conv_minute(30, 0)
user_id, data_vote = get_data(numtime1, numtime2)
dicts = {}
random_num = 0
if user_id:
for i in user_id:
......@@ -73,7 +74,13 @@ def principal_online_comment1():
for num in range(random_num):
majia_user_id = get_majia()
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:
pictorial_reply(cook, i[0], comment)
if data_vote:
......@@ -82,7 +89,11 @@ def principal_online_comment1():
for num in range(random_num):
majia_user_id = get_majia()
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:
pictorial_reply(cook, i[0], comment)
......
......@@ -4,7 +4,8 @@ import logging
from vest.request.auto_request import login, time_conv, get_comment, reply
from vest.request.auto_request import host, user, db, passwd
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):
......@@ -40,6 +41,24 @@ def get_data(numtime, numtime2):
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():
try:
logging.info("comment one")
......@@ -47,15 +66,29 @@ def true_comment_one():
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)
comment = ""
#先判断是不是编辑标签
edit_judge = get_edit_tag_id_list(i[1])
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:
logging.error("catch exception,main:%s" % traceback.format_exc())
except:
logging_exception()
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