[update] unify raffle api

This commit is contained in:
Lkeme 2019-07-30 01:16:29 +08:00
parent 0336f85170
commit 83692aad93
3 changed files with 22 additions and 5 deletions

View File

@ -1,6 +1,17 @@
# Release Notes
# 本项目Log
## v0.0.1.190730 alpha (2019-07-30)
### Added
-
### Changed
- unify raffle api
### Fixed
-
## v0.0.1.190723 alpha (2019-07-23)
### Added

View File

@ -3,7 +3,7 @@ B 站直播实用脚本
## 公告
Currently for Personal Edition **0.0.1.190723 alpha**
Currently for Personal Edition **0.0.1.190730 alpha**
## 文档

View File

@ -32,7 +32,7 @@ class UnifyRaffle extends BaseRaffle
$payload = [
'roomid' => $rid
];
$url = 'https://api.live.bilibili.com/gift/v3/smalltv/check';
$url = 'https://api.live.bilibili.com/xlive/lottery-interface/v3/smalltv/Check';
$raw = Curl::get($url, Sign::api($payload));
$de_raw = json_decode($raw, true);
@ -91,7 +91,7 @@ class UnifyRaffle extends BaseRaffle
'raffleId' => $winning_web['raffle_id']
];
// Web V3 Notice
$url = 'https://api.live.bilibili.com/gift/v3/smalltv/notice';
$url = 'https://api.live.bilibili.com/xlive/lottery-interface/v3/smalltv/Notice';
// 请求 && 解码
$raw = Curl::get($url, Sign::api($payload));
$de_raw = json_decode($raw, true);
@ -129,12 +129,18 @@ class UnifyRaffle extends BaseRaffle
*/
protected static function lottery(array $data): bool
{
$user_info = User::parseCookies();
$payload = [
'raffleId' => $data['raffle_id'],
'roomid' => $data['room_id'],
'type' => $data['type'],
'csrf_token' => $user_info['token'],
'csrf' => $user_info['token'],
'visit_id' => null,
];
$url = 'https://api.live.bilibili.com/gift/v3/smalltv/join';
$raw = Curl::get($url, Sign::api($payload));
$url = 'https://api.live.bilibili.com/xlive/lottery-interface/v3/smalltv/Join';
$raw = Curl::post($url, Sign::api($payload));
$de_raw = json_decode($raw, true);
if (isset($de_raw['code']) && $de_raw['code']) {
Log::notice("房间 {$data['room_id']} 编号 {$data['raffle_id']} " . static::ACTIVE_TITLE . ": {$de_raw['message']}");