Commit f4df8516 authored by 钟尚武's avatar 钟尚武

Merge branch 'wsy2' into 'master'

修改 自动关注脚本

See merge request !520
parents 76fc2c24 e85196ed
strategy part like es perform
容器运行命令
docker run -it -p 9999:9999 -d \
--volume=/etc/gm-config:/etc/gm-config \
--volume=/etc/resolv.conf:/etc/resolv.conf \
--volume=/srv/apps/physical/physical/settings_local.py:/srv/apps/physical/physical/settings_local.py \
--entrypoint="/bin/bash" physical-test:1.0 "-c" "source ~/.bashrc && celery -A physical worker -Q tapir-alpha --loglevel=DEBUG --maxtasksperchild 500 -c 62"
strategy part like es perform
容器运行命令
docker run -it -p 9999:9999 -d \
--volume=/etc/gm-config:/etc/gm-config \
--volume=/etc/resolv.conf:/etc/resolv.conf \
--volume=/srv/apps/physical/physical/settings_local.py:/srv/apps/physical/physical/settings_local.py \
--entrypoint="/bin/bash" physical-test:1.0 "-c" "source ~/.bashrc && celery -A physical worker -Q tapir-alpha --loglevel=DEBUG --maxtasksperchild 500 -c 62"
## 启动方式
### 方式1:[program:physical-linucb] 消费kafka数据
一个while True服务,去消费kafka数据,维护redis中device的tag_map
```python
source /srv/envs/physical/bin/activate && python manage.py trans2es_data2es_parallel -S linucb
```
### 方式2:[program:physical] rpc服务
启动rpc服务供后端调用, 接口都在search文件夹下的bind函数定义
```python
gunicorn gm_rpcd.wsgi:application --workers=1 --worker-class=gevent
--worker-connections=1024
--bind=0.0.0.0:9999
--user=gmuser
--chdir /srv/apps/physical/
--timeout 600
--log-level=debug
--error-logfile=/data/log/physical/app/gunicorn_error.log
--access-logfile=/data/log/physical/app/gunicorn_access.log
```
### 方式3 [program:physical-celery] celery 消息队列服务
mysql数据同步到es,入口文件:injection.data_sync.tasks.write_to_es
数据同步工作大部分在数据管道,只有小部分在这,暂时先不用管这个服务,需求用不到
```python
celery -A physical worker -Q tapir-alpha --loglevel=DEBUG --maxtasksperchild 500 -c 62
```
### 方式4 [program:physical-beat-celery] celery 消息队列定时(作用未知)
```python
celery -A physical beat
```
# 自动运行脚本
### venus服务端脚本
通过celery beat 运行
配置说明文件:venus/setting/base.py
具体脚本:venus/communityity/task/xxx.py
目前共5个脚本
1:每天保存用户扫脸图片:community.tasks.save_image_task.save_user_face_image
2:每天3点0分评论自动点赞:community.tasks.crontab_reply_vote_task.crontab_reply_vote
3:向用户推送兴趣标签:community.tasks.push_task.push_interest_tag_pictorial_to_user
4:向用户推送经验标签:community.tasks.push_task.push_topic_draft_task
5:推送主题草稿任务:community.tasks.push_task.push_topic_draft_task
### physical策略端脚本
在Alp-Test-Cos-test001服务器上,通过crontab -l查看
更新脚本
```bash
cp crontab.py /data/log/physical/app/crontab.py
python /data/log/physical/app/crontab.py
python /data/log/physical/app/crontabs.py
```
\ No newline at end of file
import random
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",
"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",
"0 10 * * 3 source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_lunch_app",
"30 10 * * 3 source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_lunch_app2",
"*/5 * * * 1 source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_5m_by_followed",
"1 */2 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m auto_follow_per_2h_by_post_and_regist",
"0 9 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m get_login_session",
"0 0 * * 3 source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m get_user_id",
"0 14,18,22 * * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m principal_online_comment1"
]
random_time_list = [
"* * * 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",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply2",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply3",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply5",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m answer_reply7",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m yesterday_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m before_yesterday_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m three_days_ago_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m five_days_ago_topic_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m seven_days_ago_reply",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment1",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment3",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment2",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment5",
"* * * source /srv/envs/physical/bin/activate && cd /srv/apps/physical && python manage.py trans2es_mapping2es -m reply_comment7"]
###随机生成10-23的一个数字 代表小时
ss1 = random.choices(range(10, 23), k=100)
###随机生成1-60的一个数字 表示分钟
ss2 = random.choices(range(1, 50), k=100)
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")
for var in ontime_list:
data.write(var)
data.write("\n")
......@@ -10,7 +10,8 @@ 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
from vest.follow import auto_follow, auto_follow_new
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
from vest.fix import fix_no_comment_click
from vest.reply_answer import reply_comment2, reply_comment3, answer_reply2, answer_reply3, answer_reply1, \
......@@ -114,6 +115,14 @@ class Command(BaseCommand):
auto_follow.auto_follow()
if options["mvest"] == "auto_follow_new":
auto_follow_new.auto_follow_new()
if options['mvest'] == "auto_follow_per_5m_by_followed":
auto_follow_per_5m_by_followed.auto_follow_per_5m_by_followed()
if options['mvest'] == "auto_follow_per_1d_by_regist":
auto_follow_per_1d_by_regist.auto_follow_per_1d_by_regist()
if options['mvest'] == "auto_follow_per_1d_by_post":
auto_follow_per_1d_by_post.auto_follow_per_1d_by_post()
if options['mvest'] == "auto_follow_per_2h_by_post_and_regist":
auto_follow_per_2h_by_post_and_regist.auto_follow_per_2h_by_post_and_regist()
# 补足
if options["mvest"] == "fix_no_comment_click":
......
majia_user_ids_list = [241407406, 241407033, 241407154, 241407307, 241407284, 241407248, 241407179, 241407428, 241407470, 241407314, 241407385, 241407490, 241407375, 241407318, 241407508, 241407192, 241407131, 241407226, 241407174, 241407505, 241407358, 241407466, 241407452, 241407093, 241407289, 241407495, 241407405, 241407200, 241407330, 241407079, 241407207, 241407100, 241407116, 241407111, 241407302, 241407095, 241407086, 241407499, 241407519, 241407031, 241407288, 241407436, 241407310, 241407404, 241407493, 241407201, 241407084, 241407158, 241407327, 241407178, 241407164, 241407292, 241407387, 241407352, 241407482, 241407325, 241407256, 241407252, 241407485, 241407376, 241407242, 241407219, 241407166, 241407413, 241407343, 241407423, 241407468, 241407198, 241407170, 241407287, 241407138, 241407353, 241407065, 241407262, 241407501, 241407255, 241407512, 241407309, 241407494, 241407319, 241407373, 241407264, 241407471, 241407250, 241407479, 241407456, 241407443, 241407362, 241407157, 241407130, 241407075, 241407390, 241407036, 241407502, 241407092, 241407513, 241407136, 241407048, 241407448, 241407080, 241407459, 241407045, 241407407, 241407186, 241407083, 241407073, 241407191, 241407421, 241407062, 241407275, 241407347, 241407397, 241407052, 241407393, 241407150, 241407063, 241407212, 241407072, 241407500, 241407331, 241407339, 241407474, 241407378, 241407147, 241407316, 241407301, 241407516, 241407527, 241407233, 241407526, 241407365, 241407384, 241407349, 241407210, 241407162, 241407042, 241407057, 241407514, 241407398, 241407103, 241407509, 241407336, 241407335, 241407145, 241407429, 241407144, 241407068, 241407074, 241407077, 241407238, 241407112, 241407236, 241407245, 241407364, 241407101, 241407108, 241407355, 241407431, 241407247, 241407167, 241407050, 241407064, 241407276, 241407139, 241407120, 241407249, 241407097, 241407437, 241407377, 241407140, 241407475, 241407469, 241407168, 241407486, 241407263, 241407379, 241407243, 241407081, 241407114, 241407230, 241407169, 241407059, 241407354, 241407253, 241407106, 241407467, 241407206, 241407221, 241407481, 241407326, 241407185, 241407322, 241407411, 241407044, 241407285, 241407324, 241407522, 241407175, 241407151, 241407246, 241407433, 241407496, 241407234, 241407183, 241407524, 241407265, 241407146, 241407043, 241407217, 241407046, 241407229, 241407417, 241407124, 241407280, 241407137, 241407091, 241407132, 241407261, 241407115, 241407071, 241407165, 241407369, 241407418, 241407176, 241407040, 241407143, 241407058, 241407491, 241407434, 241407329, 241407462, 241407135, 241407338, 241407283, 241407094, 241407117, 241407239, 241407410, 241407435, 241407060, 241407420, 241407424, 241407308, 241407489, 241407286, 241407268, 241407311, 241407328, 241407232, 241407463, 241407304, 241407346, 241407076, 241407126, 241407177, 241407382, 241407438, 241407032, 241407515, 241407363, 241407189, 241407360, 241407282, 241407295, 241407109, 241407340, 241407333, 241407240, 241407457, 241407231, 241407163, 241407492, 241407220, 241407125, 241407182, 241407070, 241407293, 241407356, 241407190, 241407128, 241407039, 241407241, 241407451, 241407334, 241407270, 241407090, 241407412, 241407465, 241407119, 241407244, 241407487, 241407511, 241407196, 241407415, 241407054, 241407504, 241407300, 241407320, 241407447, 241407205, 241407460, 241407216, 241407389, 241407188, 241407313, 241407156, 241407113, 241407350, 241407525, 241407497, 241407211, 241407345, 241407394, 241407107, 241407266, 241407332, 241407197, 241407337, 241407085, 241407366, 241407305, 241407401, 241407315, 241407089, 241407281, 241407386, 241407038, 241407351, 241407507, 241407484, 241407171, 241407082, 241407214, 241407419, 241407321, 241407409, 241407251, 241407426, 241407444, 241407432, 241407391, 241407357, 241407213, 241407368, 241407416, 241407342, 241407312, 241407303, 241407121, 241407099, 241407521, 241407259, 241407510, 241407049, 241407087, 241407279, 241407441, 241407388, 241407105, 241407478, 241407317, 241407142, 241407096, 241407422, 241407277, 241407141, 241407488, 241407297, 241407473, 241407110, 241407361, 241407306, 241407402, 241407215, 241407273, 241407155, 241407257, 241407454, 241407274, 241407123, 241407104, 241407208, 241407298, 241407399, 241407030, 241407069, 241407153, 241407453, 241407449, 241407440, 241407455, 241407223, 241407278, 241407400, 241407359, 241407088, 241407202, 241407254, 241407194, 241407159, 241407161, 241407061, 241407267, 241407372, 241407381, 241407374, 241407173, 241407392, 241407271, 241407341, 241407299, 241407446, 241407439, 241407523, 241407396, 241407227, 241407041, 241407067, 241407181, 241407344, 241407199, 241407203, 241407193, 241407127, 241407348, 241407118, 241407260, 241407209, 241407370, 241407291, 241407367, 241407380, 241407503, 241407037, 241407269, 241407450, 241407133, 241407371, 241407395, 241407122, 241407204, 241407430, 241407152, 241407148, 241407425, 241407160, 241407427, 241407296, 241407518, 241407480, 241407180, 241407272, 241407403, 241407102, 241407225, 241407195, 241407472, 241407056, 241407498, 241407218, 241407055, 241407323, 241407461, 241407098, 241407235, 241407187, 241407290, 241407520, 241407483, 241407172, 241407134, 241407506, 241407129, 241407476, 241407517, 241407237, 241407442, 241407184, 241407464, 241407529, 241407047, 241407053, 241407458, 241407078, 241407066, 241407294, 241407258, 241407035, 241407445, 241407149, 241407414, 241407222, 241407383, 241407408, 241407034, 241407051, 241407477, 241407224, 241407228, 241407528]
majia_user_ids_dict = {'241407030': 's_sgMyOm@shadow.com', '241407031': 's_4HRYFK@shadow.com', '241407032': 's_KaRMJO@shadow.com', '241407033': 's_07ssdt@shadow.com', '241407034': 's_zMc7wq@shadow.com', '241407035': 's_zA014B@shadow.com', '241407036': 's_akgPyg@shadow.com', '241407037': 's_vKSOXA@shadow.com', '241407038': 's_oi7M2a@shadow.com', '241407039': 's_lOTICx@shadow.com', '241407040': 's_i4rFhk@shadow.com', '241407041': 's_UPqB4b@shadow.com', '241407042': 's_do9K3h@shadow.com', '241407043': 's_gXRMNW@shadow.com', '241407044': 's_GGopQR@shadow.com', '241407045': 's_be9Zi8@shadow.com', '241407046': 's_hDAJDM@shadow.com', '241407047': 's_yQJV10@shadow.com', '241407048': 's_axSkdT@shadow.com', '241407049': 's_QI5QFa@shadow.com', '241407050': 's_ERIRTt@shadow.com', '241407051': 's_zNA0qR@shadow.com', '241407052': 's_by2EKN@shadow.com', '241407053': 's_yRDyTe@shadow.com', '241407054': 's_mAu8xe@shadow.com', '241407055': 's_xNXLax@shadow.com', '241407056': 's_xkRtne@shadow.com', '241407057': 's_Dpguo5@shadow.com', '241407058': 's_i7ILAu@shadow.com', '241407059': 's_fjgn6l@shadow.com', '241407060': 's_iwSVzk@shadow.com', '241407061': 's_u39tAC@shadow.com', '241407062': 's_BqeGFr@shadow.com', '241407063': 's_cA91fz@shadow.com', '241407064': 's_ESqCxg@shadow.com', '241407065': 's_8G7dcC@shadow.com', '241407066': 's_yUirRE@shadow.com', '241407067': 's_upU0XW@shadow.com', '241407068': 's_e1gsjY@shadow.com', '241407069': 's_ShQyke@shadow.com', '241407070': 's_KzuAYn@shadow.com', '241407071': 's_hsG5eH@shadow.com', '241407072': 's_cF7TuX@shadow.com', '241407073': 's_bNzT3y@shadow.com', '241407074': 's_E4I3Xs@shadow.com', '241407075': 's_AdUmQr@shadow.com', '241407076': 's_JU1HJp@shadow.com', '241407077': 's_e6gQH3@shadow.com', '241407078': 's_YSpR4I@shadow.com', '241407079': 's_36xYLw@shadow.com', '241407080': 's_b5CSos@shadow.com', '241407081': 's_fGrHfu@shadow.com', '241407082': 's_OTNbWY@shadow.com', '241407083': 's_BmjUyS@shadow.com', '241407084': 's_5gjbBq@shadow.com', '241407085': 's_o1KuZK@shadow.com', '241407086': 's_4cYuPa@shadow.com', '241407087': 's_ql2jNt@shadow.com', '241407088': 's_TlQiUV@shadow.com', '241407089': 's_oD1Hmy@shadow.com', '241407090': 's_lRgLWN@shadow.com', '241407091': 's_hO4VFC@shadow.com', '241407092': 's_AviTFG@shadow.com', '241407093': 's_2Lago0@shadow.com', '241407094': 's_IN3CIK@shadow.com', '241407095': 's_49T1iu@shadow.com', '241407096': 's_QZ5xev@shadow.com', '241407097': 's_f0ULrl@shadow.com', '241407098': 's_XubfZG@shadow.com', '241407099': 's_PzH35A@shadow.com', '241407100': 's_3chHX1@shadow.com', '241407101': 's_Eh80vb@shadow.com', '241407102': 's_XAkiWi@shadow.com', '241407103': 's_DsRsnp@shadow.com', '241407104': 's_S4WZXB@shadow.com', '241407105': 's_QqYjNu@shadow.com', '241407106': 's_FMZSoT@shadow.com', '241407107': 's_NTvlOB@shadow.com', '241407108': 's_ei0zs6@shadow.com', '241407109': 's_KnFg4t@shadow.com', '241407110': 's_ropbJR@shadow.com', '241407111': 's_3Q98tn@shadow.com', '241407112': 's_EbB7e0@shadow.com', '241407113': 's_NdwviG@shadow.com', '241407114': 's_fIH36h@shadow.com', '241407115': 's_HrFCH6@shadow.com', '241407116': 's_3ixLfv@shadow.com', '241407117': 's_IqssSO@shadow.com', '241407118': 's_V1GHJz@shadow.com', '241407119': 's_Lt4V85@shadow.com', '241407120': 's_exsZWG@shadow.com', '241407121': 's_Py0oZ4@shadow.com', '241407122': 's_W4RqbA@shadow.com', '241407123': 's_s1L2lv@shadow.com', '241407124': 's_hgZehK@shadow.com', '241407125': 's_KU3D7m@shadow.com', '241407126': 's_JwVmFg@shadow.com', '241407127': 's_uZRiM7@shadow.com', '241407128': 's_LNhnOE@shadow.com', '241407129': 's_YcQsmL@shadow.com', '241407130': 's_AAXg2x@shadow.com', '241407131': 's_1N8qG8@shadow.com', '241407132': 's_hpC1IP@shadow.com', '241407133': 's_VWL5Pk@shadow.com', '241407134': 's_y8atXB@shadow.com', '241407135': 's_igjXaA@shadow.com', '241407136': 's_axJVqe@shadow.com', '241407137': 's_hhSSqd@shadow.com', '241407138': 's_8Evf2c@shadow.com', '241407139': 's_EvDs7H@shadow.com', '241407140': 's_F6FHfH@shadow.com', '241407141': 's_RGun9G@shadow.com', '241407142': 's_qVKF9Q@shadow.com', '241407143': 's_i6ffeZ@shadow.com', '241407144': 's_E0txbx@shadow.com', '241407145': 's_DVwDK3@shadow.com', '241407146': 's_gwVryk@shadow.com', '241407147': 's_Cm7btb@shadow.com', '241407148': 's_WP3s7w@shadow.com', '241407149': 's_ZdLDZo@shadow.com', '241407150': 's_C2PiMv@shadow.com', '241407151': 's_GPR0C1@shadow.com', '241407152': 's_wnrxFo@shadow.com', '241407153': 's_sNyLO4@shadow.com', '241407154': 's_08DlWX@shadow.com', '241407155': 's_rTS8qV@shadow.com', '241407156': 's_nd6HiH@shadow.com', '241407157': 's_a9cIf1@shadow.com', '241407158': 's_5I3fN3@shadow.com', '241407159': 's_TWwKNi@shadow.com', '241407160': 's_WrVSmD@shadow.com', '241407161': 's_Twwxb8@shadow.com', '241407162': 's_DJvlFY@shadow.com', '241407163': 's_KTcosq@shadow.com', '241407164': 's_5o4RJL@shadow.com', '241407165': 's_hsj9pq@shadow.com', '241407166': 's_7TOm5v@shadow.com', '241407167': 's_enXoFU@shadow.com', '241407168': 's_F9hH2t@shadow.com', '241407169': 's_fJD9SK@shadow.com', '241407170': 's_895iAz@shadow.com', '241407171': 's_oniMPE@shadow.com', '241407172': 's_y6GymP@shadow.com', '241407173': 's_UGN1aM@shadow.com', '241407174': 's_1RCzUi@shadow.com', '241407175': 's_GPok7I@shadow.com', '241407176': 's_hX41uJ@shadow.com', '241407177': 's_jYDXVu@shadow.com', '241407178': 's_5M8FPz@shadow.com', '241407179': 's_0KyxOu@shadow.com', '241407180': 's_wWtI7X@shadow.com', '241407181': 's_upwHbj@shadow.com', '241407182': 's_kWGe6S@shadow.com', '241407183': 's_GtpUFG@shadow.com', '241407184': 's_yMfJP3@shadow.com', '241407185': 's_g3zIuG@shadow.com', '241407186': 's_bLymnh@shadow.com', '241407187': 's_xvwj7J@shadow.com', '241407188': 's_n2rgzI@shadow.com', '241407189': 's_kfGtFE@shadow.com', '241407190': 's_lK7QJJ@shadow.com', '241407191': 's_bOQCNQ@shadow.com', '241407192': 's_1mypap@shadow.com', '241407193': 's_ux8AJL@shadow.com', '241407194': 's_twoHks@shadow.com', '241407195': 's_xgZqN4@shadow.com', '241407196': 's_MaChwe@shadow.com', '241407197': 's_NzQnI9@shadow.com', '241407198': 's_87PpDu@shadow.com', '241407199': 's_UTQ2Lb@shadow.com', '241407200': 's_2ZlLCx@shadow.com', '241407201': 's_5FAGd4@shadow.com', '241407202': 's_TNhLPD@shadow.com', '241407203': 's_uujHEb@shadow.com', '241407204': 's_wBqKNY@shadow.com', '241407205': 's_MrbRuR@shadow.com', '241407206': 's_FPb33o@shadow.com', '241407207': 's_3c7tUk@shadow.com', '241407208': 's_s7uz0U@shadow.com', '241407209': 's_v3TI1p@shadow.com', '241407210': 's_djjDaF@shadow.com', '241407211': 's_NjoRTW@shadow.com', '241407212': 's_CDooAN@shadow.com', '241407213': 's_pkMFSS@shadow.com', '241407214': 's_OU8QCt@shadow.com', '241407215': 's_rSlV4T@shadow.com', '241407216': 's_MtxuFr@shadow.com', '241407217': 's_H36e9F@shadow.com', '241407218': 's_xnXhe5@shadow.com', '241407219': 's_7nWGkq@shadow.com', '241407220': 's_KtWEu9@shadow.com', '241407221': 's_FpzO9Q@shadow.com', '241407222': 's_zhOQcV@shadow.com', '241407223': 's_T8Gcjy@shadow.com', '241407224': 's_ZsMr7d@shadow.com', '241407225': 's_XgWX4z@shadow.com', '241407226': 's_1ozsiy@shadow.com', '241407227': 's_UPD6bx@shadow.com', '241407228': 's_zsvmqU@shadow.com', '241407229': 's_HfHwKX@shadow.com', '241407230': 's_FihASr@shadow.com', '241407231': 's_KRN7h9@shadow.com', '241407232': 's_Jmkcc9@shadow.com', '241407233': 's_d7TIgK@shadow.com', '241407234': 's_gtMV3b@shadow.com', '241407235': 's_XVsXeA@shadow.com', '241407236': 's_edvBYb@shadow.com', '241407237': 's_YiX7OV@shadow.com', '241407238': 's_EAYAMe@shadow.com', '241407239': 's_IR0Jmz@shadow.com', '241407240': 's_KphQ2M@shadow.com', '241407241': 's_lPRv0u@shadow.com', '241407242': 's_7FUcFf@shadow.com', '241407243': 's_FGgy48@shadow.com', '241407244': 's_ltsupK@shadow.com', '241407245': 's_Ee4QC1@shadow.com', '241407246': 's_gqBA3v@shadow.com', '241407247': 's_embU8E@shadow.com', '241407248': 's_0I4C0g@shadow.com', '241407249': 's_EzpzqV@shadow.com', '241407250': 's_98A1Z2@shadow.com', '241407251': 's_p5kFP1@shadow.com', '241407252': 's_6srtjM@shadow.com', '241407253': 's_FJyYaA@shadow.com', '241407254': 's_TSJPo5@shadow.com', '241407255': 's_8nvaAF@shadow.com', '241407256': 's_6rkYkC@shadow.com', '241407257': 's_rUnoMo@shadow.com', '241407258': 's_Z8PP5J@shadow.com', '241407259': 's_Q5LUMj@shadow.com', '241407260': 's_v26xAA@shadow.com', '241407261': 's_HqZEg7@shadow.com', '241407262': 's_8gSWmC@shadow.com', '241407263': 's_fCQcu1@shadow.com', '241407264': 's_91xnox@shadow.com', '241407265': 's_gvlFut@shadow.com', '241407266': 's_nyfbCS@shadow.com', '241407267': 's_uA9TOF@shadow.com', '241407268': 's_JLlz1L@shadow.com', '241407269': 's_vm9MFh@shadow.com', '241407270': 's_Lqxoqm@shadow.com', '241407271': 's_uhXH6g@shadow.com', '241407272': 's_Wyn2gW@shadow.com', '241407273': 's_rtCnmO@shadow.com', '241407274': 's_RyIPYo@shadow.com', '241407275': 's_bS8mIT@shadow.com', '241407276': 's_eUL2wx@shadow.com', '241407277': 's_rggaRa@shadow.com', '241407278': 's_T93ZyL@shadow.com', '241407279': 's_qnVpkI@shadow.com', '241407280': 's_hHpKxO@shadow.com', '241407281': 's_OgaFKI@shadow.com', '241407282': 's_kJWvzA@shadow.com', '241407283': 's_ilPCgr@shadow.com', '241407284': 's_0bCas9@shadow.com', '241407285': 's_gJ4l7J@shadow.com', '241407286': 's_jBC0ve@shadow.com', '241407287': 's_8e80N0@shadow.com', '241407288': 's_4jPHc1@shadow.com', '241407289': 's_2LjC8I@shadow.com', '241407290': 's_XXGEwN@shadow.com', '241407291': 's_VbZq9G@shadow.com', '241407292': 's_5rfk9c@shadow.com', '241407293': 's_kzuGZj@shadow.com', '241407294': 's_yUUJmV@shadow.com', '241407295': 's_Kmd5N3@shadow.com', '241407296': 's_wvsmbJ@shadow.com', '241407297': 's_ROiMbb@shadow.com', '241407298': 's_sAZ7L8@shadow.com', '241407299': 's_UJWzA6@shadow.com', '241407300': 's_mCazhk@shadow.com', '241407301': 's_cuQRSf@shadow.com', '241407302': 's_3Us8vf@shadow.com', '241407303': 's_pxACJM@shadow.com', '241407304': 's_jRQhe1@shadow.com', '241407305': 's_O8qfPf@shadow.com', '241407306': 's_rQC4Tn@shadow.com', '241407307': 's_09lKhD@shadow.com', '241407308': 's_J3uR9F@shadow.com', '241407309': 's_8vCW0n@shadow.com', '241407310': 's_53EyN7@shadow.com', '241407311': 's_jlNKoI@shadow.com', '241407312': 's_prpHwa@shadow.com', '241407313': 's_NBpqo6@shadow.com', '241407314': 's_0YjkyC@shadow.com', '241407315': 's_oD0SPa@shadow.com', '241407316': 's_cRZ820@shadow.com', '241407317': 's_QuSUc9@shadow.com', '241407318': 's_1aQRIO@shadow.com', '241407319': 's_8WpiMk@shadow.com', '241407320': 's_mFbRwb@shadow.com', '241407321': 's_P0Y9Tk@shadow.com', '241407322': 's_GakHBe@shadow.com', '241407323': 's_XQ3BZh@shadow.com', '241407324': 's_gJDa8J@shadow.com', '241407325': 's_6MhNqA@shadow.com', '241407326': 's_fvdNZW@shadow.com', '241407327': 's_5J2GxW@shadow.com', '241407328': 's_JluV3t@shadow.com', '241407329': 's_Iblrkj@shadow.com', '241407330': 's_335ZV4@shadow.com', '241407331': 's_CHiVph@shadow.com', '241407332': 's_nYtmvx@shadow.com', '241407333': 's_KPbWLr@shadow.com', '241407334': 's_lQKSDY@shadow.com', '241407335': 's_Du0nUG@shadow.com', '241407336': 's_DTILiI@shadow.com', '241407337': 's_NzzDIB@shadow.com', '241407338': 's_IJ4WKW@shadow.com', '241407339': 's_ChO3b1@shadow.com', '241407340': 's_kNYvxm@shadow.com', '241407341': 's_UJDVhN@shadow.com', '241407342': 's_pPYeUT@shadow.com', '241407343': 's_85Kgkq@shadow.com', '241407344': 's_uTPfeO@shadow.com', '241407345': 's_nO8pMn@shadow.com', '241407346': 's_Jsgrmu@shadow.com', '241407347': 's_BXqhZU@shadow.com', '241407348': 's_V11qVt@shadow.com', '241407349': 's_dIHw1i@shadow.com', '241407350': 's_nh6qPY@shadow.com', '241407351': 's_OKKdnO@shadow.com', '241407352': 's_68WhjX@shadow.com', '241407353': 's_8FXzfc@shadow.com', '241407354': 's_FJSZGg@shadow.com', '241407355': 's_EkQYST@shadow.com', '241407356': 's_LbXj8I@shadow.com', '241407357': 's_PewDvT@shadow.com', '241407358': 's_1wfiXX@shadow.com', '241407359': 's_tIpF2Z@shadow.com', '241407360': 's_KifGet@shadow.com', '241407361': 's_RpvPdS@shadow.com', '241407362': 's_a30n4A@shadow.com', '241407363': 's_KExWNT@shadow.com', '241407364': 's_eGi9Rv@shadow.com', '241407365': 's_De6CKT@shadow.com', '241407366': 's_o4Fr6f@shadow.com', '241407367': 's_vDC1eS@shadow.com', '241407368': 's_pl3E7A@shadow.com', '241407369': 's_HttzBh@shadow.com', '241407370': 's_vAhvMd@shadow.com', '241407371': 's_w1S8S8@shadow.com', '241407372': 's_UcMCt1@shadow.com', '241407373': 's_8ZpViX@shadow.com', '241407374': 's_UGjdzs@shadow.com', '241407375': 's_17kAoA@shadow.com', '241407376': 's_741wfB@shadow.com', '241407377': 's_f5Jj7b@shadow.com', '241407378': 's_CJiMB7@shadow.com', '241407379': 's_FfHEiT@shadow.com', '241407380': 's_VI2Imw@shadow.com', '241407381': 's_UdLIDf@shadow.com', '241407382': 's_k77N6c@shadow.com', '241407383': 's_zKJf4X@shadow.com', '241407384': 's_dGjQK4@shadow.com', '241407385': 's_15Du4D@shadow.com', '241407386': 's_oGmTi8@shadow.com', '241407387': 's_65gIdM@shadow.com', '241407388': 's_qOqqzJ@shadow.com', '241407389': 's_mUZqQt@shadow.com', '241407390': 's_aI9Ku7@shadow.com', '241407391': 's_PdBQu7@shadow.com', '241407392': 's_UhTVV5@shadow.com', '241407393': 's_bzRObE@shadow.com', '241407394': 's_ntnHXm@shadow.com', '241407395': 's_w3ZZJn@shadow.com', '241407396': 's_uMjxpT@shadow.com', '241407397': 's_BxSAPH@shadow.com', '241407398': 's_dsJUNE@shadow.com', '241407399': 's_sfLGzM@shadow.com', '241407400': 's_Tao00Z@shadow.com', '241407401': 's_o92L1i@shadow.com', '241407402': 's_rRrUE5@shadow.com', '241407403': 's_x5DTTo@shadow.com', '241407404': 's_55RYhl@shadow.com', '241407405': 's_2Yteeu@shadow.com', '241407406': 's_06fWcj@shadow.com', '241407407': 's_BEa7Nm@shadow.com', '241407408': 's_Zli3Rp@shadow.com', '241407409': 's_p1PEOV@shadow.com', '241407410': 's_ISOl1S@shadow.com', '241407411': 's_gFzMYy@shadow.com', '241407412': 's_lRjEm4@shadow.com', '241407413': 's_7UkikS@shadow.com', '241407414': 's_ZFISK2@shadow.com', '241407415': 's_MaqNBa@shadow.com', '241407416': 's_PoKDa9@shadow.com', '241407417': 's_hFMaHa@shadow.com', '241407418': 's_hveGbT@shadow.com', '241407419': 's_OXrBq7@shadow.com', '241407420': 's_IYyGo8@shadow.com', '241407421': 's_BP84Ls@shadow.com', '241407422': 's_rexvsp@shadow.com', '241407423': 's_86vJCD@shadow.com', '241407424': 's_J2n2rf@shadow.com', '241407425': 's_wrajLj@shadow.com', '241407426': 's_p7moGs@shadow.com', '241407427': 's_WsbZFz@shadow.com', '241407428': 's_0LpqA0@shadow.com', '241407429': 's_DXhqau@shadow.com', '241407430': 's_wLJpFr@shadow.com', '241407431': 's_elsxmB@shadow.com', '241407432': 's_PbDamE@shadow.com', '241407433': 's_gsAitD@shadow.com', '241407434': 's_iAO3TP@shadow.com', '241407435': 's_ITbTqk@shadow.com', '241407436': 's_4O4rSo@shadow.com', '241407437': 's_f4PIek@shadow.com', '241407438': 's_kAafF1@shadow.com', '241407439': 's_UlbokC@shadow.com', '241407440': 's_StVyIN@shadow.com', '241407441': 's_Qny9jd@shadow.com', '241407442': 's_yLXjZH@shadow.com', '241407443': 's_A206OU@shadow.com', '241407444': 's_PA9kIT@shadow.com', '241407445': 's_ZCN9cu@shadow.com', '241407446': 's_ukKc8S@shadow.com', '241407447': 's_MhRJYd@shadow.com', '241407448': 's_aYvHUZ@shadow.com', '241407449': 's_sQTGcP@shadow.com', '241407450': 's_vqyczy@shadow.com', '241407451': 's_lqerll@shadow.com', '241407452': 's_2dIy2D@shadow.com', '241407453': 's_sqPBhm@shadow.com', '241407454': 's_rxeL87@shadow.com', '241407455': 's_T7Zllb@shadow.com', '241407456': 's_A1prFK@shadow.com', '241407457': 's_kqy0Ti@shadow.com', '241407458': 's_yRxvCl@shadow.com', '241407459': 's_bAf12Y@shadow.com', '241407460': 's_mSDYSZ@shadow.com', '241407461': 's_XQa53g@shadow.com', '241407462': 's_ifZ8Nd@shadow.com', '241407463': 's_JnVz5P@shadow.com', '241407464': 's_YQAkOm@shadow.com', '241407465': 's_LrWglN@shadow.com', '241407466': 's_20d8Bf@shadow.com', '241407467': 's_FOhoT3@shadow.com', '241407468': 's_87duIN@shadow.com', '241407469': 's_f7Wbt1@shadow.com', '241407470': 's_0rotjy@shadow.com', '241407471': 's_95vHay@shadow.com', '241407472': 's_xjCKlA@shadow.com', '241407473': 's_roJThz@shadow.com', '241407474': 's_cIoVmE@shadow.com', '241407475': 's_F7Kobr@shadow.com', '241407476': 's_Ye2HV6@shadow.com', '241407477': 's_Zq0esd@shadow.com', '241407478': 's_qtIoFr@shadow.com', '241407479': 's_9SUFAA@shadow.com', '241407480': 's_wWfMdw@shadow.com', '241407481': 's_fSjdY4@shadow.com', '241407482': 's_6COY94@shadow.com', '241407483': 's_Y4eWHx@shadow.com', '241407484': 's_oLysj9@shadow.com', '241407485': 's_6Sve8x@shadow.com', '241407486': 's_fai50t@shadow.com', '241407487': 's_LxFO8U@shadow.com', '241407488': 's_rha2wA@shadow.com', '241407489': 's_jb6wqN@shadow.com', '241407490': 's_16PqdV@shadow.com', '241407491': 's_I89v8b@shadow.com', '241407492': 's_kTP2tk@shadow.com', '241407493': 's_58S40h@shadow.com', '241407494': 's_8wiQXC@shadow.com', '241407495': 's_2n6PoJ@shadow.com', '241407496': 's_gsvhGu@shadow.com', '241407497': 's_njbBDy@shadow.com', '241407498': 's_xMzp0h@shadow.com', '241407499': 's_4g7YHw@shadow.com', '241407500': 's_cgbaLZ@shadow.com', '241407501': 's_8hDFBn@shadow.com', '241407502': 's_aOIRXe@shadow.com', '241407503': 's_vKHZZk@shadow.com', '241407504': 's_Mbo1lq@shadow.com', '241407505': 's_1RRDLt@shadow.com', '241407506': 's_YbKv8b@shadow.com', '241407507': 's_oLPWVd@shadow.com', '241407508': 's_1L5VHC@shadow.com', '241407509': 's_dt8GRU@shadow.com', '241407510': 's_q8Plkv@shadow.com', '241407511': 's_M4qo0a@shadow.com', '241407512': 's_8TOaIC@shadow.com', '241407513': 's_Axbdwo@shadow.com', '241407514': 's_DsgJyQ@shadow.com', '241407515': 's_KcE9m4@shadow.com', '241407516': 's_cxUoTi@shadow.com', '241407517': 's_yf5F2d@shadow.com', '241407518': 's_WWBin1@shadow.com', '241407519': 's_4hNpGq@shadow.com', '241407520': 's_Y0DdxY@shadow.com', '241407521': 's_q4AaZH@shadow.com', '241407522': 's_GnhyAn@shadow.com', '241407523': 's_ULfH0b@shadow.com', '241407524': 's_GUt0uv@shadow.com', '241407525': 's_nh7lJ6@shadow.com', '241407526': 's_dDXEx1@shadow.com', '241407527': 's_d6tSOl@shadow.com', '241407528': 's_ZUKIJB@shadow.com', '241407529': 's_YQizji@shadow.com'}
import pymysql
import random
import traceback
import logging
from threading import Thread
from vest.request.auto_request import login, time_convs, follow
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=3):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
# 发贴后
cursor.execute(
"select t.user_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 t.content_level >= %s and t.content_level <= %s " % (numtime, numtime2, str(content_level_low), str(content_level_top)))
res = cursor.fetchall()
return res and [i for i, in res] or []
def batch_handle(auto_follow_list):
for user_id in auto_follow_list:
try:
cookies = login()
if cookies is not None:
follow(cookies, user_id)
except:
pass
def auto_follow_per_1d_by_post():
# 发帖触发自动加粉丝
auto_follow_list = []
try:
# 0-3星
# 1天前发的帖子:[2-6]个粉丝
numtime1, numtime2 = time_convs(1, 1)
user_ids = get_commnet_id(numtime2, numtime1, content_level_low=0, content_level_top=3)
for user_id in user_ids:
follow_num = random.randint(2, 6)
for i in range(follow_num):
auto_follow_list.append(user_id)
# 2-15天前发的帖子:[0-1]个粉丝
numtime1, numtime2 = time_convs(2, 15)
user_ids = get_commnet_id(numtime2, numtime1, content_level_low=0, content_level_top=3)
for user_id in user_ids:
follow_num = random.randint(0, 1)
for i in range(follow_num):
auto_follow_list.append(user_id)
# 15天前或更早发的帖子:每隔11天[0-2]个粉丝
numtime1, numtime2 = time_convs(2, 15)
user_ids = get_commnet_id('0', numtime2, content_level_low=0, content_level_top=3)
for user_id in user_ids:
follow_num = random.randint(1, 6)
if follow_num == 6:
auto_follow_list.append(user_id)
# 4-6星
# 1天前发的帖子:[5-10]个粉丝
numtime1, numtime2 = time_convs(1, 1)
user_ids = get_commnet_id(numtime2, numtime1, content_level_low=4, content_level_top=6)
for user_id in user_ids:
follow_num = random.randint(5, 10)
for i in range(follow_num):
auto_follow_list.append(user_id)
# 2-15天前发的帖子:[0-5]个粉丝
numtime1, numtime2 = time_convs(2, 15)
user_ids = get_commnet_id(numtime2, numtime1, content_level_low=4, content_level_top=6)
for user_id in user_ids:
follow_num = random.randint(0, 5)
for i in range(follow_num):
auto_follow_list.append(user_id)
# 15天前或更早发的帖子:每隔11天[0-2]个粉丝
numtime1, numtime2 = time_convs(2, 15)
user_ids = get_commnet_id('0', numtime2, content_level_low=4, content_level_top=6)
for user_id in user_ids:
follow_num = random.randint(1, 6)
if follow_num == 6:
auto_follow_list.append(user_id)
except:
logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc())
logging.info('auto_follow_per_1d_by_post: len %s' % len(auto_follow_list))
print('auto_follow_per_1d_by_post: len %s' % len(auto_follow_list))
total = len(auto_follow_list)
limit = (total + 10) // 10
for start in range(0, total, limit):
batch = auto_follow_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_convs, follow
from vest.request.auto_request import host, user, db, passwd
from libs.error import logging_exception
def get_commnet_id(numtime, numtime2):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
# 注册后
cursor.execute(
"select a.user_id from account_user a left join user_extra u on a.user_id = u.user_id "
"WHERE a.create_time > '%s' and a.create_time < '%s' and u.is_shadow = 0 " % (numtime, numtime2))
res = cursor.fetchall()
return res and [i for i, in res] or []
def batch_handle(auto_follow_list):
for user_id in auto_follow_list:
try:
cookies = login()
if cookies is not None:
follow(cookies, user_id)
except:
pass
def auto_follow_per_1d_by_regist():
# 注册事件触发自动加粉丝
auto_follow_list = []
try:
# 1天前注册:[1-3]个粉丝
numtime1, numtime2 = time_convs(1, 1)
user_ids= get_commnet_id(numtime2, numtime1)
for user_id in user_ids:
follow_num = random.randint(1, 3)
for i in range(follow_num):
auto_follow_list.append(user_id)
# 2-10天前注册:[0-1]个粉丝
numtime1, numtime2 = time_convs(2, 12)
user_ids = get_commnet_id(numtime2, numtime1)
for user_id in user_ids:
follow_num = random.randint(0, 1)
for i in range(follow_num):
auto_follow_list.append(user_id)
# 10天前注册:每隔12天[0-1]个赞
numtime1, numtime2 = time_convs(1, 12)
user_ids = get_commnet_id('0', numtime2)
for user_id in user_ids:
follow_num = random.randint(1, 24)
if follow_num == 12:
auto_follow_list.append(user_id)
except:
logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc())
logging.info('auto_follow_per_1d_by_regist: len %s' % len(auto_follow_list))
print('auto_follow_per_1d_by_regist: len %s' % len(auto_follow_list))
total = len(auto_follow_list)
limit = (total + 10) // 10
for start in range(0, total, limit):
batch = auto_follow_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, follow
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()
# 发贴后
cursor.execute(
"select t.user_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 t.content_level >= %s and t.content_level <= %s " % (numtime, numtime2, str(content_level_low), str(content_level_top)))
res_post = cursor.fetchall()
# 注册后
cursor.execute(
"select a.user_id from account_user a left join user_extra u on a.user_id = u.user_id "
"WHERE a.create_time > '%s' and a.create_time < '%s' and u.is_shadow = 0 " % (numtime, numtime2))
res_regist = cursor.fetchall()
res = []
res.extend(res_regist)
res.extend(res_post)
return res and [i for i, in res] or []
def batch_handle(auto_follow_list):
for user_id in auto_follow_list:
try:
cookies = login()
if cookies is not None:
follow(cookies, user_id)
except:
pass
def auto_follow_per_2h_by_post_and_regist():
# 发帖,注册触发自动加粉丝
auto_follow_list = []
try:
# 发帖,注册后2小时内:[1-3]个粉丝
numtime1, numtime2 = time_conv_hour(0, 2)
user_ids = get_commnet_id(numtime2, numtime1, content_level_low=0, content_level_top=6)
for user_id in user_ids:
follow_num = random.randint(1, 3)
for i in range(follow_num):
auto_follow_list.append(user_id)
except:
logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc())
logging.info('auto_follow_per_2h_by_post_and_regist: len %s' % len(auto_follow_list))
print('auto_follow_per_2h_by_post_and_regist: len %s' % len(auto_follow_list))
total = len(auto_follow_list)
limit = (total + 10) // 10
for start in range(0, total, limit):
batch = auto_follow_list[start:start + limit]
t = Thread(target=batch_handle, args=[batch])
t.start()
import pymysql
import traceback
import logging
from vest.request.auto_request import login, follow, time_conv_minute
from vest.request.auto_request import host, user, db, passwd
from vest.data.majia_user_ids import majia_user_ids_dict
from libs.error import logging_exception
def get_user_id(numtime):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
cursor.execute(
"SELECT f.user_id, f.follow_id FROM user_follow f left join user_extra e on f.follow_id = e.user_id "
"WHERE f.create_time >= '%s' and e.is_shadow = 1 " % numtime
)
data_comment = cursor.fetchall()
return data_comment and [i for i in data_comment] or []
def auto_follow_per_5m_by_followed():
# 如果马甲被用户关注,马甲即反向关注用户, 被关注5分钟后
try:
numtime1, numtime2, c = time_conv_minute(1, 5)
users = get_user_id(numtime2)
try:
for user in users and users:
user_id = user[0]
cookies = login(str(majia_user_ids_dict.get(str(user[1]))))
if cookies is not None:
follow(cookies, user_id)
except:
pass
except:
logging_exception()
logging.error("catch exception,main:%s" % traceback.format_exc())
......@@ -82,8 +82,9 @@ def get_cookies(user_id):
return None
def login():
def login(user_id=None):
try:
if not user_id:
user_id = get_majia()
logging.info("get user_id:%s" % user_id)
......@@ -112,6 +113,7 @@ def logins(user_id):
def click(cookies_get, id):
# 点赞
try:
post_dict = {
'type': 0,
......@@ -168,6 +170,16 @@ def time_conv_minute(minutest, minutest2):
return None
def time_conv_hour(minutest, minutest2):
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(hours=minutest)
yes_time2 = now - datetime.timedelta(hours=minutest2)
return yes_time, yes_time2
except:
return None
def time_now(minutest):
try:
now = datetime.datetime.now()
......@@ -178,6 +190,11 @@ def time_now(minutest):
def time_convs(numtime, numtime2):
'''
params: 1, 2
datetime.now(): 2019-10-09 10:35:50.231463
return: 2019-10-08 23:59:59.000000 2019-10-07 00:00:00.000000
'''
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime)
......@@ -190,7 +207,6 @@ def time_convs(numtime, numtime2):
logging.info("get yes_time_str:%s" % yes_time_str)
logging.info("get yes_time_str2:%s" % yes_time_str2)
return yes_time_str, yes_time_str2
except:
return None
......
import pymysql
import datetime
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.16',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'master': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.6',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'face': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'face',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.16',
'PORT': '3306',
# 'CONN_MAX_AGE': None,
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'commodity': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'commodity',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.16',
'PORT': '3306',
# 'CONN_MAX_AGE': None,
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
}
}
host = DATABASES['default']['HOST']
user = DATABASES['default']['USER']
port = DATABASES['default']['PORT']
db = DATABASES['default']['NAME']
passwd = DATABASES['default']['PASSWORD']
def time_convs(numtime, numtime2):
'''
params: 1, 2
datetime.now(): 2019-10-09 10:35:50.231463
return: 2019-10-08 23:59:59.000000 2019-10-07 00:00:00.000000
'''
try:
now = datetime.datetime.now()
yes_time = now - datetime.timedelta(days=numtime)
yes_time_str = yes_time.strftime('%Y-%m-%d')
yes_time_str = yes_time_str + ' 23:59:59.000000'
yes_time2 = now - datetime.timedelta(days=numtime2)
yes_time_str2 = yes_time2.strftime('%Y-%m-%d')
yes_time_str2 = yes_time_str2 + ' 00:00:00.000000'
return yes_time_str, yes_time_str2
except:
return None
def get_commnet_id(numtime, numtime2):
pc = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=3306)
cursor = pc.cursor()
# 发贴后
cursor.execute(
"select user_id from topic WHERE create_time > '%s' and create_time < '%s' " % (numtime, numtime2))
data_new_user = cursor.fetchall()
all_data = list(data_new_user)
user_id_list = []
for i in all_data and all_data:
cursor.execute(
"select user_id from user_extra where user_id =" + str(i[0]) + " and is_shadow =0 ")
data = cursor.fetchall()
user_id = list(data)
if (user_id and user_id[0][1] == 0) or len(user_id) == 0:
user_id_list.append(i)
pc.close()
return user_id_list
# numtime1, numtime2 = time_convs(1, 1)
# user_id = get_commnet_id(numtime2, numtime1)
# def time_conv_minute(minutest, minutest2):
# try:
# now = datetime.datetime.now()
# minute = datetime.datetime.now().minute
# yes_time = now - datetime.timedelta(minutes=minutest)
# yes_time2 = now - datetime.timedelta(minutes=minutest2)
# return yes_time, yes_time2, minute
# except:
# return None
#
# a, b, c = time_conv_minute(0, 5)
#
# print(a, b)
import requests
auto_follow_url = 'http://earth.gmapp.env/api/v1/follow'
def follow(cookies_get, id):
post_dict = {
'type': 1,
'id': id
}
response = requests.post(url=auto_follow_url,
cookies=cookies_get,
data=post_dict)
print(response.text)
follow({'sessionid': 'qsukyafj7ub2f43f33g2jm0kkvqf0sa7'}, 241765445)
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