From 0f3569f1f1588385eb013967f5ae61e142c47124 Mon Sep 17 00:00:00 2001 From: Lkeme <19500576+lkeme@users.noreply.github.com> Date: Sat, 7 Aug 2021 10:56:18 +0800 Subject: [PATCH] [fix] AnchorRaffle --- src/plugin/AnchorRaffle.php | 13 +++++++------ src/util/BaseRaffle.php | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugin/AnchorRaffle.php b/src/plugin/AnchorRaffle.php index 85ef140..3071944 100644 --- a/src/plugin/AnchorRaffle.php +++ b/src/plugin/AnchorRaffle.php @@ -16,7 +16,7 @@ use BiliHelper\Util\BaseRaffle; class AnchorRaffle extends BaseRaffle { - const ACTIVE_TITLE = '天选时刻'; + const ACTIVE_TITLE = '天选之子'; const ACTIVE_SWITCH = 'live_anchor'; protected static $wait_list = []; @@ -178,10 +178,11 @@ class AnchorRaffle extends BaseRaffle 'room_id' => $room_id, 'raffle_id' => $de_raw['id'], 'raffle_name' => $de_raw['award_name'], + 'remarks' => self::ACTIVE_TITLE, 'wait' => time() + mt_rand(5, 25) ]; // Statistics::addPushList($data['raffle_name']); - Statistics::addPushList("天选之子"); + Statistics::addPushList(self::ACTIVE_TITLE); array_push(self::$wait_list, $data); return true; } @@ -230,13 +231,13 @@ class AnchorRaffle extends BaseRaffle $de_raw = json_decode($content, true); // {"code":-403,"data":null,"message":"访问被拒绝","msg":"访问被拒绝"} if (isset($de_raw['code']) && $de_raw['code'] == 0) { - Statistics::addSuccessList($data['raffle_name']); - Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . ": 参与抽奖成功~"); + Statistics::addSuccessList(self::ACTIVE_TITLE); + Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . "-(" . $data['raffle_name'] . "): 参与抽奖成功~"); } elseif (isset($de_raw['msg']) && $de_raw['code'] == -403 && $de_raw['msg'] == '访问被拒绝') { - Log::debug("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . ": {$de_raw['message']}"); + Log::debug("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . "-(" . $data['raffle_name'] . "): {$de_raw['message']}"); self::pauseLock(); } else { - Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . ": {$de_raw['message']}"); + Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . self::ACTIVE_TITLE . "-(" . $data['raffle_name'] . "): {$de_raw['message']}"); } } } diff --git a/src/util/BaseRaffle.php b/src/util/BaseRaffle.php index 1c80ddb..2ca5215 100644 --- a/src/util/BaseRaffle.php +++ b/src/util/BaseRaffle.php @@ -70,7 +70,12 @@ abstract class BaseRaffle } array_push($room_list, $raffle['room_id']); array_push($raffle_list, $raffle); - Statistics::addJoinList($raffle['raffle_name']); + // 有备注要单独处理 + if (isset($raffle['remarks'])) { + Statistics::addJoinList($raffle['remarks']); + } else { + Statistics::addJoinList($raffle['raffle_name']); + } } if (count($raffle_list) && count($room_list)) { $room_list = array_unique($room_list);