(function_path, taskInfo = '')
| 870 | }) |
| 871 | } |
| 872 | function awardActTask(function_path, taskInfo = '') { |
| 873 | const { ddwTaskId, strTaskName} = taskInfo |
| 874 | return new Promise((resolve) => { |
| 875 | switch (function_path) { |
| 876 | case 'Award': |
| 877 | $.get(taskListUrl(function_path, `taskId=${ddwTaskId}`, 'jxbfddch'), (err, resp, data) => { |
| 878 | try { |
| 879 | if (err) { |
| 880 | console.log(`${JSON.stringify(err)}`) |
| 881 | console.log(`${$.name} awardActTask API请求失败,请检查网路重试`) |
| 882 | } else { |
| 883 | const {msg, ret, data: {prizeInfo = ''} = {}} = JSON.parse(data.match(new RegExp(/jsonpCBK.?\((.*);*/))[1]); |
| 884 | let str = ''; |
| 885 | if (msg.indexOf('活动太火爆了') !== -1) { |
| 886 | str = '任务为成就任务或者未到任务时间'; |
| 887 | } else { |
| 888 | if (JSON.parse(prizeInfo).dwPrizeType == 4) { |
| 889 | str = msg + prizeInfo ? `获得红包 ¥ ${JSON.parse(prizeInfo).strPrizeName}` : ''; |
| 890 | } else { |
| 891 | str = msg + prizeInfo ? `获得金币 ¥ ${JSON.parse(prizeInfo).ddwCoin}` : ''; |
| 892 | } |
| 893 | } |
| 894 | console.log(`【🐮领牛牛任务奖励】${strTaskName} ${str}\n${$.showLog ? data : ''}`); |
| 895 | } |
| 896 | } catch (e) { |
| 897 | $.logErr(e, resp); |
| 898 | } finally { |
| 899 | resolve(); |
| 900 | } |
| 901 | }) |
| 902 | break |
| 903 | case 'story/ActTaskAward': |
| 904 | $.get(taskUrl(function_path), (err, resp, data) => { |
| 905 | try { |
| 906 | if (err) { |
| 907 | console.log(`${JSON.stringify(err)}`) |
| 908 | console.log(`${$.name} awardActTask API请求失败,请检查网路重试`) |
| 909 | } else { |
| 910 | data = JSON.parse(data.replace(/\n/g, "").match(new RegExp(/jsonpCBK.?\((.*);*\)/))[1]); |
| 911 | if (data.iRet === 0 || data.sErrMsg === 'success') { |
| 912 | console.log(`【🐮牛牛任务】开启宝箱成功:获得财富 ¥ ${data.Data.ddwBigReward}\n`) |
| 913 | } else { |
| 914 | console.log(`【🐮牛牛任务】开启宝箱失败:${data.sErrMsg}\n`) |
| 915 | } |
| 916 | } |
| 917 | } catch (e) { |
| 918 | $.logErr(e, resp); |
| 919 | } finally { |
| 920 | resolve(); |
| 921 | } |
| 922 | }) |
| 923 | break |
| 924 | default: |
| 925 | break |
| 926 | } |
| 927 | }) |
| 928 | } |
| 929 |
no test coverage detected