/// <summary> /// 为视频投币 /// </summary> /// <param name="aid">av号</param> /// <param name="multiply">投币数量</param> /// <param name="select_like">是否同时点赞 1是0否</param> /// <returns>是否投币成功</returns> public bool AddCoinsForVideo(string aid, int multiply, bool select_like, string title = "") { var result = _dailyTaskApi.AddCoinForVideo(aid, multiply, select_like ? 1 : 0, _biliBiliCookieOptions.BiliJct).Result; if (result.Code == 0) { _logger.LogInformation("为“{title}”投币成功", title); return(true); } else { _logger.LogInformation("为“{title}”投币失败,原因:{msg}", aid, title, result.Message); return(false); } }
/// <summary> /// 为视频投币 /// </summary> /// <param name="aid">av号</param> /// <param name="multiply">投币数量</param> /// <param name="select_like">是否同时点赞 1是0否</param> /// <returns>是否投币成功</returns> public bool DoAddCoinForVideo(string aid, int multiply, bool select_like, string title = "") { BiliApiResponse result = _dailyTaskApi.AddCoinForVideo(aid, multiply, select_like ? 1 : 0, _biliBiliCookieOptions.BiliJct).Result; if (result.Code == 0) { _logger.LogInformation("为“{title}”投币成功", title); return(true); } if (result.Code == -111) { string errorMsg = $"投币异常,Cookie配置项[BiliJct]错误或已过期,请检查并更新。接口返回:{result.Message}"; _logger.LogError(errorMsg); throw new Exception(errorMsg); } else { _logger.LogInformation("为“{title}”投币失败,原因:{msg}", title, result.Message); return(false); } }
/// <summary> /// 为视频投币 /// </summary> /// <param name="aid">av号</param> /// <param name="multiply">投币数量</param> /// <param name="select_like">是否同时点赞 1是0否</param> /// <returns>是否投币成功</returns> public bool DoAddCoinForVideo(string aid, int multiply, bool select_like, string title = "") { BiliApiResponse result = _dailyTaskApi.AddCoinForVideo(aid, multiply, select_like ? 1 : 0, _biliBiliCookieOptions.BiliJct).Result; if (result.Code == 0) { _expDic.TryGetValue("每日投币", out int exp); _logger.LogInformation("为“{title}”投币成功,经验+{exp} √", title, exp); return(true); } if (_donateContinueStatusDic.Any(x => x.Key == result.Code.ToString())) { _logger.LogError("尝试为“{title}”投币失败,原因:{msg}", title, result.Message); return(false); } else { string errorMsg = $"投币发生未预计异常。接口返回:{result.Message}"; _logger.LogError(errorMsg); throw new Exception(errorMsg); } }