@@ -61,18 +61,18 @@ def init_post_dict(self):
61
61
self .post_dict ['token' ] = self .user .data .get ('token' )
62
62
63
63
def post (self ):
64
- count = 0
64
+ self .check () # Must be called.
65
+ self .successful
65
66
fields_list = self .user .data ['fields' ]
67
+
66
68
for filed_info in fields_list :
67
69
if filed_info ['hasEgg' ] == '1' :
68
70
count += 1
69
71
self .post_dict ['fieldId' ] = filed_info .get ('id' )
70
72
self .post_obj = Post ('getFieldEggs' , self .post_dict )
71
73
self .check ()
72
- self . check ()
74
+
73
75
# TODO check logic
74
- if count == 0 :
75
- self .successful = True
76
76
# sleep
77
77
78
78
def success (self ):
@@ -117,7 +117,7 @@ def post(self):
117
117
self .check ()
118
118
if not self .successful :
119
119
self .log .log (self .post_obj .response_json ['message' ])
120
- self .check ()
120
+ self .check () # Should have called check()
121
121
# TODO check logic
122
122
if active_count == 0 :
123
123
self .successful = True
@@ -131,7 +131,6 @@ def fail(self):
131
131
self .next_step = 'end' # todo 下一步是啥
132
132
133
133
134
-
135
134
class CleanFriend (PostInterface ):
136
135
def __init__ (self , user , log ):
137
136
GetFriendList (user , log )
@@ -143,18 +142,19 @@ def init_post_dict(self):
143
142
self .post_dict ['token' ] = self .user .data .get ('token' )
144
143
145
144
def post (self ):
146
- self .check ()
147
- print ('clean' , self .successful )
145
+ self .check () # Must be called.
146
+ self .successful = True
147
+
148
148
if self .user .data ['friends' ]:
149
149
for friend in self .user .data ['friends' ]:
150
150
# 还没被清扫
151
151
if friend ['hasClean' ] == '0' :
152
152
self .post_dict ['friendId' ] = friend .get ('userId' )
153
153
self .post_obj = Post ('cleanFriend' , self .post_dict )
154
- self .check ()
155
- if not self .successful :
154
+ if self .post_obj and not self .check ():
156
155
self .log .log (self .post_obj .response_json ['message' ])
157
- self .check ()
156
+ # l debug
157
+ # print('clean', self.successful)
158
158
159
159
def success (self ):
160
160
self .next_step = 'hatchField'
0 commit comments