新增关注博主-支持删除
This commit is contained in:
@@ -21,14 +21,14 @@ namespace dy.net.Controllers
|
||||
|
||||
private readonly DouyinCommonService commonService;
|
||||
private readonly DouyinQuartzJobService quartzJobService;
|
||||
private readonly IHttpClientFactory httpClientFactory;
|
||||
private readonly DouyinFollowService douyinFollowService;
|
||||
|
||||
public ConfigController(DouyinCookieService dyCookieService, DouyinCommonService commonService,DouyinQuartzJobService quartzJobService,IHttpClientFactory httpClientFactory)
|
||||
public ConfigController(DouyinCookieService dyCookieService, DouyinCommonService commonService, DouyinQuartzJobService quartzJobService, DouyinFollowService douyinFollowService)
|
||||
{
|
||||
this.dyCookieService = dyCookieService;
|
||||
this.commonService = commonService;
|
||||
this.quartzJobService = quartzJobService;
|
||||
this.httpClientFactory = httpClientFactory;
|
||||
this.douyinFollowService = douyinFollowService;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +65,8 @@ namespace dy.net.Controllers
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetAllList()
|
||||
{
|
||||
var list = await dyCookieService.GetAllOpendAsync();
|
||||
var result = list.Select(x => new { key= x.MyUserId, name= x.UserName });
|
||||
return Ok(new { code = 0, data = result });
|
||||
var follows= await douyinFollowService.GetGroupByCookieAsync();
|
||||
return Ok(new { code = 0, data = follows });
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增用户Cookie
|
||||
@@ -150,7 +149,7 @@ namespace dy.net.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ExecuteJobNow")]
|
||||
[Authorize]
|
||||
//[Authorize]
|
||||
public async Task<IActionResult> ExecuteJobNow()
|
||||
{
|
||||
var config = commonService.GetConfig();
|
||||
|
||||
@@ -93,17 +93,16 @@ namespace dy.net.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
if (dto.SavePath.Length > 10)
|
||||
if (dto.SavePath.Length > 15)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
code = -1,
|
||||
msg = "请输入有效文件夹名称(最长10)"
|
||||
msg = "请输入有效文件夹名称(最长15)"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result= await _douyinFollowService.OpenOrCloseSync(dto);
|
||||
return Ok(new
|
||||
{
|
||||
@@ -120,37 +119,15 @@ namespace dy.net.Controllers
|
||||
[HttpPost("openOrCloseFullSync")]
|
||||
public async Task<IActionResult> OpenOrCloseFullSync(FollowUpdateDto dto)
|
||||
{
|
||||
return await OpenOrCloseSync(dto);
|
||||
}
|
||||
|
||||
if (dto.FullSync)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(dto.SavePath))
|
||||
{
|
||||
if (!DouyinFileNameHelper.IsValidWithoutSpecialChars(dto.SavePath))
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
code = -1,
|
||||
msg = "请输入有效文件夹名称(字母数字中文简体)"
|
||||
});
|
||||
}
|
||||
|
||||
if (dto.SavePath.Length > 10)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
code = -1,
|
||||
msg = "请输入有效文件夹名称(最长10)"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = await _douyinFollowService.OpenOrCloseFullSync(dto);
|
||||
return Ok(new
|
||||
{
|
||||
code = result ? 0 : -1,
|
||||
data = result
|
||||
});
|
||||
[HttpPost("delete")]
|
||||
public async Task<IActionResult> DeleteFollow(FollowUpdateDto dto)
|
||||
{
|
||||
var result= await _douyinFollowService.DeleteFollow(dto);
|
||||
return Ok(new { code = result ? 0 : -1, data = result });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user