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

Function ThreeMeals

jd_joy_feedPets.js:174–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172
173//三餐
174function ThreeMeals() {
175 return new Promise(resolve => {
176 let opt = {
177 url: "//jdjoy.jd.com/common/pet/getFood?taskType=ThreeMeals&reqSource=h5&invokeKey=Oex5GmEuqGep1WLC",
178 // url: "//draw.jdfcloud.com/common/pet/getPetTaskConfig?reqSource=h5&invokeKey=Oex5GmEuqGep1WLC",
179 method: "GET",
180 data: {},
181 credentials: "include",
182 header: {"content-type": "application/json"}
183 }
184 const url = "https:"+ taroRequest(opt)['url']
185 const options = {
186 url,
187 headers: {
188 'Cookie': cookie,
189 'reqSource': 'h5',
190 'Host': 'jdjoy.jd.com',
191 'Connection': 'keep-alive',
192 'Content-Type': 'application/json',
193 'Referer': 'https://jdjoy.jd.com/pet/index',
194 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
195 'Accept-Language': 'zh-cn',
196 'Accept-Encoding': 'gzip, deflate, br',
197 }
198 }
199 $.get(options, async (err, resp, data) => {
200 try {
201 data = JSON.parse(data);
202 if (data.success) {
203 if (data.errorCode === 'received') {
204 console.log(`三餐结果领取成功`)
205 message += `【三餐】领取成功,获得${data.data}g狗粮\n`;
206 }
207 }
208 } catch (e) {
209 $.logErr(resp, e);
210 } finally {
211 resolve(data);
212 }
213 })
214 })
215}
216function jsonParse(str) {
217 if (typeof str == "string") {
218 try {

Callers 1

jd_joy_feedPets.jsFile · 0.85

Calls 6

taroRequestFunction · 0.70
isNodeMethod · 0.45
getdataMethod · 0.45
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected