MCPcopy Create free account
hub / github.com/ClydeTime/Surge / takeGeneralTask

Function takeGeneralTask

Script/Task/xmly.js:772–805  ·  view source on GitHub ↗
(taskId)

Source from the content-addressed store, hash-verified

770}
771
772async function takeGeneralTask(taskId){
773 let headers = {
774 "Cookie": config.xm_cookie,
775 'Content-Type': `application/json`
776 }
777 let body = `{"aid":112,"taskId":${taskId}}`
778 let myRequest = {
779 url: `http://hybrid.ximalaya.com/web-activity/task/v2/refreshClientTask`,
780 headers: headers,
781 body: body
782 }
783 return await $.http.post(myRequest).then(
784 (response) => {
785 body = JSON.parse(response.body)
786 if (body.ret == 0) {
787 if (body.data.ret == 0) {
788 return true
789 } else if (body.data.ret == -1) {
790 $.log("- 此项通用任务今日已接取")
791 return true
792 } else {
793 $.log("- !!!未知接取状态")
794 return false
795 }
796 } else {
797 $.log("- !!!通用任务接取失败")
798 return false
799 }
800 },(reason) => {
801 $.log("- !!!通用任务接取失败")
802 return false
803 }
804 )
805}
806
807async function handInGeneralTask(taskId){
808 let headers = {

Callers

nothing calls this directly

Calls 3

postMethod · 0.45
parseMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected