| 1026 | } |
| 1027 | |
| 1028 | async function queryStatus() { |
| 1029 | $.log("#### 检查任务进行状况") |
| 1030 | const myRequest = { |
| 1031 | url: "https://api.bilibili.com/x/member/web/exp/reward", |
| 1032 | headers: { |
| 1033 | "cookie": config.cookieStr |
| 1034 | } |
| 1035 | } |
| 1036 | await $.fetch(myRequest).then(response => { |
| 1037 | try { |
| 1038 | const body = $.toObj(response.body) |
| 1039 | if (body?.code === 0) { |
| 1040 | if (body.data.login) { |
| 1041 | $.log("- 今日已登录") |
| 1042 | config.user.num = (config.user.num === 0 ? 1 : config.user.num) |
| 1043 | if (!config['user'].hasOwnProperty("time")) { |
| 1044 | config.user.time = startTime |
| 1045 | } |
| 1046 | } else { |
| 1047 | $.log("! 今日尚未登录") |
| 1048 | config.user.num = 0 |
| 1049 | } |
| 1050 | if (body.data.watch){ |
| 1051 | $.log("- 今日已观看") |
| 1052 | config.watch.num = (config.watch.num === 0 || typeof config.watch.num === 'undefined' ? 1 : config.watch.num) |
| 1053 | if (!config['watch'].hasOwnProperty("time")) { |
| 1054 | config.watch.time = startTime |
| 1055 | } |
| 1056 | } else { |
| 1057 | $.log("! 今日尚未观看") |
| 1058 | config.watch.num = 0 |
| 1059 | } |
| 1060 | if (body.data.share){ |
| 1061 | $.log("- 今日已分享") |
| 1062 | config.share.num = (config.share.num === 0 || typeof config.share.num === 'undefined' ? 1 : config.share.num) |
| 1063 | if (!config['share'].hasOwnProperty("time")) { |
| 1064 | config.share.time = startTime |
| 1065 | } |
| 1066 | } else { |
| 1067 | $.log("! 今日尚未分享") |
| 1068 | config.share.num = 0 |
| 1069 | } |
| 1070 | if (body.data.coins === 50){ |
| 1071 | $.log("- 今日已投币") |
| 1072 | if (!config['coins'].hasOwnProperty("time")) { |
| 1073 | config.coins.time = startTime |
| 1074 | } else { |
| 1075 | if (format(new Date().toDateString()) > config.coins.time) { |
| 1076 | config.coins.time = startTime |
| 1077 | } |
| 1078 | } |
| 1079 | } else if ((body.data.coins / 10) >= real_times) { |
| 1080 | config.coins.time = startTime |
| 1081 | $.log("- 已完成用户设置的投币量") |
| 1082 | } else if (config.user.money <= 5) { |
| 1083 | $.log("! 硬币数不足") |
| 1084 | } else { |
| 1085 | $.log("! 今日投币未完成") |