Skip to content

Commit

Permalink
feat: add CustomComicId and CustomEpId (#562)
Browse files Browse the repository at this point in the history
* feat: add CustomComicId and CustomEpId

* fix: str to int

* fix: avoid possible value overflows

* Update src/Ray.BiliBiliTool.DomainService/MangaDomainService.cs

* Update src/Ray.BiliBiliTool.Agent/BiliBiliAgent/Interfaces/IMangaApi.cs

---------

Co-authored-by: 在7楼 <[email protected]>
  • Loading branch information
Initial-heart-1 and RayWangQvQ committed Jun 18, 2023
1 parent fbc01c7 commit 171c895
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public interface IMangaApi : IBiliBiliApi
/// </summary>
/// <param name="platform"></param>
/// <returns></returns>
[HttpPost("/twirp/bookshelf.v1.Bookshelf/AddHistory?platform={platform}&comic_id=27355&ep_id=381662")]
Task<BiliApiResponse> ReadManga(string platform);
[HttpPost("/twirp/bookshelf.v1.Bookshelf/AddHistory?platform={platform}&comic_id={comic_id}&ep_id={ep_id}")]
Task<BiliApiResponse> ReadManga(string platform, long comic_id, long ep_id);

/// <summary>
/// 获取会员漫画奖励
Expand Down
10 changes: 10 additions & 0 deletions src/Ray.BiliBiliTool.Config/Options/DailyTaskOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ public string ChargeComment
/// </summary>
public string DevicePlatform { get; set; } = "android";

/// <summary>
/// 自定义漫画阅读 comic_id
/// </summary>
public long CustomComicId { get; set; } = 27355;

/// <summary>
/// 自定义漫画阅读 ep_id
/// </summary>
public long CustomEpId { get; set; } = 381662;

public List<long> SupportUpIdList
{
get
Expand Down
4 changes: 3 additions & 1 deletion src/Ray.BiliBiliTool.Console/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"ChargeComment": "", //充电后留言
"DayOfReceiveVipPrivilege": 1, //每月几号自动领取会员权益的[-1,31],-1表示不指定,默认每月1号;0表示不自动领取
"DayOfExchangeSilver2Coin": 0, //每月几号执行银瓜子兑换硬币[-1,31],-1表示不指定,默认每月最后一天;-2表示每天;0表示不进行兑换
"DevicePlatform": "android" //执行客户端操作时的平台 [ios,android]
"DevicePlatform": "android", //执行客户端操作时的平台 [ios,android]
"CustomComicId": 27355, //自定义漫画阅读 comic_id,若不清楚含义请勿修改
"CustomEpId": 381662 //自定义漫画阅读 ep_id,若不清楚含义请勿修改
},

"LiveLotteryTaskConfig": {
Expand Down
5 changes: 3 additions & 2 deletions src/Ray.BiliBiliTool.DomainService/MangaDomainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ public async Task MangaSign()
/// </summary>
public async Task MangaRead()
{
BiliApiResponse response = await _mangaApi.ReadManga(_dailyTaskOptions.DevicePlatform);
if ( _dailyTaskOptions.CustomComicId <= 0 ) return;
BiliApiResponse response = await _mangaApi.ReadManga(_dailyTaskOptions.DevicePlatform, _dailyTaskOptions.CustomComicId, _dailyTaskOptions.CustomEpId);

if (response.Code == 0)
{
_logger.LogInformation("【漫画阅读】成功, 阅读漫画为:堀与宫村");
_logger.LogInformation("【漫画阅读】成功");
}
else
{
Expand Down

1 comment on commit 171c895

@catlair
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

漫画阅读除了给自己加一个历史记录,没有其他任何意义吧

Please sign in to comment.