From 1dabaa72137da3c6f6325b8ce67262a5921b0472 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:04:20 +0800 Subject: [PATCH] [update] Version 2.3.0.230821 --- .gitignore | 2 + README.md | 4 +- docs/CHANGELOG.md | 19 ++ plugin/ActivityLottery/ActivityLottery.php | 329 +++++++++++++++++++++ profile/example/config/user.ini | 4 + resources/activity_infos.json | 270 +++++++++++++++++ resources/latest_version.json | 14 - resources/version.json | 7 +- src/Api/Api/X/Activity/ApiActivity.php | 92 ++++++ src/Notice/Notice.php | 2 +- src/Task/Task.php | 2 +- 11 files changed, 724 insertions(+), 21 deletions(-) create mode 100644 plugin/ActivityLottery/ActivityLottery.php create mode 100644 resources/activity_infos.json delete mode 100644 resources/latest_version.json create mode 100644 src/Api/Api/X/Activity/ApiActivity.php diff --git a/.gitignore b/.gitignore index 20f0ad0..b21b15a 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ index1.php .phpunit.* captcha/data.json + +plugin/FansMedalIntimacy/ diff --git a/README.md b/README.md index 5c16024..a122a28 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@

- + @@ -117,7 +117,7 @@ Group: [602815575](https://jq.qq.com/?_wv=1027&k=UaalVexM) | **请不要来问 | DailyGold | 0.0.1 | 每日电池(APP) | Lkeme | 1114 | 24(小时) | √ | | PolishMedal | 0.0.1 | 点亮灰色勋章 | possible318/Lkeme | 1115 | 1(小时) | √ | | BatchUnfollow | 0.0.1 | 批量取消关注 | Lkeme | 1116 | 5-10(分钟) | √ | - +| ActivityLottery | 0.0.1 | 转盘活动 | Lkeme | 1117 | 1(分钟) | √ | ## 🖥️星图 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 27df002..0c3df1c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,6 +8,25 @@ [comment]: <> () +## v2.3.0.230821 alpha (2023-08-21) + +### Added + +- 转盘活动插件 +- + +### Changed + +- + +### Fixed + +- + +### Remarks + +- 请注意配置文件有所变动,注意更新。 + ## v2.2.0.230806 alpha (2023-08-06) ### Added diff --git a/plugin/ActivityLottery/ActivityLottery.php b/plugin/ActivityLottery/ActivityLottery.php new file mode 100644 index 0000000..2bb2080 --- /dev/null +++ b/plugin/ActivityLottery/ActivityLottery.php @@ -0,0 +1,329 @@ + __CLASS__, // hook + 'name' => 'ActivityLottery', // 插件名称 + 'version' => '0.0.1', // 插件版本 + 'desc' => '转盘活动', // 插件描述 + 'author' => 'Lkeme',// 作者 + 'priority' => 1117, // 插件优先级 + 'cycle' => '1(分钟)', // 运行周期 + // 新增字段 + 'start' => '08:00:00', // 插件开始日期 + 'end' => '23:00:00', // 插件结束日期 + ]; + + /** + * @var array + */ + protected array $config = [ + 'invalid_sids' => [], + 'wait_add_infos' => [], + 'wait_get_infos' => [], + 'wait_do_infos' => [], + ]; + + /** + * @param Plugin $plugin + */ + public function __construct(Plugin &$plugin) + { + // 时间锁 + TimeLock::initTimeLock(); + // 缓存 + Cache::initCache(); + // $this::class + $plugin->register($this, 'execute'); + } + + + /** + * 执行 + * @return void + */ + public function execute(): void + { + // 时间段限制 + // if (!TimeLock::isWithinTimeRange($this->info['start'], $this->info['end'])) return; + // 时间锁限制 + if (TimeLock::getTimes() > time() || !getEnable('activity_lottery')) return; + + // + $this->initConfig(); + + delay(1); + + // 获取远程数据 + $this->fetchRemoteInfos(); + + delay(1); + + // 增加次数 + $this->addMyTimes(); + + delay(1); + + // 查询次数 + $this->getMyTimes(); + + delay(1); + + // 执行次数 + $this->doMyTimes(); + + // + if (isset($this->config[date("Y-m-d")]['add']) && isset($this->config[date("Y-m-d")]['get']) && isset($this->config[date("Y-m-d")]['do'])) { + TimeLock::setTimes(TimeLock::timing(11) + mt_rand(1, 120) * 60); + } else { + TimeLock::setTimes(65); + } + + // + $this->initConfig(true); + + } + + + /** + * @param bool $ending + * @return void + */ + protected function initConfig(bool $ending = false): void + { + if ($ending) { + Cache::set('config', $this->config); + } else { + $this->config = Cache::get('config'); + $keys = ['invalid_sids', 'wait_add_infos', 'wait_get_infos', 'wait_do_infos']; + foreach ($keys as $key) { + if (!isset($this->config[$key])) $this->config[$key] = []; + } + } + } + + /** + * 执行次数 + * @return void + */ + protected function doMyTimes(): void + { + if (isset($this->config[date("Y-m-d")]['do'])) return; + // + if (empty($this->config['wait_add_infos']) && empty($this->config['wait_get_infos']) && empty($this->config['wait_do_infos'])) { + $this->config[date("Y-m-d")]['do'] = true; + return; + }; + // + $info = array_shift($this->config['wait_do_infos']); + if (is_null($info)) return; + // + Log::info("转盘活动: 当前活动 {$info['title']} 开始执行次数"); + // + $response = Bhp\Api\Api\X\Activity\ApiActivity::doLottery($info); + // + $this->_doMyTimes($info, $response); + } + + /** + * 执行次数 + * @param array $info + * @param array $data + * @return void + */ + protected function _doMyTimes(array $info, array $data): void + { + // 结束|无效 + if ($data['code'] == 170001 || $data['code'] == 175003) { + Log::warning("转盘活动: 当前活动 {$info['title']} 已经结束或失效 Error: {$data['code']} -> {$data['message']}"); + return; + } + // + if ($data['code'] != 0) { + Log::warning("转盘活动: 当前活动 {$info['title']} 执行失败 Error: {$data['code']} -> {$data['message']}"); + return; + } + if (str_contains($data['data'][0]['gift_name'], '未中奖') || $data['data'][0]['gift_id'] == 0) { + Log::notice("转盘活动: 当前活动 {$info['title']} 可能没有收获 {$data['data'][0]['gift_name']} "); + return; + } + // + Log::notice("转盘活动: 当前活动 {$info['title']} 执行成功 {$data['data'][0]['gift_name']}"); + Notice::push('activity_lottery', "转盘活动: 当前活动 {$info['title']} 执行成功 {$data['data'][0]['gift_name']}"); + } + + + /** + * 查询次数 + * @return void + */ + protected function getMyTimes(): void + { + if (isset($this->config[date("Y-m-d")]['get'])) return; + // + if (empty($this->config['wait_add_infos']) && empty($this->config['wait_get_infos'])) { + $this->config[date("Y-m-d")]['get'] = true; + return; + }; + // + $info = array_shift($this->config['wait_get_infos']); + if (is_null($info)) return; + // + Log::info("转盘活动: 当前活动 {$info['title']} 开始查询次数"); + // + $response = Bhp\Api\Api\X\Activity\ApiActivity::myTimes($info); + // + $this->_getMyTimes($info, $response); + } + + /** + * 查询次数 + * @param array $info + * @param array $data + * @return void + */ + protected function _getMyTimes(array $info, array $data): void + { + // 结束|无效 + if ($data['code'] == 170001 || $data['code'] == 175003) { + Log::warning("转盘活动: 当前活动 {$info['title']} 已经结束或失效 Error: {$data['code']} -> {$data['message']}"); + return; + } + // + if ($data['code'] != 0 || !isset($data['data']['times'])) { + Log::warning("转盘活动: 当前活动 {$info['title']} 获取次数失败 Error: {$data['code']} -> {$data['message']}"); + return; + } + // + if ($data['data']['times'] == 0) { + Log::warning("转盘活动: 当前活动 {$info['title']} 没有次数了"); + return; + } + // + Log::info("转盘活动: 当前活动 {$info['title']} 剩余次数 {$data['data']['times']}"); + for ($i = 0; $i < $data['data']['times']; $i++) { + $this->config['wait_do_infos'][] = $info; + } + } + + /** + * 增加次数 + * @return void + */ + protected function addMyTimes(): void + { + if (isset($this->config[date("Y-m-d")]['add'])) return; + // + if (empty($this->config['wait_add_infos'])) { + $this->config[date("Y-m-d")]['add'] = true; + return; + }; + // + $info = array_shift($this->config['wait_add_infos']); + if (is_null($info)) return; + // + Log::info("转盘活动: 当前活动 {$info['title']} 开始增加次数"); + // + $response = Bhp\Api\Api\X\Activity\ApiActivity::addTimes($info); + // + $this->_addMyTimes($info, $response); + + } + + + /** + * 增加次数 + * @param array $info + * @param array $data + * @return void + */ + protected function _addMyTimes(array $info, array $data): void + { + // 结束|无效 + if ($data['code'] == 170001 || $data['code'] == 175003) { + Log::warning("转盘活动: 当前活动 {$info['title']} 已经结束或失效 Error: {$data['code']} -> {$data['message']}"); + return; + } + // + if ($data['code'] != 0 || !isset($data['data']['add_num'])) { + Log::warning("转盘活动: 当前活动 {$info['title']} 增加次数失败 Error: {$data['code']} -> {$data['message']}"); + return; + } + // + Log::info("转盘活动: 当前活动 {$info['title']} 增加次数 {$data['data']['add_num']}"); + $this->config['wait_get_infos'][] = $info; + } + + + /** + * 获取远程数据 + * @return void + */ + protected function fetchRemoteInfos(): void + { + if (isset($this->config[date("Y-m-d")]['fetch'])) return; + // + $this->config['wait_add_infos'] = []; + $this->config['wait_get_infos'] = []; + $this->config['wait_do_infos'] = []; + // + $url = 'aHR0cHM6Ly9yYXcua2dpdGh1Yi5jb20vbGtlbWUvQmlsaUhlbHBlci1wZXJzb25hbC9tYXN0ZXIvcmVzb3VyY2VzL2FjdGl2aXR5X2luZm9zLmpzb24='; + $url = base64_decode($url); + $response = Request::getJson(false, 'other', $url); + // + $this->_fetchRemoteInfos($response['data']); + } + + /** + * 获取远程数据 + * @param array $data + * @return void + */ + protected function _fetchRemoteInfos(array $data): void + { + $new_data = []; + // + foreach ($data as $_ => $value) { + // 活动无效 + if (in_array($value['sid'], $this->config['invalid_sids'])) continue; + $new_data[] = $value; + } + // 获取乱序数据 + shuffle($new_data); + $this->config['wait_add_infos'] = $new_data; + // + Log::info("转盘活动: 获取远程数据" . count($new_data) . "条"); + // + $this->config[date("Y-m-d")]['fetch'] = true; + } + +} diff --git a/profile/example/config/user.ini b/profile/example/config/user.ini index 0d42fbe..e3b0c44 100644 --- a/profile/example/config/user.ini +++ b/profile/example/config/user.ini @@ -132,6 +132,10 @@ everyday = false enable = false tag = all +; 转盘活动 +[activity_lottery] +enable = true + ####################### # 通知设置 # ####################### diff --git a/resources/activity_infos.json b/resources/activity_infos.json new file mode 100644 index 0000000..784e924 --- /dev/null +++ b/resources/activity_infos.json @@ -0,0 +1,270 @@ +{ + "code": 200, + "remarks": "有需要可以自己添加,或者提pr", + "data": [ + { + "sid": "newLottery_e92d8384-1347-11ee-9251-a4ae12675bc2", + "title": "2023夏季日剧导视", + "url": "https://www.bilibili.com/blackboard/activity-ev8hmqZoJ6.html", + "update_time": "2023-08-20 20:56:49" + }, + { + "sid": "newLottery_fd9439bf-1af8-11ee-9251-a4ae12675bc2", + "title": "夏日游园会", + "url": "https://www.bilibili.com/blackboard/activity-aLq9HgrK1u.html", + "update_time": "2023-08-20 20:56:50" + }, + { + "sid": "newLottery_b76f441a-17d6-11ee-9251-a4ae12675bc2", + "title": "开启暑假的100种方式", + "url": "https://www.bilibili.com/blackboard/activity-o6ioKpTKvA.html", + "update_time": "2023-08-20 20:56:52" + }, + { + "sid": "newLottery_7f6d9e41-10ec-11ee-9251-a4ae12675bc2", + "title": "少年果真行新中式擂台赛", + "url": "https://www.bilibili.com/blackboard/activity-ygNwUa9nu6.html", + "update_time": "2023-08-20 20:56:53" + }, + { + "sid": "newLottery_3418aa32-f5f9-11ed-9251-a4ae12675bc2", + "title": "饭饭之交二创征稿大赛", + "url": "https://www.bilibili.com/blackboard/activity-lc2fXFydAC.html", + "update_time": "2023-08-20 20:56:54" + }, + { + "sid": "newLottery_76af5c78-101b-11ee-9251-a4ae12675bc2", + "title": "UP影剧综指南—少年季", + "url": "https://www.bilibili.com/blackboard/activity-5DFJabyao5.html", + "update_time": "2023-08-20 20:56:55" + }, + { + "sid": "newLottery_835b3056-3022-11ee-9251-a4ae12675bc2", + "title": "UP影剧综指南—暑期季—镇站之宝", + "url": "https://www.bilibili.com/blackboard/activity-qGmDE8nRTt.html", + "update_time": "2023-08-20 20:56:56" + }, + { + "sid": "newLottery_35922ca8-1c8e-11ee-9251-a4ae12675bc2", + "title": "感兴趣,就试试!", + "url": "https://www.bilibili.com/blackboard/activity-nHiYitkr5m.html", + "update_time": "2023-08-20 20:56:58" + }, + { + "sid": "newLottery_3bb5e752-31f3-11ee-9251-a4ae12675bc2", + "title": "我们的家庭日记·萌娃出道计划7.0", + "url": "https://www.bilibili.com/blackboard/activity-zl8bvdjDgE.html", + "update_time": "2023-08-20 20:56:59" + }, + { + "sid": "newLottery_0bc120e0-173e-11ee-9251-a4ae12675bc2", + "title": "2023游戏暑期狂欢节", + "url": "https://www.bilibili.com/blackboard/activity-uZeuVDGNOJ.html", + "update_time": "2023-08-20 20:57:00" + }, + { + "sid": "newLottery_97fdb9e3-e348-11ed-9251-a4ae12675bc2", + "title": "2023 TCR世界巡回赛", + "url": "https://www.bilibili.com/blackboard/activity-TCRWorldTour2023H5.html", + "update_time": "2023-08-20 20:57:01" + }, + { + "sid": "newLottery_dbfa6166-3822-11ee-9251-a4ae12675bc2", + "title": "《速度与激情10》全网首播!看片抽道奇战马乐高", + "url": "https://www.bilibili.com/blackboard/topic/activity-opcLvS7ZiC.html", + "update_time": "2023-08-20 20:57:02" + }, + { + "sid": "newLottery_77d0ce1e-1f0a-11ee-9251-a4ae12675bc2", + "title": "点亮年少时的动画灯塔,赢定制徽章!", + "url": "https://www.bilibili.com/blackboard/topic/activity-FhXPxTKRez.html", + "update_time": "2023-08-20 20:57:04" + }, + { + "sid": "newLottery_359547ce-29f8-11ee-9251-a4ae12675bc2", + "title": "点亮年少时的动画灯塔,赢定制徽章!", + "url": "https://www.bilibili.com/blackboard/topic/activity-zXHzm1eH5O.html", + "update_time": "2023-08-20 20:57:05" + }, + { + "sid": "newLottery_bdda67b3-3106-11ee-9251-a4ae12675bc2", + "title": "点亮年少时的动画灯塔,赢定制徽章!", + "url": "https://www.bilibili.com/blackboard/topic/activity-lT6UBe1LHW.html", + "update_time": "2023-08-20 20:57:06" + }, + { + "sid": "newLottery_fde7c107-3b47-11ee-9251-a4ae12675bc2", + "title": "看蜘蛛侠赢PS5+VR套装", + "url": "https://www.bilibili.com/blackboard/topic/activity-9HNDnitdIx.html", + "update_time": "2023-08-20 20:57:07" + }, + { + "sid": "newLottery_b47e7ff3-382f-11ee-9251-a4ae12675bc2", + "title": "解锁B站玩家指南", + "url": "https://www.bilibili.com/blackboard/activity-Gjn1nAHMNq.html", + "update_time": "2023-08-20 20:57:08" + }, + { + "sid": "newLottery_77ac403d-29fc-11ee-9251-a4ae12675bc2", + "title": "和平精空投节视频征集", + "url": "https://www.bilibili.com/blackboard/activity-3Dz7tbzGSz.html", + "update_time": "2023-08-20 20:57:10" + }, + { + "sid": "newLottery_8e0055f5-27b1-11ee-9251-a4ae12675bc2", + "title": "人人皆可狮子座", + "url": "https://www.bilibili.com/blackboard/activity-LRKeoRlMMy.html", + "update_time": "2023-08-20 20:57:11" + }, + { + "sid": "newLottery_69f75292-1ecd-11ee-9251-a4ae12675bc2", + "title": "【补番月台】夏日动画游乐场", + "url": "https://www.bilibili.com/blackboard/topic/activity-u2SFJkZoK6.html", + "update_time": "2023-08-20 20:57:12" + }, + { + "sid": "newLottery_43aa0f81-faa5-11ed-9251-a4ae12675bc2", + "title": "2023 中国野生生物影像年赛", + "url": "https://www.bilibili.com/blackboard/activity-animal-h5.html", + "update_time": "2023-08-20 20:57:13" + }, + { + "sid": "newLottery_bcc1bec2-3bfb-11ee-9251-a4ae12675bc2", + "title": "点亮年少时的动画灯塔,赢定制徽章!", + "url": "https://www.bilibili.com/blackboard/topic/activity-1p76gTRDFp.html", + "update_time": "2023-08-20 20:57:14" + }, + { + "sid": "newLottery_32964ac7-35ba-11ee-9251-a4ae12675bc2", + "title": "拜托!我家超酷的", + "url": "https://www.bilibili.com/blackboard/activity-Bkf7tmF0it.html", + "update_time": "2023-08-20 20:57:16" + }, + { + "sid": "newLottery_062adeaa-3049-11ee-9251-a4ae12675bc2", + "title": "四季有时,指路山海【盛夏篇】", + "url": "https://www.bilibili.com/blackboard/activity-nkM6FVkWJe.html", + "update_time": "2023-08-20 20:57:17" + }, + { + "sid": "newLottery_c42bd25d-3379-11ee-9251-a4ae12675bc2", + "title": "未来探索者联盟", + "url": "https://www.bilibili.com/blackboard/activity-py5RBGveW1.html", + "update_time": "2023-08-20 20:57:19" + }, + { + "sid": "newLottery_00099592-27c8-11ee-9251-a4ae12675bc2", + "title": "夏日捡漏市集", + "url": "https://www.bilibili.com/blackboard/activity-tADtwbVrY5.html", + "update_time": "2023-08-20 20:57:20" + }, + { + "sid": "newLottery_0b963431-3339-11ee-9251-a4ae12675bc2", + "title": "稀有潮玩一发入魂", + "url": "https://www.bilibili.com/blackboard/activity-hXCXcEZxK2.html", + "update_time": "2023-08-20 20:57:22" + }, + { + "sid": "newLottery_8eaa246b-261f-11ee-9251-a4ae12675bc2", + "title": "世界在等你出发", + "url": "https://www.bilibili.com/blackboard/activity-UYcOFuzfFe.html", + "update_time": "2023-08-20 20:57:23" + }, + { + "sid": "newLottery_589c70ae-34ed-11ee-9251-a4ae12675bc2", + "title": "我的显眼包搭子", + "url": "https://www.bilibili.com/blackboard/activity-krK3gvs3NW.html", + "update_time": "2023-08-20 20:57:24" + }, + { + "sid": "newLottery_fb180a41-278d-11ee-9251-a4ae12675bc2", + "title": "致竞硬核PLAYER", + "url": "https://www.bilibili.com/blackboard/activity-Ljg5SnHTjX.html", + "update_time": "2023-08-20 20:57:25" + }, + { + "sid": "newLottery_a45a71a6-3b4e-11ee-9251-a4ae12675bc2", + "title": "心动好物攻略", + "url": "https://www.bilibili.com/blackboard/activity-BJuwpZObkd.html", + "update_time": "2023-08-20 20:57:26" + }, + { + "sid": "newLottery_cabb3769-3c1c-11ee-9251-a4ae12675bc2", + "title": "冒险岛手游公测", + "url": "https://www.bilibili.com/blackboard/activity-anKnkES21B.html", + "update_time": "2023-08-20 20:57:28" + }, + { + "sid": "newLottery_b33cc224-3ca8-11ee-9251-a4ae12675bc2", + "title": "白夜极光UP主激励计划-第三期", + "url": "https://www.bilibili.com/blackboard/activity-P1KpOWBUFi.html", + "update_time": "2023-08-20 20:57:30" + }, + { + "sid": "newLottery_77b5cbdc-3c23-11ee-9251-a4ae12675bc2", + "title": "斯露德公测创作者激励计划-抽奖机", + "url": "https://www.bilibili.com/blackboard/activity-t1QPTat5O2.html", + "update_time": "2023-08-20 20:57:31" + }, + { + "sid": "newLottery_be453e38-3767-11ee-9251-a4ae12675bc2", + "title": "UP!新学期", + "url": "https://www.bilibili.com/blackboard/activity-LS126GvAKy.html", + "update_time": "2023-08-20 20:57:32" + }, + { + "sid": "newLottery_43e098bf-2490-11ee-9251-a4ae12675bc2", + "title": "坎公玩家团激励计划第23期(海风拂盛夏)", + "url": "https://www.bilibili.com/blackboard/activity-6Z3RULhraq.html", + "update_time": "2023-08-20 20:57:34" + }, + { + "sid": "newLottery_8651096f-3052-11ee-9251-a4ae12675bc2", + "title": "B-Lab研究院【第四期】", + "url": "https://www.bilibili.com/blackboard/activity-BLab.html", + "update_time": "2023-08-20 20:57:36" + }, + { + "sid": "newLottery_0acc57ed-2f98-11ee-9251-a4ae12675bc2", + "title": "王者战报常驻抽奖", + "url": "https://www.bilibili.com/blackboard/activity-uuXjUtvB0Y.html", + "update_time": "2023-08-20 20:57:37" + }, + { + "sid": "newLottery_7f960fde-253b-11ee-9251-a4ae12675bc2", + "title": "崩坏:星穹铁道1.2创作者激励计划抽奖机", + "url": "https://www.bilibili.com/blackboard/activity-pvTPn8PGo9.html", + "update_time": "2023-08-20 20:57:38" + }, + { + "sid": "newLottery_41c08882-32c2-11ee-9251-a4ae12675bc2", + "title": "崩坏3 6.9创作激励计划 抽奖机", + "url": "https://www.bilibili.com/blackboard/activity-enUvYDBdNv.html", + "update_time": "2023-08-20 20:57:41" + }, + { + "sid": "newLottery_6a25307d-310b-11ee-9251-a4ae12675bc2", + "title": "蔚蓝档案公测激励计划", + "url": "https://www.bilibili.com/blackboard/activity-fAb7inve4B.html", + "update_time": "2023-08-20 20:57:42" + }, + { + "sid": "newLottery_bf29c32b-29e0-11ee-9251-a4ae12675bc2", + "title": "王者荣耀宠粉节-抽奖机", + "url": "https://www.bilibili.com/blackboard/activity-brqxvTQhSK.html", + "update_time": "2023-08-20 20:57:43" + }, + { + "sid": "newLottery_65fc5681-2175-11ee-9251-a4ae12675bc2", + "title": "蛋仔派对夏日大作战-抽奖机", + "url": "https://www.bilibili.com/blackboard/activity-vMWaJunELA.html", + "update_time": "2023-08-20 20:57:46" + }, + { + "sid": "newLottery_4bdadfdb-149d-11ee-9251-a4ae12675bc2", + "title": "缤智造物", + "url": "https://www.bilibili.com/blackboard/activity-VAQowFjuRn.html", + "update_time": "2023-08-20 20:57:47" + } + ] +} diff --git a/resources/latest_version.json b/resources/latest_version.json deleted file mode 100644 index b4f2684..0000000 --- a/resources/latest_version.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "code": 200, - "project": "BiliHelper-personal", - "branch": "master", - "source": "https://github.com/lkeme/BiliHelper-personal", - "raw_url": "https://gh.notifyplus.cf/https://raw.githubusercontent.com/lkeme/BiliHelper-personal/master/data/latest_version.json", - "purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/master/data/latest_version.json", - "version": "1.2.0.220517", - "des": "程序有更新,请及时线上查看更新哦~", - "time": "2022年5月17日", - "ini_version": "0.0.1", - "ini_des": "配置有更新,请及时线上查看更新哦~", - "ini_time": "2022年5月17日" -} diff --git a/resources/version.json b/resources/version.json index 1e3bf82..8a073cc 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,16 +1,17 @@ { "code": 200, "project": "BiliHelper-personal", + "branch": "master", "source": "https://github.com/lkeme/BiliHelper-personal", "raw_url": "https://gh.notifyplus.cf/https://github.com/lkeme/BiliHelper-personal/blob/master/resources/version.json", "master_raw_url": "https://gh.notifyplus.cf/https://github.com/lkeme/BiliHelper-personal/blob/master/resources/version.json", "dev_raw_url": "https://gh.notifyplus.cf/https://github.com/lkeme/BiliHelper-personal/blob/dev/resources/version.json", "master_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/master/resources/version.json", "dev_purge_url": "https://cdn.staticaly.com/gh/lkeme/BiliHelper-personal/dev/resources/version.json", - "version": "2.2.0.230806", + "version": "2.3.0.230821", "des": "程序有更新,请及时线上查看更新哦~", - "time": "2023年08月06日", + "time": "2023年08月21日", "ini_version": "0.0.1", "ini_des": "配置有更新,请及时线上查看更新哦~", - "ini_time": "2023年08月06日" + "ini_time": "2023年08月21日" } diff --git a/src/Api/Api/X/Activity/ApiActivity.php b/src/Api/Api/X/Activity/ApiActivity.php new file mode 100644 index 0000000..256360c --- /dev/null +++ b/src/Api/Api/X/Activity/ApiActivity.php @@ -0,0 +1,92 @@ + 'https://www.bilibili.com', + 'referer' => $info['url'], + ]; + $payload = [ + 'sid' => $info['sid'], + 'num' => $num, + 'csrf' => $user['csrf'], + ]; + // {"code":0,"message":"0","ttl":1,"data":[{"id":0,"mid":123,"ip":0,"num":1,"gift_id":0,"gift_name":"未中奖0","gift_type":0,"img_url":"","type":1,"ctime":123,"cid":0,"extra":{},"award_info":null,"order_no":""}]} + return Request::postJson(true, 'pc', $url, $payload, $headers); + } + + /** + * @param array $info + * @param int $action_type 4 关注 3 分享 + * @return array + */ + public static function addTimes(array $info, int $action_type = 3): array + { + // + $user = User::parseCookie(); + // + $url = 'https://api.bilibili.com/x/lottery/addtimes'; + $headers = [ + 'origin' => 'https://www.bilibili.com', + 'referer' => $info['url'], + ]; + $payload = [ + 'sid' => $info['sid'], + 'action_type' => $action_type, + 'csrf' => $user['csrf'], + ]; + // {"code":0,"message":"0","ttl":1,"data":{"add_num":1}} + return Request::postJson(true, 'pc', $url, $payload, $headers); + } + + /** + * @param array $info + * @return array + */ + public static function myTimes(array $info): array + { + $url = 'https://api.bilibili.com/x/lottery/mytimes'; + $headers = [ + 'origin' => 'https://www.bilibili.com', + 'referer' => $info['url'], + ]; + $payload = [ + 'sid' => $info['sid'], + ]; + // {"code":0,"message":"0","ttl":1,"data":{"times":1,"lottery_type":0,"points":0,"points_per_time":0,"intergral":null}} + return Request::getJson(true, 'pc', $url, $payload, $headers); + } + + +} diff --git a/src/Notice/Notice.php b/src/Notice/Notice.php index 78130e7..fc02130 100644 --- a/src/Notice/Notice.php +++ b/src/Notice/Notice.php @@ -181,7 +181,7 @@ class Notice extends SingleTon 'content' => "[$now_time] 用户: $uname 详情: $msg" ], 'activity_lottery' => [ - 'title' => '主站九宫格抽奖活动', + 'title' => '转盘抽奖活动', 'content' => "[$now_time] 用户: $uname 详情: $msg" ], 'jury_leave_office' => [ diff --git a/src/Task/Task.php b/src/Task/Task.php index 39bee99..2f8dd38 100644 --- a/src/Task/Task.php +++ b/src/Task/Task.php @@ -61,7 +61,7 @@ class Task extends SingleTon Log::error($error_msg); // Notice::push('error', $error_msg); } - delay(1); + delay(0.1); } }); }