Skip to content

Commit

Permalink
Merge branch 'release/2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
RayWangQvQ committed Jun 1, 2023
2 parents 643bfc1 + 2cf6c89 commit 9c8739f
Show file tree
Hide file tree
Showing 7 changed files with 299 additions and 234 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,6 @@
## 2.0.0
- Feature[#513]:将基础组件和抽象迁移到nuget包中
- Fix[#543]:修复部分Api调用报“访问权限不足”
## 2.0.1
- PR[#539]:更新文档
- PR[#557]:修复直播接口权限不足问题
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Authors>Ray</Authors>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Ray.BiliBiliTool.Agent.BiliBiliAgent.Dtos;

public class GetSpaceInfoDto
{
public long mid { get; set; }
}
public class GetSpaceInfoFullDto : GetSpaceInfoDto
{
public string w_rid { get; set; }

public long wts { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface IUserInfoApi : IBiliBiliApi
/// </summary>
/// <param name="userId">uid</param>
/// <returns></returns>
[HttpGet("/x/space/wbi/acc/info?mid={userId}")]
Task<BiliApiResponse<GetSpaceInfoResponse>> GetSpaceInfo(long userId);
[HttpGet("/x/space/wbi/acc/info")]
Task<BiliApiResponse<GetSpaceInfoResponse>> GetSpaceInfo([PathQuery] GetSpaceInfoFullDto request);
}
}
34 changes: 31 additions & 3 deletions src/Ray.BiliBiliTool.DomainService/LiveDomainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class LiveDomainService : ILiveDomainService
private readonly DailyTaskOptions _dailyTaskOptions;
private readonly SecurityOptions _securityOptions;
private readonly BiliCookie _biliCookie;

private readonly IWbiDomainService _wbiDomainService;

public LiveDomainService(ILogger<LiveDomainService> logger,
ILiveApi liveApi,
Expand All @@ -44,6 +44,7 @@ public LiveDomainService(ILogger<LiveDomainService> logger,
IOptionsMonitor<LiveLotteryTaskOptions> liveLotteryTaskOptions,
IOptionsMonitor<LiveFansMedalTaskOptions> liveFansMedalTaskOptions,
IOptionsMonitor<SecurityOptions> securityOptions,
IWbiDomainService wbiDomainService,
BiliCookie biliCookie)
{
_logger = logger;
Expand All @@ -55,6 +56,7 @@ public LiveDomainService(ILogger<LiveDomainService> logger,
_dailyTaskOptions = dailyTaskOptions.CurrentValue;
_liveFansMedalTaskOptions = liveFansMedalTaskOptions.CurrentValue;
_securityOptions = securityOptions.CurrentValue;
_wbiDomainService = wbiDomainService;
_biliCookie = biliCookie;

}
Expand Down Expand Up @@ -407,7 +409,20 @@ public async Task SendDanmakuToFansMedalLive()

// 通过空间主页信息获取直播间 id
var liveHostUserId = medal.Medal_info.Target_id;
var spaceInfo = await _userInfoApi.GetSpaceInfo(liveHostUserId);
var req = new GetSpaceInfoDto()
{
mid = liveHostUserId
};


var w_ridDto = await _wbiDomainService.GetWridAsync(req);
var fullDto = new GetSpaceInfoFullDto()
{
mid = liveHostUserId,
w_rid = w_ridDto.w_rid,
wts = w_ridDto.wts
};
var spaceInfo = await _userInfoApi.GetSpaceInfo(fullDto);
if (spaceInfo.Code != 0)
{
_logger.LogError("【获取直播间信息】失败");
Expand Down Expand Up @@ -578,7 +593,20 @@ private async Task<List<FansMedalInfoDto>> GetFansMedalInfoList()

// 通过空间主页信息获取直播间 id
var liveHostUserId = medal.Medal_info.Target_id;
var spaceInfo = await _userInfoApi.GetSpaceInfo(liveHostUserId);
var req = new GetSpaceInfoDto()
{
mid = liveHostUserId
};


var w_ridDto = await _wbiDomainService.GetWridAsync(req);
var fullDto = new GetSpaceInfoFullDto()
{
mid = liveHostUserId,
w_rid = w_ridDto.w_rid,
wts = w_ridDto.wts
};
var spaceInfo = await _userInfoApi.GetSpaceInfo(fullDto);
if (spaceInfo.Code != 0)
{
_logger.LogError("【获取空间信息】失败");
Expand Down
Loading

0 comments on commit 9c8739f

Please sign in to comment.