MCPcopy Create free account
hub / github.com/Semporia/Scripts / rubbishOper

Function rubbishOper

jd_cfd.js:778–817  ·  view source on GitHub ↗
(dwType, body = '')

Source from the content-addressed store, hash-verified

776 })
777}
778function rubbishOper(dwType, body = '') {
779 return new Promise((resolve) => {
780 switch(dwType) {
781 case '1':
782 $.get(taskUrl(`story/RubbishOper`, `dwType=1&dwRewardType=0`), (err, resp, data) => {
783 try {
784 if (err) {
785 console.log(`${JSON.stringify(err)}`)
786 console.log(`${$.name} RubbishOper API请求失败,请检查网路重试`)
787 } else {
788 data = JSON.parse(data.replace(/\n/g, "").match(new RegExp(/jsonpCBK.?\((.*);*\)/))[1]);
789 }
790 } catch (e) {
791 $.logErr(e, resp);
792 } finally {
793 resolve(data);
794 }
795 })
796 break
797 case '2':
798 $.get(taskUrl(`story/RubbishOper`, `dwType=2&dwRewardType=0&${body}`), (err, resp, data) => {
799 try {
800 if (err) {
801 console.log(`${JSON.stringify(err)}`)
802 console.log(`${$.name} RubbishOper API请求失败,请检查网路重试`)
803 } else {
804 data = JSON.parse(data.replace(/\n/g, "").match(new RegExp(/jsonpCBK.?\((.*);*\)/))[1]);
805 }
806 } catch (e) {
807 $.logErr(e, resp);
808 } finally {
809 resolve(data);
810 }
811 })
812 break
813 default:
814 break
815 }
816 })
817}
818
819// 牛牛任务
820async function getActTask(type = true) {

Callers 1

queryRubbishInfoFunction · 0.85

Calls 4

taskUrlFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected