2121 "x-rpc-device_model" : "iPhone11,8" ,
2222 "x-rpc-device_name" : "" .join (random .sample ('abcdefghijklmnopqrstuvwxyz0123456789' , random .randrange (5 ))).upper (),
2323 "x-rpc-sys_version" : "14.0.1" ,}
24+ result_status = None
2425
2526## 日志
2627def get_file_path (file_name = "" ):
@@ -71,18 +72,22 @@ def miyoushe_signin(module_id):
7172
7273 header ["DS" ] = get_DS ()
7374
74- ## 1: 崩坏3, 2: 原神, 3: 崩坏学园2, 4: 未定事件簿
75+ ## 1: 崩坏3, 2: 原神, 3: 崩坏学园2, 4: 未定事件簿, 5: 崩坏:星穹铁道
7576 sign_data = {'gids' : module_id }
7677 url_signin = 'https://api-takumi.mihoyo.com/apihub/sapi/signIn'
7778 try :
7879 res_signin = s .post (url_signin , json = sign_data , headers = header , timeout = net_timeout )
7980 except :
80- print (to_log ("WARN " , "服务器连接失败。" ))
81+ print (to_log ("ERROR " , "服务器连接失败。" ))
8182 result_status = "error"
8283 return "error"
8384 result = json .loads (res_signin .text )
84- if result ["message" ] == "签到成功" :
85- print (to_log ("INFO" , "签到成功。" ))
85+ if result ["message" ] == "OK" :
86+ if "data" in result :
87+ if "points" in result ["data" ]:
88+ print (to_log ("INFO" , "签到成功,获得 " + str (result ["data" ]["points" ]) + " 米游币。" ))
89+ else :
90+ print (to_log ("INFO" , "签到成功。" ))
8691 elif result ["message" ] == "签到失败或重复签到" :
8792 print (to_log ("WARN" , "签到失败或重复签到。" ))
8893 else :
@@ -102,7 +107,7 @@ def miyoushe_forumPost(fid):
102107 try :
103108 res = s .get (URL , headers = header , timeout = net_timeout )
104109 except :
105- print (to_log ("WARN " , "服务器连接失败。" ))
110+ print (to_log ("ERROR " , "服务器连接失败。" ))
106111 result_status = "error"
107112 return "error"
108113 res_text = json .loads (res .text )
@@ -124,7 +129,7 @@ def miyoushe_forumPost(fid):
124129 try :
125130 res_read = s .get (URL_read_id ,headers = header , timeout = net_timeout )
126131 except :
127- print (to_log ("WARN " , "服务器连接失败。" ))
132+ print (to_log ("ERROR " , "服务器连接失败。" ))
128133 result_status = "error"
129134 return "error"
130135
@@ -148,15 +153,15 @@ def miyoushe_forumPost(fid):
148153 try :
149154 like_status = next (it )
150155 if like_status ['self_operation' ]['attitude' ] != 0 :
151- print (to_log ("INFO" ,"ID : " + like_status ['post' ]['post_id' ] + " —— 帖子已经点赞过了 。" ))
156+ print (to_log ("INFO" ,"帖子ID : " + like_status ['post' ]['post_id' ] + " —— 已经点赞过了 。" ))
152157 else :
153158 break
154159 except StopIteration :
155160 print (to_log ("INFO" ,"帖子列表中所有帖子都已经点赞,正在获取新的列表。" ))
156161 try :
157162 res = s .get (URL , headers = header , timeout = net_timeout )
158163 except :
159- print (to_log ("WARN " , "服务器连接失败。" ))
164+ print (to_log ("ERROR " , "服务器连接失败。" ))
160165 result_status = "error"
161166 return "error"
162167 it = iter (res_text ['data' ]['list' ])
@@ -168,7 +173,7 @@ def miyoushe_forumPost(fid):
168173 try :
169174 res_vote = s .post (URL_upvote , json = upvote_data , headers = header , timeout = net_timeout )
170175 except :
171- print (to_log ("WARN " , "服务器连接失败。" ))
176+ print (to_log ("ERROR " , "服务器连接失败。" ))
172177 result_status = "error"
173178 return "error"
174179
@@ -200,7 +205,7 @@ def sharePost(post_id):
200205 try :
201206 res_share = s .get (URL_post_share , headers = header , timeout = net_timeout )
202207 except :
203- print (to_log ("WARN " , "服务器连接失败。" ))
208+ print (to_log ("ERROR " , "服务器连接失败。" ))
204209 result_status = "error"
205210 return "error"
206211 result = json .loads (res_share .text )
@@ -218,9 +223,13 @@ def start(userdata, setting):
218223 global timesleep_1
219224 global timesleep_2
220225 global net_timeout
226+ global result_status
227+
228+ result_status = None
221229
222230 stuid = userdata ["uid" ]
223231 stoken = userdata ["stoken" ]
232+ id = userdata ["id" ]
224233 if stuid == '' or None :
225234 print (to_log ("ERROR" , "请设置用户Cookies数据!" ))
226235 return "error"
@@ -233,7 +242,7 @@ def start(userdata, setting):
233242 print (to_log ("ERROR" , "请设置游戏板块module_id的值!" ))
234243 return "error"
235244
236- print (to_log ("INFO" , "用户 {0}:开始任务 。" .format (stuid )))
245+ print (to_log ("INFO" , "用户 uid_ {0} - {1}:任务开始 。" .format (id , stuid )))
237246
238247 fid_list = {
239248 '1' : '1' ,
@@ -252,15 +261,15 @@ def start(userdata, setting):
252261 if timesleep_2 == '' or None :
253262 timesleep_2 = 4
254263
255- timesleep_1 = int (timesleep_1 )
256- timesleep_2 = int (timesleep_2 )
264+ timesleep_1 = float (timesleep_1 )
265+ timesleep_2 = float (timesleep_2 )
257266
258267 net_timeout = setting ["timeout" ]
259268
260269 if net_timeout == '' or None :
261270 net_timeout = 10
262271
263- net_timeout = int (net_timeout )
272+ net_timeout = float (net_timeout )
264273
265274 header ["Cookie" ] = 'stuid={0};stoken={1};' .format (stuid , stoken )
266275
@@ -272,7 +281,7 @@ def start(userdata, setting):
272281 fid = int (fid_list [str (module_id )])
273282 miyoushe_forumPost (fid )
274283
275- print (to_log ("INFO" , "用户 {0}:任务结束。" .format (stuid )))
284+ print (to_log ("INFO" , "用户 uid_ {0} - {1} :任务结束。" .format (id , stuid )))
276285 if result_status == "error" :
277286 return "error"
278287 else :
0 commit comments