Commit c37e81ba authored by xqf's avatar xqf

Merge branch 'master' of git.wanmeizhensuo.com:alpha/physical into 20191013_xqf

parents 1f102f08 0eec3594
......@@ -4,11 +4,12 @@ ontime_list = [
"0 9 * * * source /srv/envs/physical/bin/activate && python /data/log/physical/app/crontab.py",
"10 9 * * * source /srv/envs/physical/bin/activate && python /data/log/physical/app/crontabs.py",
"0 9 * * * sh /data/log/cybertron/app/statistics_query.sh > /data/log/cybertron/app/statistics_query.log",
"*/5 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m true_click_one",
"02,12,22,32,42,52 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es-m true_click_two",
"00,10,20,30,40,50 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m true_click_three",
"02,12,22,32,42,52 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es-m true_click_four",
"06,16,26,36,46,56 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m true_click_five",
"54 */2 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_click_per_2h_by_post",
# "*/5 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m true_click_one",
# "02,12,22,32,42,52 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es-m true_click_two",
# "00,10,20,30,40,50 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m true_click_three",
# "02,12,22,32,42,52 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es-m true_click_four",
# "06,16,26,36,46,56 * * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m true_click_five",
"0 14 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_star_urge",
"0 10 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_urge1",
"30 10 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_urge2",
......@@ -23,6 +24,7 @@ ontime_list = [
]
random_time_list = [
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_click_per_1d_by_post",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_1d_by_regist",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_1d_by_post",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply1",
......@@ -53,6 +55,8 @@ for i in range(len(random_time_list)):
ontime_list.append(str(ss2[i]) + " " + str(ss1[i]) + " " + str(random_time_list[i]))
data = open("/data/log/physical/app/conf.txt", "w")
# data = open("abc.txt", "w")
for var in ontime_list:
data.write(var)
data.write("\n")
......@@ -9,7 +9,7 @@ from libs.es import ESPerform
from trans2es.type_info import get_type_info_map, TypeInfo
from vest.reply import true_comment_one, true_comment_two, true_comment_three, one_seven_topic_comment
from vest.click import true_click_five, true_click_two, true_click_four, true_click_one, true_click_three, \
one_seven_star_topic
one_seven_star_topic, auto_click_per_1d_by_post, auto_click_per_2h_by_post
from vest.follow import auto_follow, auto_follow_new, auto_follow_per_5m_by_followed, \
auto_follow_per_1d_by_regist, auto_follow_per_1d_by_post, auto_follow_per_2h_by_post_and_regist
from vest.urge import auto_star_urge, auto_lunch_app, auto_lunch_app2, auto_urge1, auto_urge2
......@@ -87,6 +87,10 @@ class Command(BaseCommand):
true_click_five.true_click_five()
if options["mvest"] == "one_seven_star_topic":
one_seven_star_topic.one_seven_star_topic()
if options["mvest"] == "auto_click_per_1d_by_post":
auto_click_per_1d_by_post.auto_click_per_1d_by_post()
if options["mvest"] == "auto_click_per_2h_by_post":
auto_click_per_2h_by_post.auto_click_per_2h_by_post()
# 评论
if options["mvest"] == "true_comment_one":
......
......@@ -28,6 +28,7 @@ def get_data(numtime, numtime2):
def yesterday_comment_one():
# 自动给帖子增加评论
try:
logging.info("comment one")
numtime, numtime2 = time_convs(1, 1)
......
import pymysql
import random
import traceback
import logging
from threading import Thread
from vest.request.auto_request import login, time_convs, click
from vest.request.auto_request import host, user, db, passwd
from libs.error import logging_exception
def get_commnet_id(numtime, numtime2, content_level_low=0, content_level_top=6):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
topic_ids = []
cursor.execute(
"select t.id from topic t left join user_extra u on t.user_id = u.user_id "
"where u.is_shadow=0 and t.create_time > '%s' and t.create_time < '%s' and is_online=1 "
"and t.content_level >= %s and t.content_level <= %s " % (numtime, numtime2, str(content_level_low), str(content_level_top)))
res = cursor.fetchone()
for i, in res:
cursor.execute(
"SELECT pictorial_id FROM community_pictorial_topic where topic_id=%s limit 1" % i)
pictorial_id = cursor.fetchall()
if pictorial_id is not None:
topic_ids.append((i, pictorial_id[0]))
else:
topic_ids.append((i, 0))
return topic_ids
def batch_handle(auto_click_list):
for topic_id in auto_click_list:
try:
cookies = login()
if cookies is not None:
click(cookies, topic_id)
except:
pass
def auto_click_per_1d_by_post():
# 发帖触发自动点赞
auto_click_list = []
try:
# 1-3星及无星
# 1天前发的帖子:[2-6]个赞
numtime1, numtime2 = time_convs(1, 1)
topic_ids = get_commnet_id(numtime2, numtime1, content_level_low=0, content_level_top=3)
for topic_id in topic_ids:
click_num = random.randint(2, 6)
for i in range(click_num):
auto_click_list.append(topic_id)
# 2-15天前发的帖子:[0-2]个赞
numtime1, numtime2 = time_convs(2, 15)
topic_ids = get_commnet_id(numtime2, numtime1, content_level_low=0, content_level_top=3)
for topic_id in topic_ids:
click_num = random.randint(0, 2)
for i in range(click_num):
auto_click_list.append(topic_id)
# 15天前或更早发的帖子:每隔6天[0-1]个赞
numtime1, numtime2 = time_convs(2, 15)
topic_ids = get_commnet_id('0', numtime2, content_level_low=0, content_level_top=3)
for topic_id in topic_ids:
click_num = random.randint(1, 6)
if click_num == 6:
auto_click_list.append(topic_id)
# 4-6星帖
# 1天前发的帖子:[4-12]个赞
numtime1, numtime2 = time_convs(1, 1)
topic_ids = get_commnet_id(numtime2, numtime1, content_level_low=4, content_level_top=6)
for topic_id in topic_ids:
click_num = random.randint(4, 12)
for i in range(click_num):
auto_click_list.append(topic_id)
# 2-15天前发的帖子:[0-6]个赞
numtime1, numtime2 = time_convs(2, 15)
topic_ids = get_commnet_id(numtime2, numtime1, content_level_low=4, content_level_top=6)
for topic_id in topic_ids:
click_num = random.randint(0, 6)
for i in range(click_num):
auto_click_list.append(topic_id)
# 15天前或更早发的帖子:每隔5天[0-3]个赞
numtime1, numtime2 = time_convs(2, 15)
topic_ids = get_commnet_id('0', numtime2, content_level_low=4, content_level_top=6)
for topic_id in topic_ids:
click_num = random.randint(1, 3)
if click_num == 1:
auto_click_list.append(topic_id)
except:
logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc())
logging.info('auto_click_per_1d_by_post: len %s' % len(auto_click_list))
print('auto_click_per_1d_by_post: len %s' % len(auto_click_list))
total = len(auto_click_list)
limit = (total + 10) // 10
for start in range(0, total, limit):
batch = auto_click_list[start:start + limit]
t = Thread(target=batch_handle, args=[batch])
t.start()
import pymysql
import random
import traceback
import logging
from threading import Thread
from vest.request.auto_request import login, time_conv_hour, click
from vest.request.auto_request import host, user, db, passwd
from libs.error import logging_exception
def get_commnet_id(numtime, numtime2, content_level_low=0, content_level_top=6):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
topic_ids = []
# 发贴后
cursor.execute(
"select t.id from topic t left join user_extra u on t.user_id = u.user_id "
"where u.is_shadow=0 and t.create_time > '%s' and t.create_time < '%s' and is_online=1 "
"and t.content_level >= %s and t.content_level <= %s " % (numtime, numtime2, str(content_level_low), str(content_level_top)))
res = cursor.fetchone()
for i, in res:
cursor.execute(
"SELECT pictorial_id FROM community_pictorial_topic where topic_id=%s limit 1" % i)
pictorial_id = cursor.fetchall()
if pictorial_id is not None:
topic_ids.append((i, pictorial_id[0]))
else:
topic_ids.append((i, 0))
return topic_ids
def batch_handle(auto_click_list):
for topic_id in auto_click_list:
try:
cookies = login()
if cookies is not None:
click(cookies, topic_id)
except:
pass
def auto_click_per_2h_by_post():
# 发帖触发自动点赞
auto_click_list = []
try:
# 发帖2小时内:[1-3]个点赞
numtime1, numtime2 = time_conv_hour(0, 2)
topic_ids = get_commnet_id(numtime2, numtime1, content_level_low=0, content_level_top=6)
for topic_id in topic_ids:
click_num = random.randint(1, 3)
for i in range(click_num):
auto_click_list.append(topic_id)
except:
logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc())
logging.info('auto_click_per_2h_by_post: len %s' % len(auto_click_list))
print('auto_click_per_2h_by_post: len %s' % len(auto_click_list))
total = len(auto_click_list)
limit = (total + 10) // 10
for start in range(0, total, limit):
batch = auto_click_list[start:start + limit]
t = Thread(target=batch_handle, args=[batch])
t.start()
......@@ -59,6 +59,7 @@ def get_data(numtime1, numtime2):
def principal_online_comment1():
# 根据问题内容,以及问题的评论条数据,给问题自动加评论,到这个表中取数据community_pictorial_topic
try:
logging.info("comment offline pictorial")
numtime1, numtime2, minute = time_conv_minute(240, 0)
......
......@@ -20,6 +20,7 @@ my_sender = 'lixiaofang@igengmei.com'
my_pass = 'tg5AVKBB8jLQGBET'
my_user6 = "lixiaofang@igengmei.com"
auto_vote_url = settings.AUTO_VOTE_URL
auto_click_url = settings.AUTO_CLICK_URL
auto_reply_url = settings.AUTO_REPLY_URL
auto_follow_url = settings.AUTO_FOLLOW_URL
......@@ -115,13 +116,26 @@ def logins(user_id):
def click(cookies_get, id):
# 点赞
try:
post_dict = {
'type': 0,
'id': id
}
response = requests.post(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
topic_id = id[0]
pictorial_id = id[1]
if pictorial_id:
post_dict = {
"topic_id": topic_id,
"pictorial_id": pictorial_id
}
response = requests.post(url=auto_vote_url,
cookies=cookies_get,
data=post_dict)
else:
post_dict = {
'type': 0,
'id': topic_id
}
response = requests.post(url=auto_click_url,
cookies=cookies_get,
data=post_dict)
logging.info("response.text:%s" % response.text)
......
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