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

Function QueryHireReward

jd_dreamFactory.js:332–361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

330
331//查询有多少的招工电力可收取
332function QueryHireReward() {
333 return new Promise(async resolve => {
334 // const url = `/dreamfactory/friend/HireAward?zone=dream_factory&date=${new Date().Format("yyyyMMdd")}&type=0&sceneval=2&g_login_type=1`
335 $.get(taskurl('friend/QueryHireReward', ``, `_time,zone`), async (err, resp, data) => {
336 try {
337 if (err) {
338 console.log(`${JSON.stringify(err)}`)
339 console.log(`${$.name} API请求失败,请检查网路重试`)
340 } else {
341 if (safeGet(data)) {
342 data = JSON.parse(data);
343 if (data['ret'] === 0) {
344 for (let item of data['data']['hireReward']) {
345 if (item.date !== new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).Format("yyyyMMdd")) {
346 await hireAward(item.date, item.type);
347 }
348 }
349 } else {
350 console.log(`异常:${JSON.stringify(data)}`)
351 }
352 }
353 }
354 } catch (e) {
355 $.logErr(e, resp)
356 } finally {
357 resolve();
358 }
359 })
360 })
361}
362// 收取招工/劳模电力
363function hireAward(date, type = 0) {
364 return new Promise(async resolve => {

Callers 1

jdDreamFactoryFunction · 0.85

Calls 6

hireAwardFunction · 0.85
taskurlFunction · 0.70
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected