Merge branch 'lkeme:master' into master

This commit is contained in:
菜狗 2021-10-09 14:14:27 +08:00 committed by GitHub
commit 196145e469
9 changed files with 48 additions and 2652 deletions

2
.gitignore vendored
View File

@ -14,6 +14,7 @@ tmp/
out
gen
/vendor/
composer.lock
/configs/
/tests/
config
@ -28,6 +29,7 @@ conf/user1.ini
/conf/test1.ini
/src/backup/
script.php
ABOUT.md
task/*
cache/*

2621
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -180,8 +180,9 @@ filter_words =
[notify.dingtalk]
token =
; Tele机器人|token|chatid|依赖USE_NOTIFY
; Tele机器人|url(可选)|token|chatid|依赖USE_NOTIFY
[notify.telegram]
url =
bottoken =
chatid =

View File

@ -5,9 +5,9 @@
"data": [
{
"_url": "注释: 活动地址",
"url": "https://www.bilibili.com/blackboard/activity-kiOl0D1nF8.html",
"url": "https://www.bilibili.com/blackboard/genshin-1st-anniversary.html",
"_title": "注释: 活动标题",
"title": "原神2.0版本UP主激励计划",
"title": "原神一周年庆典UP主激励计划",
"_description": "注释: 活动描述",
"description": "每日在原神分区任意直播间观看20分钟1张、1小时2张、2小时3张每日最高6张。",
"_room_id": "注释: 活动直播间如果为0则取分区随机一个",
@ -17,15 +17,27 @@
"_parent_area_id": "注释: 主分区id",
"parent_area_id": 3,
"_coin_id": "注释: 抽奖id",
"coin_id": 209,
"coin_id": 249,
"_pool_id": "注释: 抽奖id",
"pool_id": 219,
"pool_id": 257,
"_watch_time": "注释: 观看时长 单位秒",
"watch_time": 7320,
"_draw_times": "注释: 抽奖次数",
"draw_times": 6,
"_expire_at": "注释: 活动有效时间",
"expire_at": "2021-08-31 23:59:59"
"expire_at": "2021-10-12 23:59:59"
},
{
"url": "https://live.bilibili.com/6",
"title": "S11LOL英雄联盟全球总决赛",
"description": "每日在LOL直播间观看1分钟1张3分钟2张5分钟3张",
"room_id": 0,
"area_id": 86,
"parent_area_id": 2,
"coin_id": 76,
"watch_time": 600,
"draw_times": 0,
"expire_at": "2021-11-06 23:59:59"
},
{
"url": "https://www.bilibili.com/blackboard/activity-aCrSakaiX5.html",
@ -156,18 +168,6 @@
"watch_time": 1000,
"draw_times": 2,
"expire_at": "2021-08-29 23:59:59"
},
{
"url": "https://live.bilibili.com/6",
"title": "2021LPL春季赛",
"description": "每日在LOL直播间观看5分钟1张15分钟1张",
"room_id": 7734200,
"area_id": 86,
"parent_area_id": 2,
"coin_id": 76,
"watch_time": 3720,
"draw_times": 3,
"expire_at": "2021-05-31 23:59:59"
}
]
}

View File

@ -23,22 +23,33 @@ class Device
private string $bili_file = 'bili.yaml';
private string $device_file = 'device.yaml';
/**
* 加载配置
* @use 真实路径
* @param string $file
* @return string
*/
private function fileRealPath(string $file): string
{
return APP_CONF_PATH . $file;
}
/**
* @use 加载配置
*/
public function load(string $load_file)
{
// 提前处理 后缀
$custom_file = str_replace(strrchr($load_file, "."), "", $load_file) . '_';
// 自定义客户端
if (is_file(APP_CONF_PATH . $custom_file . $this->bili_file)) {
$this->bili_file = APP_CONF_PATH . $custom_file . $this->bili_file;
Log::info('使用自定义Bili.yaml');
if (is_file($this->fileRealPath($custom_file . $this->bili_file))) {
$this->bili_file = $custom_file . $this->bili_file;
Log::info('使用自定义' . $this->bili_file);
}
// 自定义设备
if (is_file(APP_CONF_PATH . $custom_file . $this->device_file)) {
$this->device_file = APP_CONF_PATH . $custom_file . $this->device_file;
Log::info('使用自定义Device.yaml');
if (is_file($this->fileRealPath($custom_file . $this->device_file))) {
$this->device_file = $custom_file . $this->device_file;
Log::info('使用自定义' . $this->device_file);
}
// 加载数据
$this->device = new Config();
@ -47,7 +58,7 @@ class Device
$files = [$this->bili_file, $this->device_file];
// 循环加载
foreach ($files as $file) {
$processor->extend($loader->load(APP_CONF_PATH . $file));
$processor->extend($loader->load($this->fileRealPath($file)));
}
$this->device->import($processor->export());
}

View File

@ -26,7 +26,7 @@ class Barrage
}
self::setPauseStatus();
if (self::sendMsg()) {
self::setLock(mt_rand(40, 80) * 60);
self::setLock(mt_rand(180, 240) * 60);
return;
}
self::setLock(15 * 60);

View File

@ -332,12 +332,14 @@ class Live
* @param int $page_size
* @return array
*/
public static function fetchMedalList(int $page_size = 100): array
public static function fetchMedalList(int $page_size = 10): array
{
$metal_list = [];
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= 100; $i++) {
// https://live.bilibili.com/p/html/live-app-fansmedal-manange/index.html
// $url = 'https://api.live.bilibili.com/fans_medal/v5/live_fans_medal/iApiMedal';
$url = 'https://api.live.bilibili.com/i/api/medal';
// TODO size变小 需要优化获取逻辑 可能会412
$payload = [
'page' => $i,
'pageSize' => $page_size

View File

@ -189,7 +189,8 @@ class Notice
private static function teleSend(array $info)
{
Log::info('使用Tele机器人推送消息');
$url = 'https://api.telegram.org/bot' . getConf('bottoken', 'notify.telegram') . '/sendMessage';
$base_url = getConf('url', 'notify.telegram') ?: 'https://api.telegram.org/bot';
$url = $base_url . getConf('bottoken', 'notify.telegram') . '/sendMessage';
$payload = [
'chat_id' => getConf('chatid', 'notify.telegram'),
'text' => $info['content']

View File

@ -77,7 +77,7 @@ class UnFollow extends BaseTask
* @return array
* @throws \Exception
*/
private static function relationTag($tag_id, int $max_pn = 30, int $max_ps = 20): array
private static function relationTag($tag_id, int $max_pn = 60, int $max_ps = 20): array
{
$following = [];
$url = 'https://api.bilibili.com/x/relation/tag';