()
| 172 | |
| 173 | //三餐 |
| 174 | function 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 | } |
| 216 | function jsonParse(str) { |
| 217 | if (typeof str == "string") { |
| 218 | try { |
no test coverage detected