Skip to content

Commit

Permalink
Merge branch 'release/0.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
RayWangQvQ committed Dec 13, 2022
2 parents b4e0f8f + 2512965 commit 91c7c7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
- Fix( #260 ),在需要的时候encode cookie
- 更新文档
## 0.3.2
- Fix( #358 ),兼容老板青龙
- Fix( #358 ),获取auth时兼容老板青龙文件路径
- Fix( #364 ),兼容青龙异性response数据类型
2 changes: 1 addition & 1 deletion src/Ray.BiliBiliTool.Agent/QingLong/IQingLongApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class QingLongEnv : UpdateQingLongEnv
{
public string timestamp { get; set; }
public int status { get; set; }
public long position { get; set; }
//public long position { get; set; }
public DateTime createdAt { get; set; }
public DateTime updatedAt { get; set; }
}
Expand Down
17 changes: 10 additions & 7 deletions src/Ray.BiliBiliTool.Application/LoginTaskAppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,13 @@ protected void AddOrUpdateCkToQingLong(BiliCookie ckInfo)
return;
}

var list = re.Data.OrderBy(x => x.id);
var list = re.Data.Where(x=>x.name.StartsWith("Ray_BiliBiliCookies__"));
QingLongEnv oldEnv = list.FirstOrDefault(x => x.value.Contains(ckInfo.UserId));

if (oldEnv != null)
{
_logger.LogInformation("用户已存在,更新cookie");
_logger.LogInformation("Key:{key}", oldEnv.name);
var update = new UpdateQingLongEnv()
{
id = oldEnv.id,
Expand All @@ -244,12 +245,14 @@ protected void AddOrUpdateCkToQingLong(BiliCookie ckInfo)
}

_logger.LogInformation("用户不存在,新增cookie");
var lastNum = list.LastOrDefault()
?.name
.Split("__")
.LastOrDefault();
var newNum = int.Parse(lastNum ?? "-1") + 1;
var name = $"Ray_BiliBiliCookies__{newNum}";
var lastNum = list.Select(x =>
{
var num = x.name.Replace("Ray_BiliBiliCookies__","");
var parseSuc= int.TryParse(num, out int envNum);
return parseSuc ? envNum : 0;
}).MaxBy(x=>x);
var name = $"Ray_BiliBiliCookies__{lastNum + 1}";
_logger.LogInformation("Key:{key}", name);

var add = new AddQingLongEnv()
{
Expand Down

0 comments on commit 91c7c7c

Please sign in to comment.