1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| "ui"; ui.layout( <vertical> <text textSize="16sp" textColor="black" text="token"/> <input id="n" text="" /> <text textSize="16sp" textColor="black" text="间隔"/> <input id="time_min" text="1" /> <input id="time_max" text="4" /> <button id="start" text="启动"/> <button id="stop" text="停止"/> <list id="list"> <horizontal gravity="center"> <text textSize="16sp" textColor="black" text="{{msg}}"/> </horizontal> </list> </vertical> );
var rizhi = []; ui.list.setDataSource(rizhi) var storage = storages.create('作业帮token'); var token = storage.get('token'); if(token!=null){ ui.n.setText(storage.get('token')); }
ui.start.click(function(){ threads.start(function(){ toast("已开始") kaishi(); }); });
ui.stop.click(function(){ threads.shutDownAll(); toast("已停止") });
function randomString(e) { e = e || 32; var t = "ABCDEFGHJKMNPQRSTWXYZ123456780", a = t.length, n = ""; for (i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a)); return n }
function randomNum(minNum,maxNum){ switch(arguments.length){ case 1: return parseInt(Math.random()*minNum+1,10); break; case 2: return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10); break; default: return 0; break; } }
function dateFtt(fmt,date) { var o = { "M+" : date.getMonth()+1, "d+" : date.getDate(), "h+" : date.getHours(), "m+" : date.getMinutes(), "s+" : date.getSeconds(), "q+" : Math.floor((date.getMonth()+3)/3), "S" : date.getMilliseconds() }; if(/(y+)/.test(fmt)) fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); for(var k in o) if(new RegExp("("+ k +")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); return fmt; }
function kaishi() { var meiti = true; var token = ui.n.text(); var time_min = parseInt(ui.time_min.text()) ; var time_max = parseInt(ui.time_max.text()) ; if(token.length == 0){ rizhi.unshift({ msg:dateFtt("[hh:mm:ss] ",new Date()) + 'token不能为空' }) return }else{ storage.put('token',token) } rizhi.unshift({ msg:dateFtt("[hh:mm:ss] ",new Date()) + 'token: ' + token }) var url1 = 'https://wenda.zuoyebang.com/rui/ask/taskpool?taskFrom=&token=' + token var url2 = 'https://wenda.zuoyebang.com/rui/ask/tasklist?taskType=1&token=' + token headers1={ 'Host': 'wenda.zuoyebang.com', 'Content-Type': 'application/x-www-form-urlencoded', 'Origin': 'https://wenda.zuoyebang.com', 'User-Agent': 'Mozilla/5.0 (Linux; Android 9; DUK-AL20 Build/HUAWEIDUK-AL20; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.62 XWEB/2767 MMWEBSDK/20210302 Mobile Safari/537.36 MMWEBID/9953 MicroMessenger/8.0.2.1860(0x28000237) Process/appbrand2 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram' } while(meiti){ var r = http.postJson(url1,{headers:headers1}).body.json() rizhi.unshift({ msg:dateFtt("[hh:mm:ss] ",new Date()) + '数量: ' + r.data.total.toString() }) if(r.data.total == 0){ http.postJson(url2,{headers:headers1}); }else{ http.postJson(url2,{headers:headers1}); r = http.postJson("https://wenda.zuoyebang.com/commitui/firstcheck/getchecklist?businessId="+randomString() +"&ts="+parseInt(Date.now() / 1e3).toString() +"&sign=d422dbb7f0143cafb9877456b3d48617&ticket=&randStr=&taskFrom=&token=" + token, {headers:headers1} ).body.json() rizhi.unshift({ msg:dateFtt("[hh:mm:ss] ",new Date()) + r.errStr }) if(r.errStr == "一审领取失败"){ meiti = true }else{ meiti = false; rizhi.unshift({ msg:dateFtt("[hh:mm:ss] ",new Date()) + '已停止' }) return } } sleep(randomNum(time_min*1000,time_max*1000)); } }
|