Skip to content

Commit 4c660a7

Browse files
author
ziye12
authored
1 parent 323e26e commit 4c660a7

File tree

1 file changed

+315
-0
lines changed

1 file changed

+315
-0
lines changed

xiaoleziye.js

Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
2+
/*ziye
3+
4+
5+
微信扫码 https://raw.githubusercontent.com/ziye12/JavaScript/master/xiaoleziye.png 获取授权
6+
7+
8+
9+
hostname=minapp.xqrobot.net,
10+
11+
#小乐
12+
############## 圈x
13+
14+
https:\/\/minapp\.xqrobot\.net\/* url script-request-header xiaoleziye.js
15+
16+
#小乐
17+
############## loon
18+
19+
//
20+
http-request https:\/\/minapp\.xqrobot\.net\/* script-path=xiaoleziye.js, requires-body=true
21+
22+
23+
#小乐
24+
############## surge
25+
26+
微打卡 坚持打卡 微早起打卡 = type=http-request,pattern=https:\/\/minapp\.xqrobot\.net\/*,script-path=xiaoleziye.js, requires-body=true
27+
28+
29+
30+
31+
*/
32+
33+
34+
35+
36+
37+
const sy = init()
38+
39+
const jsname='小乐签到'
40+
41+
const logs = 0; //0为关闭日志,1为开启
42+
const notifyInterval=1//0为关闭通知,1为开启
43+
const jbid=1;
44+
45+
46+
const xiaoleurlKey = 'xiaoleurl'+jbid
47+
48+
const xiaoleheaderKey = 'xiaolehd'+jbid
49+
50+
const xiaolebodyKey = 'xiaolebd'+jbid
51+
52+
const xiaoleurlVal = sy.getdata(xiaoleurlKey)
53+
54+
const xiaoleheaderVal = sy.getdata(xiaoleheaderKey)
55+
56+
const xiaolebodyVal = sy.getdata(xiaolebodyKey)
57+
58+
59+
const xiaoleuserKey = 'xiaoleuser'+jbid
60+
const xiaoleuserVal = sy.getdata(xiaoleuserKey)
61+
62+
63+
64+
65+
66+
67+
var tz=''
68+
69+
70+
let isGetCookie = typeof $request !== 'undefined'
71+
if (isGetCookie) {
72+
GetCookie()
73+
} else {
74+
all()
75+
}
76+
77+
78+
79+
80+
81+
function GetCookie() {
82+
83+
if ($request.headers){
84+
85+
if($request &&$request.url.indexOf("/user.php?mod=sign&")>=0) {
86+
87+
const xiaoleurlVal = $request.url
88+
if (xiaoleurlVal) sy.setdata(xiaoleurlVal,xiaoleurlKey)
89+
sy.log(`[${jsname}] 获取url请求: 成功,xiaoleurlVal: ${xiaoleurlVal}`)
90+
sy.msg(xiaoleurlKey, `获取url请求: 成功🎉`, ``)
91+
92+
93+
const xiaoleheaderVal = JSON.stringify($request.headers)
94+
if (xiaoleheaderVal) sy.setdata(xiaoleheaderVal,xiaoleheaderKey)
95+
sy.log(`[${jsname}] 获取Cookie: 成功,xiaoleheaderVal: ${xiaoleheaderVal}`)
96+
sy.msg(xiaoleheaderKey, `获取Cookie: 成功🎉`, ``)
97+
98+
const xiaolebodyVal = $request.body
99+
if (xiaolebodyVal) sy.setdata(xiaolebodyVal,xiaolebodyKey)
100+
sy.log(`[${jsname}] 获取阅读: 成功,xiaolebodyVal: ${xiaolebodyVal}`)
101+
sy.msg(xiaolebodyKey, `获取阅读请求: 成功🎉`, ``)
102+
103+
104+
105+
}
106+
107+
108+
109+
if($request &&$request.url.indexOf("/user.php?mod=index&")>=0) {
110+
const xiaoleuserVal = $request.url
111+
if (xiaoleuserVal) sy.setdata(xiaoleuserVal,xiaoleuserKey)
112+
sy.log(`[${xiaoleuserKey}] 获取user请求: 成功,xiaoleurlVal: ${xiaoleuserVal}`)
113+
sy.msg(xiaoleuserKey, `获取user请求: 成功🎉`, ``)
114+
115+
116+
117+
118+
119+
}
120+
121+
122+
123+
124+
}
125+
126+
127+
128+
129+
130+
131+
132+
133+
}
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
144+
145+
146+
function all()
147+
148+
{
149+
150+
for(var i=0;i<3;i++)
151+
{ (function(i) {
152+
setTimeout(function() {
153+
154+
if(i==0) xiaoletask(i);
155+
156+
else if(i==1) xiaoleuser(i);
157+
158+
else if(i==2) showmsg(i);
159+
}, (i + 1) *1000);
160+
})(i)
161+
162+
163+
}}
164+
165+
166+
167+
//签到
168+
function xiaoletask() {
169+
return new Promise((resolve, reject) => {
170+
171+
const toxiaoleurl = {
172+
173+
url: xiaoleurlVal,
174+
175+
headers: JSON.parse(xiaoleheaderVal),
176+
body: xiaolebodyVal
177+
};
178+
sy.post(toxiaoleurl,(error, response, data) =>{
179+
if(logs) sy.log(`${jsname}, 签到信息: ${data}`)
180+
signinfo =JSON.parse(data)
181+
if (signinfo.result==true)
182+
{
183+
tz+='【签到成功】🎉:'+signinfo.show+'\n'
184+
}
185+
186+
else if (signinfo.result==false)
187+
{
188+
tz+='【重复签到】✖️:'+signinfo.show+'\n'
189+
}
190+
191+
192+
193+
resolve()
194+
})
195+
})
196+
}
197+
198+
199+
200+
201+
function xiaoleuser() {
202+
return new Promise((resolve, reject) => {
203+
204+
const toxiaoleuserurl = {
205+
url: xiaoleuserVal,
206+
headers: JSON.parse(xiaoleheaderVal),
207+
208+
};
209+
sy.post(toxiaoleuserurl,(error, response, data) =>{
210+
if(logs) sy.log(`${jsname}, 用户信息: ${data}`)
211+
userinfo =JSON.parse(data)
212+
if (userinfo.result==true)
213+
{
214+
tz+='【'+userinfo.info.userlevel_name+'】👤:'+userinfo.info.user_name+'\n'+
215+
'【现金余额】🧧:'+userinfo.info.user_money+'元'+'\n'+
216+
'【今日收益】🧧:'+userinfo.info.jiang_day1+'元'+'\n'+
217+
'【本月收益】🧧:'+userinfo.info.jiang_month1+'元'+'\n'+
218+
'【签到任务】⏰:'+userinfo.info.task_list[0].name+'\n'+
219+
'【签到收益】⏰:'+userinfo.info.task_list[0].money+'\n'+
220+
'【签到信息】⏰:'+userinfo.info.task_list[0].desc+'\n'+
221+
222+
223+
224+
'【邀请任务】👥:'+userinfo.info.task_list[1].name+'\n'+
225+
'【邀请收益】👥:'+userinfo.info.task_list[1].money+'\n'+
226+
'【邀请信息】👥:'+userinfo.info.task_list[1].desc+'\n'
227+
228+
229+
}
230+
231+
232+
else if (userinfo.result==false)
233+
{
234+
tz+=userinfo.show
235+
}
236+
237+
238+
239+
resolve()
240+
})
241+
})
242+
}
243+
244+
245+
246+
247+
248+
249+
250+
251+
252+
function showmsg() {
253+
254+
console.log(tz)
255+
256+
if (notifyInterval==1)
257+
sy.msg(jsname,'',tz)
258+
}
259+
260+
261+
function init() {
262+
isSurge = () => {
263+
return undefined !== this.$httpClient
264+
}
265+
isQuanX = () => {
266+
return undefined !== this.$task
267+
}
268+
getdata = (key) => {
269+
if (isSurge()) return $persistentStore.read(key)
270+
if (isQuanX()) return $prefs.valueForKey(key)
271+
}
272+
setdata = (key, val) => {
273+
if (isSurge()) return $persistentStore.write(key, val)
274+
if (isQuanX()) return $prefs.setValueForKey(key, val)
275+
}
276+
msg = (title, subtitle = '', body = '') => {
277+
if (isSurge()) $notification.post(title, subtitle, body)
278+
if (isQuanX()) $notify(title, subtitle, body)
279+
}
280+
log = (msg) => {
281+
console.log(`${msg}\n`)
282+
}
283+
get = (options, callback) => {
284+
if (isQuanX()) {
285+
if (typeof options == 'string') options = { url: options }
286+
options['method'] = 'GET'
287+
return $task.fetch(options).then(
288+
(response) => {
289+
response['status'] = response.statusCode
290+
callback(null, response, response.body)
291+
},
292+
(reason) => callback(reason.error, null, null)
293+
)
294+
}
295+
if (isSurge()) return $httpClient.get(options, callback)
296+
}
297+
post = (options, callback) => {
298+
if (isQuanX()) {
299+
if (typeof options == 'string') options = { url: options }
300+
options['method'] = 'POST'
301+
$task.fetch(options).then(
302+
(response) => {
303+
response['status'] = response.statusCode
304+
callback(null, response, response.body)
305+
},
306+
(reason) => callback(reason.error, null, null)
307+
)
308+
}
309+
if (isSurge()) $httpClient.post(options, callback)
310+
}
311+
done = (value = {}) => {
312+
$done(value)
313+
}
314+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
315+
}

0 commit comments

Comments
 (0)