Commit b89b5263 authored by lixiaofang's avatar lixiaofang

pictorial

parent 3b3e437e
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7b835479-ee84-40d6-9b97-0e9285d92119" name="Default Changelist" comment="" />
<list default="true" id="7b835479-ee84-40d6-9b97-0e9285d92119" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/principal_online_comment1.py" beforeDir="false" afterPath="$PROJECT_DIR$/principal_online_comment1.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -28,13 +30,13 @@
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="dummy" value="1" />
<entry key="py" value="2350" />
<entry key="py" value="2391" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="PLAIN_TEXT" value="1" />
<entry key="Python" value="2350" />
<entry key="Python" value="2391" />
</counts>
</usages-collector>
<usages-collector id="statistics.lifecycle.project">
......@@ -53,21 +55,21 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/auto_request.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-192">
<caret line="78" lean-forward="true" selection-start-line="78" selection-end-line="78" />
<state relative-caret-position="124">
<caret line="48" column="4" selection-start-line="48" selection-start-column="4" selection-end-line="48" selection-end-column="4" />
<folding>
<element signature="e#0#15#0" expanded="true" />
<marker date="1565059617000" expanded="true" signature="6010:6330" ph="..." />
<marker date="1565244598000" expanded="true" signature="6010:6334" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/principal_online_comment1.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="15" selection-start-line="15" selection-end-line="15" />
<state relative-caret-position="380">
<caret line="47" column="33" selection-start-line="47" selection-start-column="33" selection-end-line="47" selection-end-column="33" />
<folding>
<element signature="e#0#14#0" expanded="true" />
</folding>
......@@ -75,11 +77,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/principal_offline_comment1.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="205">
<caret line="19" column="81" selection-start-line="19" selection-start-column="81" selection-end-line="19" selection-end-column="81" />
<state relative-caret-position="332">
<caret line="40" column="29" lean-forward="true" selection-start-line="40" selection-start-column="29" selection-end-line="40" selection-end-column="29" />
<folding>
<element signature="e#0#14#0" expanded="true" />
</folding>
......@@ -136,14 +138,13 @@
<option value="$PROJECT_DIR$/answer_reply2.py" />
<option value="$PROJECT_DIR$/reply_comment3.py" />
<option value="$PROJECT_DIR$/pictorial_reply_data.txt" />
<option value="$PROJECT_DIR$/principal_offline_comment1.py" />
<option value="$PROJECT_DIR$/auto_request.py" />
<option value="$PROJECT_DIR$/principal_online_comment1.py" />
<option value="$PROJECT_DIR$/principal_offline_comment1.py" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-29" />
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="23" />
<option name="width" value="1280" />
<option name="height" value="727" />
......@@ -222,11 +223,12 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-29" y="23" width="1280" height="727" extended-state="0" />
<frame x="0" y="27" width="1280" height="727" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Structure" order="0" sideWeight="0.21188119" side_tool="true" weight="0.19112115" />
<window_info id="Favorites" order="1" side_tool="true" />
<window_info content_ui="combo" id="Project" order="2" sideWeight="0.7872763" visible="true" weight="0.20571883" />
<window_info content_ui="combo" id="Project" order="2" sideWeight="0.7872763" visible="true" weight="0.0" />
<window_info id="DB Browser" order="3" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.3284974" />
......@@ -236,8 +238,8 @@
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
<window_info active="true" anchor="bottom" id="Terminal" order="8" sideWeight="0.49960285" visible="true" weight="0.32843137" />
<window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.50039715" side_tool="true" weight="0.32890365" />
<window_info active="true" anchor="bottom" id="Terminal" order="8" sideWeight="0.4988086" visible="true" weight="0.0" />
<window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.50119144" side_tool="true" weight="0.32843137" />
<window_info anchor="bottom" id="Python Console" order="10" />
<window_info anchor="bottom" id="DB Execution Console" order="11" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
......@@ -530,31 +532,31 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/auto_request.py">
<entry file="file://$PROJECT_DIR$/principal_offline_comment1.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-192">
<caret line="78" lean-forward="true" selection-start-line="78" selection-end-line="78" />
<state relative-caret-position="332">
<caret line="40" column="29" lean-forward="true" selection-start-line="40" selection-start-column="29" selection-end-line="40" selection-end-column="29" />
<folding>
<element signature="e#0#15#0" expanded="true" />
<marker date="1565059617000" expanded="true" signature="6010:6330" ph="..." />
<element signature="e#0#14#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/principal_online_comment1.py">
<entry file="file://$PROJECT_DIR$/auto_request.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="15" selection-start-line="15" selection-end-line="15" />
<state relative-caret-position="124">
<caret line="48" column="4" selection-start-line="48" selection-start-column="4" selection-end-line="48" selection-end-column="4" />
<folding>
<element signature="e#0#14#0" expanded="true" />
<element signature="e#0#15#0" expanded="true" />
<marker date="1565244598000" expanded="true" signature="6010:6334" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/principal_offline_comment1.py">
<entry file="file://$PROJECT_DIR$/principal_online_comment1.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="205">
<caret line="19" column="81" selection-start-line="19" selection-start-column="81" selection-end-line="19" selection-end-column="81" />
<state relative-caret-position="380">
<caret line="47" column="33" selection-start-line="47" selection-start-column="33" selection-end-line="47" selection-end-column="33" />
<folding>
<element signature="e#0#14#0" expanded="true" />
</folding>
......
......@@ -3,7 +3,7 @@ import random
import traceback
from log_settings import *
import logging
from auto_request import logins, pictorial_reply, get_majia_reply, get_pictorial_comment, time_conv_minute
from auto_request import logins, pictorial_reply, get_majia, get_pictorial_comment, time_conv_minute
from auto_request import host, user, db, passwd
"""
......@@ -20,6 +20,9 @@ from auto_request import host, user, db, passwd
(注意评论作者需要是马甲用户)
过去半小时之内,if
本榜单有新增投票(既包含马甲用户、又包含普通用户),插入{1,2}条评论
评论取自单独的榜单评论列表,并自动随机关联马甲
......@@ -33,12 +36,20 @@ def get_data(numtime1, numtime2):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT pictorial_id ,count(*),user_id as count FROM community_pictorial_topic WHERE is_online=1 and (create_time > '%s' and create_time < '%s' group by pictorial_id )" % (
"SELECT pictorial_id ,count(*) as count FROM community_pictorial_topic WHERE is_online=1 and (create_time > '%s' and create_time < '%s' group by pictorial_id )" % (
numtime1, numtime2))
data = cursor.fetchall()
topic_id = list(data)
logging.info("Database version : %s " % topic_id)
return topic_id
cursor.execute(
"SELECT pictorial_id FROM topic_vote_cnt WHERE is_deleted = 0 and (create_time > '%s' and create_time < '%s' group by pictorial_id )" % (
numtime1, numtime2))
data_vote = cursor.fetchall()
pictorial_data = list(data)
pictorial_vote = list(data_vote)
logging.info("Database version : %s " % pictorial_data)
logging.info("Database version : %s " % pictorial_vote)
return pictorial_data, pictorial_vote
except:
logging.error("catch exception,get_data:%s" % traceback.format_exc())
......@@ -52,7 +63,7 @@ if __name__ == "__main__":
numtime1, numtime2, minute = time_conv_minute(30, 0)
print(numtime1)
print(numtime2)
user_id = get_data(numtime1, numtime2)
user_id, data_vote = get_data(numtime1, numtime2)
dicts = {}
random_num = 0
if user_id:
......@@ -63,13 +74,21 @@ if __name__ == "__main__":
random_num = random.randint(2, 3)
if i[1] > 5:
random_num = random.randint(3, 5)
for num in range(random_num):
majia_user_id = get_majia_reply(i[2])
majia_user_id = get_majia()
cook = logins(majia_user_id)
comment = get_pictorial_comment()
if cook is not None:
pictorial_reply(cook, i[0], comment)
if data_vote:
for i in data_vote:
random_num = random.randint(1, 2)
for num in range(random_num):
majia_user_id = get_majia()
cook = logins(majia_user_id)
comment = get_pictorial_comment()
if cook is not None:
pictorial_reply(cook, i[0], comment)
else:
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