Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
physical
Commits
d2a85655
Commit
d2a85655
authored
Oct 16, 2019
by
吴升宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix auto reply majia user
parent
89a54334
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
32 additions
and
30 deletions
+32
-30
Makefile
Makefile
+1
-1
README.md
README.md
+0
-6
timelib.py
libs/timelib.py
+5
-10
auto_click_per_1d_by_post.py
vest/click/auto_click_per_1d_by_post.py
+1
-1
auto_click_per_2h_by_post.py
vest/click/auto_click_per_2h_by_post.py
+1
-1
auto_follow_per_1d_by_post.py
vest/follow/auto_follow_per_1d_by_post.py
+1
-1
auto_follow_per_1d_by_regist.py
vest/follow/auto_follow_per_1d_by_regist.py
+1
-1
auto_follow_per_2h_by_post_and_regist.py
vest/follow/auto_follow_per_2h_by_post_and_regist.py
+1
-1
auto_follow_per_5m_by_followed.py
vest/follow/auto_follow_per_5m_by_followed.py
+1
-1
auto_reply_per_1d_to_pictorial.py
vest/reply/auto_reply_per_1d_to_pictorial.py
+1
-1
auto_reply_per_1d_to_topic.py
vest/reply/auto_reply_per_1d_to_topic.py
+4
-2
auto_reply_per_2h_to_topic.py
vest/reply/auto_reply_per_2h_to_topic.py
+4
-2
auto_request.py
vest/request/auto_request.py
+11
-2
No files found.
Makefile
View file @
d2a85655
crontab
:
crontab
:
cp
crontab.py /data/log/physical/app/crontab.py
&&
python /data/log/physical/app/crontab.py
&&
python /data/log/physical/app/crontabs.py
cp
crontab.py /data/log/physical/app/crontab.py
&&
python /data/log/physical/app/crontab.py
&&
python /data/log/physical/app/crontabs.py
celery
:
celery
:
celery
-A
phys
c
ical worker
-c
1
-Q
vest
-l
debug
celery
-A
physical worker
-c
1
-Q
vest
-l
debug
README.md
View file @
d2a85655
...
@@ -55,8 +55,3 @@ celery -A physical beat
...
@@ -55,8 +55,3 @@ celery -A physical beat
### physical策略端脚本
### physical策略端脚本
在Alp-Test-Cos-test001服务器上,通过crontab -l查看
在Alp-Test-Cos-test001服务器上,通过crontab -l查看
更新脚本
```
bash
make crontab
```
\ No newline at end of file
libs/timelib.py
View file @
d2a85655
...
@@ -23,18 +23,13 @@ def eta_2_push_time(eta):
...
@@ -23,18 +23,13 @@ def eta_2_push_time(eta):
return
push_time
return
push_time
def
get_rand_time
(
hourlow
=
0
,
hourup
=
13
,
minutelow
=
0
,
min
i
teup
=
60
):
def
get_rand_time
(
hourlow
=
0
,
hourup
=
13
,
minutelow
=
0
,
min
u
teup
=
60
):
hours
=
random
.
randint
(
hourlow
,
hourup
)
hours
=
random
.
randint
(
hourlow
,
hourup
)
minutes
=
random
.
randint
(
minutelow
,
miniteup
)
minutes
=
random
.
randint
(
minutelow
,
minuteup
)
now_time
=
NOW
+
timedelta
(
hours
=
hours
,
minutes
=
minutes
)
# todo redis会自动给加8个小时,所以这边先写死减少8小时
now_time
=
NOW
+
timedelta
(
hours
=
hours
,
minutes
=
minutes
)
-
timedelta
(
hours
=
8
)
time
=
eta_2_push_time
(
now_time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
))
time
=
eta_2_push_time
(
now_time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
))
print
(
datetime
.
fromtimestamp
(
time
))
return
datetime
.
fromtimestamp
(
time
)
return
datetime
.
fromtimestamp
(
time
)
vest/click/auto_click_per_1d_by_post.py
View file @
d2a85655
...
@@ -42,7 +42,7 @@ def batch_handle(auto_click_list):
...
@@ -42,7 +42,7 @@ def batch_handle(auto_click_list):
try
:
try
:
cookies
=
login
()
cookies
=
login
()
if
cookies
is
not
None
:
if
cookies
is
not
None
:
click
.
a
sync_apply
(
args
=
(
cookies
,
topic_id
),
eta
=
get_rand_time
())
click
.
a
pply_async
(
args
=
(
cookies
,
topic_id
),
eta
=
get_rand_time
())
# click(cookies, topic_id)
# click(cookies, topic_id)
except
:
except
:
pass
pass
...
...
vest/click/auto_click_per_2h_by_post.py
View file @
d2a85655
...
@@ -44,7 +44,7 @@ def batch_handle(auto_click_list):
...
@@ -44,7 +44,7 @@ def batch_handle(auto_click_list):
cookies
=
login
()
cookies
=
login
()
if
cookies
is
not
None
:
if
cookies
is
not
None
:
# click(cookies, topic_id)
# click(cookies, topic_id)
click
.
a
sync_apply
(
args
=
(
cookies
,
topic_id
),
eta
=
get_rand_time
(
hourup
=
1
))
click
.
a
pply_async
(
args
=
(
cookies
,
topic_id
),
eta
=
get_rand_time
(
hourup
=
1
))
except
:
except
:
pass
pass
...
...
vest/follow/auto_follow_per_1d_by_post.py
View file @
d2a85655
...
@@ -30,7 +30,7 @@ def batch_handle(auto_follow_list):
...
@@ -30,7 +30,7 @@ def batch_handle(auto_follow_list):
cookies
=
login
()
cookies
=
login
()
if
cookies
is
not
None
:
if
cookies
is
not
None
:
# follow(cookies, user_id)
# follow(cookies, user_id)
follow
.
a
sync_apply
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
())
follow
.
a
pply_async
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
())
except
:
except
:
pass
pass
...
...
vest/follow/auto_follow_per_1d_by_regist.py
View file @
d2a85655
...
@@ -29,7 +29,7 @@ def batch_handle(auto_follow_list):
...
@@ -29,7 +29,7 @@ def batch_handle(auto_follow_list):
cookies
=
login
()
cookies
=
login
()
if
cookies
is
not
None
:
if
cookies
is
not
None
:
# follow(cookies, user_id)
# follow(cookies, user_id)
follow
.
a
sync_apply
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
())
follow
.
a
pply_async
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
())
except
:
except
:
pass
pass
...
...
vest/follow/auto_follow_per_2h_by_post_and_regist.py
View file @
d2a85655
...
@@ -41,7 +41,7 @@ def batch_handle(auto_follow_list):
...
@@ -41,7 +41,7 @@ def batch_handle(auto_follow_list):
cookies
=
login
()
cookies
=
login
()
if
cookies
is
not
None
:
if
cookies
is
not
None
:
# follow(cookies, user_id)
# follow(cookies, user_id)
follow
.
a
sync_apply
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
(
hourup
=
1
))
follow
.
a
pply_async
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
(
hourup
=
1
))
except
:
except
:
pass
pass
...
...
vest/follow/auto_follow_per_5m_by_followed.py
View file @
d2a85655
...
@@ -30,7 +30,7 @@ def auto_follow_per_5m_by_followed():
...
@@ -30,7 +30,7 @@ def auto_follow_per_5m_by_followed():
cookies
=
login
(
str
(
majia_user_ids_dict
.
get
(
str
(
user
[
1
]))))
cookies
=
login
(
str
(
majia_user_ids_dict
.
get
(
str
(
user
[
1
]))))
if
cookies
is
not
None
:
if
cookies
is
not
None
:
# follow(cookies, user_id)
# follow(cookies, user_id)
follow
.
a
sync_apply
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
())
follow
.
a
pply_async
(
args
=
(
cookies
,
user_id
),
eta
=
get_rand_time
())
except
:
except
:
pass
pass
...
...
vest/reply/auto_reply_per_1d_to_pictorial.py
View file @
d2a85655
...
@@ -57,7 +57,7 @@ def batch_handle(pictorial_id_list):
...
@@ -57,7 +57,7 @@ def batch_handle(pictorial_id_list):
if
cookies
is
not
None
:
if
cookies
is
not
None
:
comment
=
judge_pictorial_info_get_comment
(
pictorial_id
)
comment
=
judge_pictorial_info_get_comment
(
pictorial_id
)
# pictorial_reply(cookies, pictorial_id, comment)
# pictorial_reply(cookies, pictorial_id, comment)
pictorial_reply
.
a
sync_apply
(
args
=
(
cookies
,
pictorial_id
,
comment
),
eta
=
get_rand_time
())
pictorial_reply
.
a
pply_async
(
args
=
(
cookies
,
pictorial_id
,
comment
),
eta
=
get_rand_time
())
except
:
except
:
pass
pass
...
...
vest/reply/auto_reply_per_1d_to_topic.py
View file @
d2a85655
import
pymysql
import
pymysql
import
traceback
import
traceback
import
logging
import
logging
import
json
import
random
import
random
from
threading
import
Thread
from
threading
import
Thread
from
vest.request.auto_request
import
login
,
time_convs
,
get_answer_data
,
reply_answer
,
get_majia
,
\
from
vest.request.auto_request
import
login
,
time_convs
,
get_answer_data
,
reply_answer
,
get_majia
,
\
...
@@ -34,13 +35,14 @@ def batch_handle(topic_id_list):
...
@@ -34,13 +35,14 @@ def batch_handle(topic_id_list):
comment
=
judge_topic_info_get_comment
(
topic_id
)
comment
=
judge_topic_info_get_comment
(
topic_id
)
if
comment
:
if
comment
:
# reply(cookies, topic_id, comment)
# reply(cookies, topic_id, comment)
reply
.
a
sync_apply
(
args
=
(
cookies
,
topic_id
,
comment
),
eta
=
get_rand_time
())
reply
.
a
pply_async
(
args
=
(
cookies
,
topic_id
,
comment
),
eta
=
get_rand_time
())
else
:
else
:
comment1
,
comment2
=
get_answer_data
()
comment1
,
comment2
=
get_answer_data
()
response
=
reply_answer
(
cookies
,
topic_id
,
comment1
)
response
=
reply_answer
(
cookies
,
topic_id
,
comment1
)
response
=
json
.
loads
(
response
)
cookies
=
login
()
cookies
=
login
()
reply_id
=
response
[
"data"
][
"id"
]
reply_id
=
response
[
"data"
][
"id"
]
reply2
.
a
sync_apply
(
args
=
(
cookies
,
topic_id
,
comment2
,
reply_id
),
eta
=
get_rand_time
())
reply2
.
a
pply_async
(
args
=
(
cookies
,
topic_id
,
comment2
,
reply_id
),
eta
=
get_rand_time
())
...
...
vest/reply/auto_reply_per_2h_to_topic.py
View file @
d2a85655
import
pymysql
import
pymysql
import
traceback
import
traceback
import
logging
import
logging
import
json
from
threading
import
Thread
from
threading
import
Thread
from
vest.request.auto_request
import
login
,
time_conv_hour
,
get_answer_data
,
reply_answer
,
get_majia
,
\
from
vest.request.auto_request
import
login
,
time_conv_hour
,
get_answer_data
,
reply_answer
,
get_majia
,
\
set_reply_to_redis
,
judge_topic_info_get_comment
,
reply
,
reply2
set_reply_to_redis
,
judge_topic_info_get_comment
,
reply
,
reply2
...
@@ -33,13 +34,14 @@ def batch_handle(topic_id_list):
...
@@ -33,13 +34,14 @@ def batch_handle(topic_id_list):
comment
=
judge_topic_info_get_comment
(
topic_id
)
comment
=
judge_topic_info_get_comment
(
topic_id
)
if
comment
:
if
comment
:
# reply(cookies, topic_id, comment)
# reply(cookies, topic_id, comment)
reply
.
a
sync_apply
(
args
=
(
cookies
,
topic_id
,
comment
),
eta
=
get_rand_time
(
hourup
=
1
))
reply
.
a
pply_async
(
args
=
(
cookies
,
topic_id
,
comment
),
eta
=
get_rand_time
(
hourup
=
1
))
else
:
else
:
comment1
,
comment2
=
get_answer_data
()
comment1
,
comment2
=
get_answer_data
()
response
=
reply_answer
(
cookies
,
topic_id
,
comment1
)
response
=
reply_answer
(
cookies
,
topic_id
,
comment1
)
response
=
json
.
loads
(
response
)
cookies
=
login
()
cookies
=
login
()
reply_id
=
response
[
"data"
][
"id"
]
reply_id
=
response
[
"data"
][
"id"
]
reply2
.
a
sync_apply
(
args
=
(
cookies
,
topic_id
,
comment2
,
reply_id
),
eta
=
get_rand_time
(
hourup
=
1
))
reply2
.
a
pply_async
(
args
=
(
cookies
,
topic_id
,
comment2
,
reply_id
),
eta
=
get_rand_time
(
hourup
=
1
))
except
:
except
:
logging_exception
()
logging_exception
()
...
...
vest/request/auto_request.py
View file @
d2a85655
...
@@ -139,6 +139,7 @@ def click(cookies_get, id):
...
@@ -139,6 +139,7 @@ def click(cookies_get, id):
cookies
=
cookies_get
,
cookies
=
cookies_get
,
data
=
post_dict
)
data
=
post_dict
)
print
(
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
get_error
(
response
.
text
,
"click"
,
id
)
get_error
(
response
.
text
,
"click"
,
id
)
...
@@ -159,6 +160,7 @@ def reply(cookies_get, id, content):
...
@@ -159,6 +160,7 @@ def reply(cookies_get, id, content):
cookies
=
cookies_get
,
cookies
=
cookies_get
,
data
=
post_dict
)
data
=
post_dict
)
print
(
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
get_error
(
response
.
text
,
"reply"
,
id
)
get_error
(
response
.
text
,
"reply"
,
id
)
except
:
except
:
...
@@ -281,6 +283,7 @@ def follow(cookies_get, id):
...
@@ -281,6 +283,7 @@ def follow(cookies_get, id):
cookies
=
cookies_get
,
cookies
=
cookies_get
,
data
=
post_dict
)
data
=
post_dict
)
print
(
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
get_error
(
response
.
text
,
"follow"
,
id
)
get_error
(
response
.
text
,
"follow"
,
id
)
except
:
except
:
...
@@ -448,6 +451,7 @@ def reply2(cookies_get, id, content, replied_id):
...
@@ -448,6 +451,7 @@ def reply2(cookies_get, id, content, replied_id):
cookies
=
cookies_get
,
cookies
=
cookies_get
,
data
=
post_dict
)
data
=
post_dict
)
print
(
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
get_error
(
response
.
text
,
"reply2"
,
id
)
get_error
(
response
.
text
,
"reply2"
,
id
)
except
:
except
:
...
@@ -467,6 +471,7 @@ def pictorial_reply(cookies_get, id, content):
...
@@ -467,6 +471,7 @@ def pictorial_reply(cookies_get, id, content):
cookies
=
cookies_get
,
cookies
=
cookies_get
,
data
=
post_dict
)
data
=
post_dict
)
print
(
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
logging
.
info
(
"response.text:
%
s"
%
response
.
text
)
get_error
(
response
.
text
,
"pictorial_reply"
,
id
)
get_error
(
response
.
text
,
"pictorial_reply"
,
id
)
except
:
except
:
...
@@ -610,7 +615,9 @@ def judge_topic_info_get_comment(topic_id):
...
@@ -610,7 +615,9 @@ def judge_topic_info_get_comment(topic_id):
comment
=
get_face_comment
()
comment
=
get_face_comment
()
# 原始评论
# 原始评论
else
:
else
:
comment
=
get_comment
()
# 返回空就会去拿多级评论
if
random
.
randint
(
0
,
1
):
comment
=
get_comment
()
else
:
else
:
# 判断有没有商品信息
# 判断有没有商品信息
...
@@ -628,7 +635,9 @@ def judge_topic_info_get_comment(topic_id):
...
@@ -628,7 +635,9 @@ def judge_topic_info_get_comment(topic_id):
comment
=
get_face_comment
()
comment
=
get_face_comment
()
# 原始评论
# 原始评论
else
:
else
:
comment
=
get_comment
()
# 返回空就会去拿多级评论
if
random
.
randint
(
0
,
1
):
comment
=
get_comment
()
logging
.
info
(
"get judge_topic_info_get_comment:
%
s"
%
comment
)
logging
.
info
(
"get judge_topic_info_get_comment:
%
s"
%
comment
)
return
comment
return
comment
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment