How to use doTask method in storybook-root

Best JavaScript code snippet using storybook-root

jd_xyc.js

Source:jd_xyc.js Github

copy

Full Screen

1/*20 8,12 * * * jd_xyc.js3入口:京东 -> 京东众筹频道4*/5const $ = new Env('柠檬众筹许愿池');6const notify = $.isNode() ? require("./sendNotify") : "";7const jdCookieNode = $.isNode() ? require("./jdCookie.js") : "";8let timestamp = Date.now();9let cookiesArr = [], cookie = "", message;10a = ''11let allMessage = '';12if ($.isNode()) {13 Object.keys(jdCookieNode).forEach((item) => {14 cookiesArr.push(jdCookieNode[item])15 })16 if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };17} else {18 cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);19}20!(async () => {21 if (!cookiesArr[0]) {22 $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });23 return;24 }25 for (let i = 0; i < cookiesArr.length; i++) {26 if (cookiesArr[i]) {27 cookie = cookiesArr[i];28 ck2 = cookiesArr[Math.round(Math.random() * cookiesArr.length)];29 $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);30 $.index = i + 1;31 message = "";32 console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`);33 await task()34 }35 }36 // if ($.isNode() && allMessage) {37 // await notify.sendNotify(`${$.name}`, `${allMessage}`)38 // }39})()40 .catch((e) => {41 $.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, "");42 })43 .finally(() => {44 $.done();45 });46function task() {47 return new Promise(async (resolve) => {48 let options = {49 url: `https://api.m.jd.com/client.action`,50 body: `functionId=healthyDay_getHomeData&body={"appId":"1E1NXxq0","taskToken":"","channelId":1}&client=wh5&clientVersion=1.0.0`,51 headers: {52 "Origin": "https://h5.jd.com",53 "Host": "api.m.jd.com",54 "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",55 "Cookie": cookie,56 }57 }58 $.post(options, async (err, resp, data) => {59 try {60 data = JSON.parse(data);61 if (data.data.bizMsg == "success") {62 $.log(`===============存货金币===============`)63 $.log(`${data.data.result.userInfo.userScore}币`)64 userScore = data.data.result.userInfo.userScore65 $.log(`===============抽奖需要===============`)66 $.log(`${data.data.result.userInfo.scorePerLottery}币`)67 scorePerLottery = data.data.result.userInfo.scorePerLottery68 tasklist = data.data.result.taskVos69 $.log(`===============去做任务===============`)70 $.log(`===============浏览并关注众筹频道===============`)71 tk = tasklist[0].shoppingActivityVos[0].taskToken72 taskId = tasklist[0].taskId73 await dotask(tk, taskId, 0)74 await dotask(tk, taskId, 1)75 await dotask(tk, taskId, 0)76 $.log(`===============浏览众筹频道===============`)77 tk = tasklist[1].shoppingActivityVos[0].taskToken78 taskId = tasklist[1].taskId79 await dotask(tk, taskId, 0)80 await dotask(tk, taskId, 1)81 await $.wait(15000)82 await dotask(tk, taskId, 0)83 $.log(`===============每浏览商品10s可获得200金币===============`)84 tk = tasklist[2].productInfoVos[0].taskToken85 taskId = tasklist[2].taskId86 item = tasklist[2].productInfoVos[0].itemId87 await dotask(tk, taskId, 0, item)88 await dotask(tk, taskId, 1, item)89 await $.wait(11000)90 await dotask(tk, taskId, 0, item)91 tk = tasklist[2].productInfoVos[1].taskToken92 taskId = tasklist[2].taskId93 item = tasklist[2].productInfoVos[1].itemId94 await dotask(tk, taskId, 0, item)95 await dotask(tk, taskId, 1, item)96 await $.wait(11000)97 await dotask(tk, taskId, 0, item)98 tk = tasklist[2].productInfoVos[2].taskToken99 taskId = tasklist[2].taskId100 item = tasklist[2].productInfoVos[2].itemId101 await dotask(tk, taskId, 0, item)102 await dotask(tk, taskId, 1, item)103 await $.wait(11000)104 await dotask(tk, taskId, 0, item)105 tk = tasklist[2].productInfoVos[3].taskToken106 item = tasklist[2].productInfoVos[3].itemId107 taskId = tasklist[2].taskId108 await dotask(tk, taskId, 0, item)109 await dotask(tk, taskId, 1, item)110 await $.wait(11000)111 await dotask(tk, taskId, 0, item)112 tk = tasklist[2].productInfoVos[4].taskToken113 item = tasklist[2].productInfoVos[4].itemId114 taskId = tasklist[2].taskId115 await dotask(tk, taskId, 0, item)116 await dotask(tk, taskId, 1, item)117 await $.wait(11000)118 await dotask(tk, taskId, 0, item)119 $.log(`===============邀请一个好友助力可获得300金币===============`)120 tk = tasklist[3].assistTaskDetailVo.taskToken121 taskId = tasklist[3].taskId122 yqm = tasklist[3].assistTaskDetailVo.itemId123 $.log(`邀请码${yqm}\n正在取随机CK互相助力3次`)124 for (let i = 0; i < 5; i++) {125 ck2 = cookiesArr[Math.round(Math.random() * cookiesArr.length)];126 await help(tk, taskId, 0, yqm)127 await help(tk, taskId, 1, yqm)128 await help(tk, taskId, 0, yqm)129 }130 $.log(`===============关注店铺可获得200金币===============`)131 tk = tasklist[4].followShopVo[0].taskToken132 item = tasklist[4].followShopVo[0].itemId133 taskId = tasklist[4].taskId134 await dotask(tk, taskId, 0, item)135 await dotask(tk, taskId, 1, item)136 await dotask(tk, taskId, 0, item)137 tk = tasklist[4].followShopVo[1].taskToken138 item = tasklist[4].followShopVo[1].itemId139 taskId = tasklist[4].taskId140 await dotask(tk, taskId, 0, item)141 await dotask(tk, taskId, 1, item)142 await dotask(tk, taskId, 0, item)143 tk = tasklist[4].followShopVo[2].taskToken144 item = tasklist[4].followShopVo[2].itemId145 taskId = tasklist[4].taskId146 await dotask(tk, taskId, 0, item)147 await dotask(tk, taskId, 1, item)148 await dotask(tk, taskId, 0, item)149 $.log(`===============连续签到===============`)150 tk = tasklist[5].simpleRecordInfoVo.taskToken151 item = tasklist[5].simpleRecordInfoVo.itemId152 taskId = tasklist[5].taskId153 await dotask(tk, taskId, 0, item)154 await dotask(tk, taskId, 1, item)155 await dotask(tk, taskId, 0, item)156 await getLottery()157 cj = $.userScore / 500158 cj = parseInt(cj)159 if (cj > 0) {160 for (let i = 0; i < cj; i++) {161 await getLottery()162 }163 }164 } else if (data.data.bizMsg !== "success") {165 console.log(data.msg)166 }167 } catch (e) {168 $.logErr(e, resp);169 } finally {170 resolve();171 }172 });173 });174}175function help(taskToken, taskId, actionType, itemId) {176 return new Promise(async (resolve) => {177 let options = {178 url: `https://api.m.jd.com/client.action`,179 body: `functionId=harmony_collectScore&body={"appId":"1E1NXxq0","taskToken":"${taskToken}","taskId":${taskId},"itemId":"${itemId}","actionType":${actionType}}&client=wh5&clientVersion=1.0.0`,180 headers: {181 "Origin": "https://h5.jd.com",182 "Host": "api.m.jd.com",183 "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",184 "Cookie": ck2,185 }186 }187 $.post(options, async (err, resp, data) => {188 try {189 data = JSON.parse(data);190 if (data.data.bizMsg == "success") {191 $.log(`===============任务完成===============`)192 console.log(data.data.bizMsg)193 $.log(`获得${data.data.result.userScore}`)194 } else if (data.data.bizMsg !== "success") {195 console.log(data.data.bizMsg)196 }197 } catch (e) {198 $.logErr(e, resp);199 } finally {200 resolve();201 }202 });203 });204}205function dotask(taskToken, taskId, actionType, itemId) {206 return new Promise(async (resolve) => {207 let options = {208 url: `https://api.m.jd.com/client.action`,209 body: `functionId=harmony_collectScore&body={"appId":"1E1NXxq0","taskToken":"${taskToken}","taskId":${taskId},"itemId":"${itemId}","actionType":${actionType}}&client=wh5&clientVersion=1.0.0`,210 headers: {211 "Origin": "https://h5.jd.com",212 "Host": "api.m.jd.com",213 "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",214 "Cookie": cookie,215 }216 }217 $.post(options, async (err, resp, data) => {218 try {219 data = JSON.parse(data);220 if (data.data.bizMsg == "success") {221 $.log(`===============任务完成===============`)222 console.log(data.data.bizMsg)223 $.log(`获得${data.data.result.userScore}`)224 } else if (data.data.bizMsg !== "success") {225 console.log(data.data.bizMsg)226 }227 } catch (e) {228 $.logErr(e, resp);229 } finally {230 resolve();231 }232 });233 });234}235function getLottery() {236 return new Promise(async (resolve) => {237 let options = {238 url: `https://api.m.jd.com/client.action`,239 body: `functionId=interact_template_getLotteryResult&body={"appId":"1E1NXxq0"}&client=wh5&clientVersion=1.0.0`,240 headers: {241 "Origin": "https://h5.jd.com",242 "Host": "api.m.jd.com",243 "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.12150.8 Safari/537.36",244 "Cookie": cookie,245 }246 }247 $.post(options, async (err, resp, data) => {248 try {249 data = JSON.parse(data);250 if (data.data.bizMsg == "success") {251 $.userScore = data.data.result.userScore252 $.bizMsg = data.data.bizMsg253 $.log(`===============开始抽奖===============`)254 if (data.data.result.userAwardsCacheDto.jBeanAwardVo) {255 $.log(data.data.result.userAwardsCacheDto.jBeanAwardVo.prizeName)256 allMessage += `京东账号${$.index}-${$.nickName || $.UserName}\n抽奖京豆: ${data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity}${$.index !== cookiesArr.length ? '\n\n' : '\n\n'}`;257 } else258 $.log(`啥都没抽到`)259 } else if (data.data.bizMsg !== "success") {260 console.log(data.data.bizMsg)261 }262 } catch (e) {263 $.logErr(e, resp);264 } finally {265 resolve();266 }267 });268 });269}270function jsonParse(str) {271 if (typeof str == "string") {272 try {273 return JSON.parse(str);274 } catch (e) {275 console.log(e);276 $.msg($.name, "", "不要在BoxJS手动复制粘贴修改cookie");277 return [];278 }279 }280}281function Env(t, e) {282 class s {283 constructor(t) {284 this.env = t285 }286 send(t, e = "GET") {287 t = "string" == typeof t ? {288 url: t289 } : t;290 let s = this.get;291 return "POST" === e && (s = this.post), new Promise((e, i) => {292 s.call(this, t, (t, s, r) => {293 t ? i(t) : e(s)294 })295 })296 }297 get(t) {298 return this.send.call(this.env, t)299 }300 post(t) {301 return this.send.call(this.env, t, "POST")302 }303 }304 return new class {305 constructor(t, e) {306 this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)307 }308 isNode() {309 return "undefined" != typeof module && !!module.exports310 }311 isQuanX() {312 return "undefined" != typeof $task313 }314 isSurge() {315 return "undefined" != typeof $httpClient && "undefined" == typeof $loon316 }317 isLoon() {318 return "undefined" != typeof $loon319 }320 toObj(t, e = null) {321 try {322 return JSON.parse(t)323 } catch {324 return e325 }326 }327 toStr(t, e = null) {328 try {329 return JSON.stringify(t)330 } catch {331 return e332 }333 }334 getjson(t, e) {335 let s = e;336 const i = this.getdata(t);337 if (i) try {338 s = JSON.parse(this.getdata(t))339 } catch {340 }341 return s342 }343 setjson(t, e) {344 try {345 return this.setdata(JSON.stringify(t), e)346 } catch {347 return !1348 }349 }350 getScript(t) {351 return new Promise(e => {352 this.get({353 url: t354 }, (t, s, i) => e(i))355 })356 }357 runScript(t, e) {358 return new Promise(s => {359 let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");360 i = i ? i.replace(/\n/g, "").trim() : i;361 let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");362 r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r;363 const [o, h] = i.split("@"), a = {364 url: `http://${h}/v1/scripting/evaluate`,365 body: {366 script_text: t,367 mock_type: "cron",368 timeout: r369 },370 headers: {371 "X-Key": o,372 Accept: "*/*"373 }374 };375 this.post(a, (t, e, i) => s(i))376 }).catch(t => this.logErr(t))377 }378 loaddata() {379 if (!this.isNode()) return {};380 {381 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");382 const t = this.path.resolve(this.dataFile),383 e = this.path.resolve(process.cwd(), this.dataFile),384 s = this.fs.existsSync(t),385 i = !s && this.fs.existsSync(e);386 if (!s && !i) return {};387 {388 const i = s ? t : e;389 try {390 return JSON.parse(this.fs.readFileSync(i))391 } catch (t) {392 return {}393 }394 }395 }396 }397 writedata() {398 if (this.isNode()) {399 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");400 const t = this.path.resolve(this.dataFile),401 e = this.path.resolve(process.cwd(), this.dataFile),402 s = this.fs.existsSync(t),403 i = !s && this.fs.existsSync(e),404 r = JSON.stringify(this.data);405 s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)406 }407 }408 lodash_get(t, e, s) {409 const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");410 let r = t;411 for (const t of i)412 if (r = Object(r)[t], void 0 === r) return s;413 return r414 }415 lodash_set(t, e, s) {416 return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)417 }418 getdata(t) {419 let e = this.getval(t);420 if (/^@/.test(t)) {421 const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : "";422 if (r) try {423 const t = JSON.parse(r);424 e = t ? this.lodash_get(t, i, "") : e425 } catch (t) {426 e = ""427 }428 }429 return e430 }431 setdata(t, e) {432 let s = !1;433 if (/^@/.test(e)) {434 const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i),435 h = i ? "null" === o ? null : o || "{}" : "{}";436 try {437 const e = JSON.parse(h);438 this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i)439 } catch (e) {440 const o = {};441 this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i)442 }443 } else s = this.setval(t, e);444 return s445 }446 getval(t) {447 return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null448 }449 setval(t, e) {450 return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null451 }452 initGotEnv(t) {453 this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))454 }455 get(t, e = (() => {456 })) {457 t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {458 "X-Surge-Skip-Scripting": !1459 })), $httpClient.get(t, (t, s, i) => {460 !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)461 })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {462 hints: !1463 })), $task.fetch(t).then(t => {464 const {465 statusCode: s,466 statusCode: i,467 headers: r,468 body: o469 } = t;470 e(null, {471 status: s,472 statusCode: i,473 headers: r,474 body: o475 }, o)476 }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {477 try {478 if (t.headers["set-cookie"]) {479 const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();480 this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar481 }482 } catch (t) {483 this.logErr(t)484 }485 }).then(t => {486 const {487 statusCode: s,488 statusCode: i,489 headers: r,490 body: o491 } = t;492 e(null, {493 status: s,494 statusCode: i,495 headers: r,496 body: o497 }, o)498 }, t => {499 const {500 message: s,501 response: i502 } = t;503 e(s, i, i && i.body)504 }))505 }506 post(t, e = (() => {507 })) {508 if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {509 "X-Surge-Skip-Scripting": !1510 })), $httpClient.post(t, (t, s, i) => {511 !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)512 });513 else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {514 hints: !1515 })), $task.fetch(t).then(t => {516 const {517 statusCode: s,518 statusCode: i,519 headers: r,520 body: o521 } = t;522 e(null, {523 status: s,524 statusCode: i,525 headers: r,526 body: o527 }, o)528 }, t => e(t));529 else if (this.isNode()) {530 this.initGotEnv(t);531 const {532 url: s,533 ...i534 } = t;535 this.got.post(s, i).then(t => {536 const {537 statusCode: s,538 statusCode: i,539 headers: r,540 body: o541 } = t;542 e(null, {543 status: s,544 statusCode: i,545 headers: r,546 body: o547 }, o)548 }, t => {549 const {550 message: s,551 response: i552 } = t;553 e(s, i, i && i.body)554 })555 }556 }557 time(t) {558 let e = {559 "M+": (new Date).getMonth() + 1,560 "d+": (new Date).getDate(),561 "H+": (new Date).getHours(),562 "m+": (new Date).getMinutes(),563 "s+": (new Date).getSeconds(),564 "q+": Math.floor(((new Date).getMonth() + 3) / 3),565 S: (new Date).getMilliseconds()566 };567 /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length)));568 for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length)));569 return t570 }571 msg(e = t, s = "", i = "", r) {572 const o = t => {573 if (!t) return t;574 if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {575 "open-url": t576 } : this.isSurge() ? {577 url: t578 } : void 0;579 if ("object" == typeof t) {580 if (this.isLoon()) {581 let e = t.openUrl || t.url || t["open-url"],582 s = t.mediaUrl || t["media-url"];583 return {584 openUrl: e,585 mediaUrl: s586 }587 }588 if (this.isQuanX()) {589 let e = t["open-url"] || t.url || t.openUrl,590 s = t["media-url"] || t.mediaUrl;591 return {592 "open-url": e,593 "media-url": s594 }595 }596 if (this.isSurge()) {597 let e = t.url || t.openUrl || t["open-url"];598 return {599 url: e600 }601 }602 }603 };604 this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r)));605 let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];606 h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h)607 }608 log(...t) {609 t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))610 }611 logErr(t, e) {612 const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();613 s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t)614 }615 wait(t) {616 return new Promise(e => setTimeout(e, t))617 }618 done(t = {}) {619 const e = (new Date).getTime(),620 s = (e - this.startTime) / 1e3;621 this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)622 }623 }(t, e)...

Full Screen

Full Screen

unicom.js

Source:unicom.js Github

copy

Full Screen

...16 init17 }18 // 每日签到积分19 await scheduler.regTask('dailysignin', async (request) => {20 await require('./dailysignin').doTask(request, options)21 await require('./integral').addFlow(request, options)22 }, taskOption)23 // 冬奥积分活动 2020123124 await scheduler.regTask('winterTwo', async (request) => {25 await require('./integral').winterTwoGetIntegral(request, options)26 await require('./integral').winterTwoStatus(request, options)27 }, taskOption)28 // 每日定向积分 2020123129 await scheduler.regTask('dxIntegralEveryDay', async (request) => {30 await require('./integral').dxIntegralEveryDay(request, options)31 }, taskOption)32 // 每日游戏楼层宝箱33 await scheduler.regTask('dailygamebox', async (request) => {34 await require('./integral').gamebox(request, options)35 }, taskOption)36 // 首页-积分商城-定向积分专区-每日抽奖(1次免费及5次花费定向积分抽奖)37 await scheduler.regTask('dailylotteryintegral', async (request) => {38 await require('./dailyShop').dailyintegrallottery(request, options)39 }, taskOption)40 // 首页-游戏-娱乐中心-沃之树41 await scheduler.regTask('dailywoTree', async (request) => {42 await require('./woTree').doTask(request, options)43 }, taskOption)44 await scheduler.regTask('dailyBookRead', async (request) => {45 // 首页-小说-阅读越有礼打卡赢话费46 await require('./dailyBookRead').doTask(request, options)47 await require('./dailyVideoBook').doTask(request, options)48 }, taskOption)49 // 首页-小说-会员日活动-签到抽大奖50 await scheduler.regTask('dailyBookMemberDay', async (request) => {51 await require('./dailyBookRead').dovideoIntegralTask(request, options)52 await require('./dailyBookRead').doMemberDaySign(request, options)53 }, taskOption)54 // 首页-小说-阅读现金红包雨-看视频得积分55 await scheduler.regTask('dailyRedbagRainVideoIntegral', async (request) => {56 // 看视频得积分57 await require('./dailyRedbagRain').dovideoIntegralTask(request, options)58 }, taskOption)59 // 首页-小说-阅读现金红包雨60 // 活动已下线61 // await scheduler.regTask('dailyRedbagRain', async (request) => {62 // // 看视频得积分63 // await require('./dailyRedbagRain').getRedBag(request, options)64 // }, {65 // ...taskOption,66 // startTime: 20 * 3600 - 10 * 55,67 // ignoreRelay: true68 // })69 // 首页-小说-读满10章赢好礼70 await scheduler.regTask('dailyBookRead10doDraw', async (request) => {71 // 首页-小说-读满10章赢好礼72 await require('./dailyVideoBook').read10doDraw(request, options)73 // 首页-签到有礼-免流量得福利-3积分天天拿(阅读打卡) 已下线74 // await require('./dailyVideoBook').giftBoints(request, options)75 }, taskOption)76 // 首页-小说-章节详情-看视频领积分77 await scheduler.regTask('dailyBookVideo', async (request) => {78 // 首页-小说-读满10章赢好礼-看视频领2积分79 await require('./dailyVideoBook').dovideoIntegralTask(request, options)80 // 首页-小说-章节详情-看视频领积分81 await require('./dailyBookVideo').doTask(request, options)82 }, taskOption)83 await scheduler.regTask('dailyBookLuckdraw', async (request) => {84 // 首页-小说-阅读福利抽大奖85 await require('./dailyBookLuckdraw').doTask(request, options)86 }, taskOption)87 // 首页-签到有礼-免费领-1G流量日包88 await scheduler.regTask('daily1GFlowTask', async (request) => {89 await require('./daily1GFlowTask').doTask(request, options)90 }, {91 ...taskOption,92 startTime: 20 * 3600,93 ignoreRelay: true94 })95 // 首页-签到有礼-免费领-浏览领积分96 await scheduler.regTask('dailyLiuLan', async (request) => {97 await require('./dailyTTliulan').doTask(request, options)98 }, taskOption)99 // 首页-签到有礼-免费领-领免费霸王餐100 await scheduler.regTask('dailyScratchCard', async (request) => {101 await require('./dailyScratchCard').doTask(request, options)102 }, taskOption)103 // 首页-签到有礼-免费拿-看视频夺宝104 // 易出现本次操作需要进行验证,暂时注释105 // await scheduler.regTask('dailyVideoFreeGoods', async (request) => {106 // await require('./dailyVideoFreeGoods').doTask(request, options)107 // }, {108 // isCircle: true,109 // startTime: 10 * 3600,110 // intervalTime: 4 * 3600111 // })112 // 首页-签到有礼-免费抽-赢vivo x60113 await scheduler.regTask('dailyNcow', async (request) => {114 await require('./dailyNcow').doTask(request, options)115 }, taskOption)116 // 首页-签到有礼-免费抽-拿红米笔记本-接元宝117 await scheduler.regTask('dailyIngots', async (request) => {118 await require('./dailyIngots').doTask(request, options)119 }, taskOption)120 // 首页-签到有礼-免费抽-抓OPPO手机121 await scheduler.regTask('dailyGrabdollPage', async (request) => {122 await require('./dailyGrabdollPage').doTask(request, options)123 }, taskOption)124 // 首页-签到有礼-免费抽-拿666积分-豪礼大派送抽奖125 await scheduler.regTask('jflottery', async (request) => {126 await require('./jflottery').timesDraw(request, options)127 }, taskOption)128 // 首页-签到有礼-免费抽-拿苹果iPad Pro(摇一摇)129 await scheduler.regTask('dailyYYY', async (request) => {130 await require('./dailyYYY').doTask(request, options)131 }, taskOption)132 // 首页-签到有礼-免费抽-华为mate40pro(刮刮乐)133 await scheduler.regTask('dailyVideoScratchcard', async (request) => {134 await require('./dailyVideoScratchcard').doTask(request, options)135 }, taskOption)136 // 首页-签到有礼-免费抽-赢三星Galaxy Z(试试手气)137 // 活动已下线138 // await scheduler.regTask('dailyCheapStorePage', async (request) => {139 // await require('./dailyCheapStorePage').doTask(request, options)140 // }, {141 // isCircle: true,142 // intervalTime: 4 * 3600,143 // ...taskOption144 // })145 // 首页-签到有礼-免费抽-拆华为Pad(去抽奖)146 await scheduler.regTask('dailyLKMH', async (request) => {147 await require('./dailyLKMH').doTask(request, options)148 }, taskOption)149 // 首页-签到有礼-免费抽-拿iPhone12(摇一摇)150 await scheduler.regTask('dailyYYQ', async (request) => {151 await require('./dailyYYQ').doTask(request, options)152 }, taskOption)153 // 首页-签到有礼-免费抽-赢Apple Watch(去抽奖)154 // 游戏已下线155 // await scheduler.regTask('dailyTurntablePage', async (request) => {156 // await require('./dailyTurntablePage').doTask(request, options)157 // }, taskOption)158 // 首页-签到有礼-赚更多福利-看视频奖励5积分159 await scheduler.regTask('dailyVideo', async (request) => {160 await require('./dailyVideo').doTask(request, options)161 }, taskOption)162 // 首页-签到有礼-赚更多福利-天天抽好礼163 await scheduler.regTask('dailylottery', async (request) => {164 await require('./dailylottery').doTask(request, options)165 }, taskOption)166 // 首页-游戏-娱乐中心-每日打卡167 await scheduler.regTask('producGameSignin', async (request) => {168 await require('./producGame').gameBox(request, options)169 await require('./producGame').gameSignin(request, options)170 }, taskOption)171 // 首页-游戏-娱乐中心-天天领取3G流量包172 await scheduler.regTask('dailygameflow', async (request) => {173 await require('./producGame').doGameFlowTask(request, options)174 }, taskOption)175 // 首页-积分查询-游戏任务176 await scheduler.regTask('dailygameIntegral', async (request) => {177 await require('./producGame').doGameIntegralTask(request, options)178 }, taskOption)179 // 首页-知识-限时免费(连续7天阶梯激励)180 await scheduler.regTask('dailyCourse', async (request) => {181 await require('./dailyCourse').doTask(request, options)182 }, {183 ...taskOption,184 startTime: 9 * 3600185 })186 // await require('./integral').getflDetail(request, options)187 // await require('./integral').getTxDetail(request, options)188 // await require('./integral').getDxDetail(request, options)189 // await require('./integral').getCoins(request, options)190 // 每日评论积分191 await scheduler.regTask('dailycomment', async (request) => {192 await require('./commentSystem').commentTask(request, options)193 }, taskOption)194 // 首页-游戏-娱乐中心-每日打卡-完成今日任务(200m)195 await scheduler.regTask('todayDailyTask', async (request) => {196 await require('./producGame').gameBox(request, options)197 await require('./producGame').doTodayDailyTask(request, options)198 }, {199 ...taskOption,200 startTime: 22 * 3600201 })202 // 首页-签到有礼-居家娱乐馆203 // 活动已下线204 // await scheduler.regTask('gameYearBox', async (request) => {205 // await require('./gameYearBox').doTask(request, options)206 // }, {207 // ...taskOption,208 // startTime: 18 * 3600209 // })210 // // 首页-牛气-秒杀抢兑211 // await scheduler.regTask('NiujieSpikePrize', async (request) => {212 // await require('./Niujie').spikePrize(request, options)213 // }, {214 // ...taskOption,215 // startTime: 9.6 * 3600,216 // ignoreRelay: true217 // })218 // 首页-牛气-转盘抽奖219 // await scheduler.regTask('NiujieTask', async (request) => {220 // await require('./Niujie').doTask(request, options)221 // }, taskOption)222 // // 首页-牛气-积分馆-翻签抽奖223 // await scheduler.regTask('newYearLottery', async (request) => {224 // await require('./Niujie').newYearLottery(request, options)225 // }, taskOption)226 // // 首页-牛气-场馆领牛气227 // await scheduler.regTask('NiujieReceiveCalf', async (request) => {228 // await require('./Niujie').receiveCalf(request, options)229 // }, {230 // isCircle: true,231 // intervalTime: 50 * 60,232 // startTime: 0,233 // ...taskOption234 // })235 // // 首页-牛气-兑换奖品236 // await scheduler.regTask('convertPrize', async (request) => {237 // await require('./Niujie').convertPrize(request, options)238 // }, {239 // ...taskOption,240 // startTime: 22 * 3600241 // })242 // 首页-知识-阅读答题赢好礼243 await scheduler.regTask('dailyBookAnswer', async (request) => {244 await require('./dailyBookAnswer').doTask(request, options)245 }, taskOption)246 // 首页-积分乐园-集牛卡247 await scheduler.regTask('newYearUserSign', async (request) => {248 await require('./newYearUserSign').doTask(request, options)249 }, taskOption)250 // 首页-签到有礼-免费拿-猜拳拿奖251 await scheduler.regTask('dailyFingerSign', async (request) => {252 await require('./dailyFingerSign').doTask(request, options)253 }, taskOption)254 // 首页-积分商城-火热抢购-三只松鼠-看视频得积分255 await scheduler.regTask('dailyShopVideoIntegral', async (request) => {256 await require('./dailyShop').dovideoIntegralTask(request, options)257 }, taskOption)258 // 服务-办理-套餐变更-赚积分259 await scheduler.regTask('dailyPackageIntegral', async (request) => {260 await require('./dailyOtherRewardVideo').doPackeageChangeVideoIntegralTask(request, options)261 }, taskOption)262 // 服务-查询-电子发票-赚积分263 await scheduler.regTask('dailyWisdomActivityIntegral', async (request) => {264 await require('./dailyOtherRewardVideo').doWisdomActivityIntegralTask(request, options)265 }, taskOption)266 // 福利社-聚人气-看视频得积分267 // await scheduler.regTask('doWelfareActivityIntegralTask', async (request) => {268 // await require('./dailyOtherRewardVideo').doWelfareActivityIntegralTask(request, options)269 // }, taskOption)270 // 首页-签到有礼-免费领-饿了么红包271 await scheduler.regTask('dailyUnicomTask', async (request) => {272 await require('./dailyUnicomTask').doIntegralAd(request, options)273 await require('./dailyUnicomTask').doTurnCard(request, options)274 }, taskOption)275 // 冬奥专区-赢冬奥纪念品-玩游戏抽奖276 await scheduler.regTask('olympicgame', async (request) => {277 await require('./olympicgame').doTask(request, options)278 }, taskOption)279 // 我的钱包-沃钱包-幸运抽大奖280 await scheduler.regTask('dailystw', async (request) => {281 await require('./dailystw').doTask(request, options)282 }, taskOption)283 // 沃钱包-联通支付日-转盘抽奖284 await scheduler.regTask('PayDayParty', async (request) => {285 await require('./PayDayParty').doTask(request, options)286 }, taskOption)287 // 冬奥-冰雪俱乐部-联通客户日-幸运九宫格288 await scheduler.regTask('dailyClubLottery', async (request) => {289 await require('./dailyClubLottery').doTask(request, options)290 }, taskOption)291 // 积分商城-疯踩小橙(沃耀联通小游戏)292 await scheduler.regTask('woyaoliantong', async (request) => {293 await require('./woyaoliantong').doTask(request, options)294 }, taskOption)295 // 超级星期五-元宵喜乐会296 // 活动下线297 // await scheduler.regTask('lanternFestival', async (request) => {298 // await require('./lanternFestival').doTask(request, options)299 // }, taskOption)300 // 话费购签到301 await scheduler.regTask('hfgo', async (request) => {302 await require('./hfgo').doTask(request, options)303 }, taskOption)304 // 首页-签到-APP下载领积分305 await scheduler.regTask('dailyDownloadApp', async (request) => {306 await require('./dailyDownloadApp').doTask(request, options)307 }, {308 ...taskOption,309 startTime: 13 * 3600,310 })311 // 清理领取某些未知方式的积分312 // 该处理可能会导致某些活动任务机会不足导致错误,所以执行时间要迟313 await scheduler.regTask('dailyOtherRewardVideo', async (request) => {314 await require('./dailyOtherRewardVideo').cleanRewardVideo(request, options)315 }, {316 ...taskOption,317 startTime: 21.5 * 3600,318 ignoreRelay: true319 })320 // 每日0点自动兑换流量321// await scheduler.regTask('exchangeDFlow', async (request) => {322// await require('./exchangeDFlow').doTask(request, options)323// }, {324// ...taskOption,325// startTime: 0,326// startHours: 0,327// ignoreRelay: true328// })329 // 定时检测流量兑换330 // 可使用 --exchangeDFlowCircle-intervalTime 1800 选项指定流量检查间隔时间,单位秒331 // 可使用 --exchangeDFlowCircle-minFlow 200 选项指定流量检查最小值332 // 可使用 --exchangeDFlowCircle-productId 21010621565413402 选项指定兑换流量包ID333// let { 'exchangeDFlowCircle-intervalTime': intervalTime = 1800 } = options334// if (typeof intervalTime !== 'number') {335// intervalTime = 1800336// }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { storiesOf } from '@storybook/react';3import { action } from '@storybook/addon-actions';4import { linkTo } from '@storybook/addon-links';5import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';6import { withNotes } from '@storybook/addon-notes';7import { withInfo } from '@storybook/addon-info';8import { withOptions } from '@storybook/addon-options';9import { withViewport } from '@storybook/addon-viewport';10import { withBackgrounds } from '@storybook/addon-backgrounds';11import { withInline } from '@storybook/addon-inline';12import { withTests } from '@storybook/addon-jest';13import { withA11y } from '@storybook/addon-a11y';14import { withConsole } from '@storybook/addon-console';15import { withCSSResources } from '@storybook/addon-cssresources';16import { Button, Welcome } from '@storybook/react/demo';17import { doTask } from 'storybook-root';18storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);19storiesOf('Button', module)20 .addDecorator(withKnobs)21 .addDecorator(withNotes)22 .addDecorator(withInfo)23 .addDecorator(withOptions)24 .addDecorator(withViewport)25 .addDecorator(withBackgrounds)26 .addDecorator(withInline)27 .addDecorator(withTests)28 .addDecorator(withA11y)29 .addDecorator((storyFn, context) => withConsole()(storyFn)(context))30 .addDecorator(withCSSResources)31 .add('with text', () => <Button onClick={action('clicked')}>{text('Label', 'Hello Button')}</Button>)32 .add('with some emoji', () => (33 <Button onClick={action('clicked')}>34 {boolean('Disabled', false) ? '😀 😎 👍 💯' : '😞 😠 😡 😤'}35 .add('with some number', () => (36 <Button onClick={action('clicked')}>37 {boolean('Disabled', false) ? '😀 😎 👍 💯' : '😞 😠 😡 😤'}38 .add('with some number', () => (39 <Button onClick={action('clicked

Full Screen

Using AI Code Generation

copy

Full Screen

1import { doTask } from 'storybook-root';2import { doTask } from 'storybook-root';3import { doTask } from 'storybook-root';4import { doTask } from 'storybook-root';5import { doTask } from 'storybook-root';6import { doTask } from 'storybook-root';7import { doTask } from 'storybook-root';8import { doTask } from 'storybook-root';9import { doTask } from 'storybook-root';10import { doTask } from 'storybook-root';11import { doTask } from 'storybook-root';12import { doTask } from 'storybook-root';13import { doTask } from 'storybook-root';14import { doTask } from 'storybook-root';15import { doTask } from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { doTask } from 'storybook-root';2doTask();3import { doTask } from './src/task';4export { doTask };5import { doTask } from './task';6export { doTask };7export function doTask() {8 console.log('task done');9}10resolve: {11 alias: {12 'storybook-root': path.resolve(__dirname, '../'),13 },14 },15moduleNameMapper: {16 '^storybook-root(.*)$': '<rootDir>/../$1',17 },18moduleNameMapper: {19 '^storybook-root(.*)$': '<rootDir>/../',20 },21moduleNameMapper: {22 '^storybook-root(.*)$': '<rootDir>/../src',23 },24moduleNameMapper: {25 '^storybook-root(.*)$': '<rootDir>/../src/task',26 },27moduleNameMapper: {28 '^storybook-root(.*)$': '<rootDir>/../src/task.js',29 },30moduleNameMapper: {31 '^storybook-root(.*)$': '<rootDir>/../storybook-root',32 },33moduleNameMapper: {34 '^storybook-root(.*)$': '<rootDir>/../storybook-root/src',35 },36moduleNameMapper: {37 '^storybook-root(.*)$': '<rootDir>/../storybook-root/src

Full Screen

Using AI Code Generation

copy

Full Screen

1import { doTask } from 'storybook-root'2doTask()3export { doTask } from './lib'4export const doTask = () => {5 console.log('doTask')6}

Full Screen

Using AI Code Generation

copy

Full Screen

1import {doTask} from 'storybook-root';2doTask();3import {doTask} from '../test';4export {doTask};5import {doTask} from '../test';6export {doTask};7import {doTask} from '../test';8export {doTask};9I've tried to create a storybook for the Button component that uses the useInput hook. I've tried to import the useInput hook in Button.stories.js using the following:10import { useInput } from '../hooks';11I also tried importing the useInput hook in Button.js using the following:12import { useInput } from '../hooks';13I've also tried importing the useInput hook in index.js using the following:14import { useInput } from '../hooks';15I've tried importing the useInput hook in Button.stories.js using

Full Screen

Using AI Code Generation

copy

Full Screen

1import { doTask } from 'storybook-root';2doTask();3export const doTask = () => {4 console.log('doTask');5};6import { doTask } from 'storybook-root';7doTask();

Full Screen

Using AI Code Generation

copy

Full Screen

1import { doTask } from "storybook-root";2doTask();3import { doTask } from "storybook-root";4doTask();5{6 {7 }8}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful