- VideoController.cs 删除 GetAllCategories 方法(调用不存在的
dyCollectVideoService.GetAllCategoriesAsync)
- ConfigController.cs 删除 GetQrCode/GetQrStatus/BindQrCode 三个
扫码相关方法(引用已删除的 _qrCodeService)
都是 cf40a7e merge 用 -X theirs 时保留下来但无法编译的孤儿。
feature 分支上这些方法本来就不存在(新架构不含此功能)。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -405,84 +405,6 @@ namespace dy.net.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取抖音扫码登录二维码
|
||||
/// </summary>
|
||||
[HttpGet("qrcode")]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> GetQrCode()
|
||||
{
|
||||
try
|
||||
{
|
||||
var (token, qrBase64) = await _qrCodeService.GetQrCodeAsync();
|
||||
return Ok(new { code = 0, data = new { token, qrBase64 } });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Serilog.Log.Error($"获取二维码失败: {ex.Message}");
|
||||
return Ok(new { code = -1, error = "获取二维码失败:" + ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轮询扫码状态(前端每2秒调一次)
|
||||
/// status: 1=待扫码, 2=已扫码待确认, 3=登录成功, -1=已过期
|
||||
/// </summary>
|
||||
[HttpGet("qrstatus")]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> GetQrStatus([FromQuery] string token)
|
||||
{
|
||||
try
|
||||
{
|
||||
var (status, cookies, secUserId) = await _qrCodeService.CheckStatusAsync(token);
|
||||
return Ok(new { code = 0, data = new { status, hasCookies = !string.IsNullOrEmpty(cookies), secUserId } });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Serilog.Log.Error($"查询扫码状态失败: {ex.Message}");
|
||||
return Ok(new { code = -1, error = "查询失败:" + ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫码成功后,将 Cookie 绑定到指定账号
|
||||
/// </summary>
|
||||
[HttpPost("qrbind")]
|
||||
[Authorize]
|
||||
public async Task<IActionResult> BindQrCode([FromQuery] string token, [FromQuery] string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var (cookies, secUserId) = _qrCodeService.GetSessionResult(token);
|
||||
if (string.IsNullOrEmpty(cookies))
|
||||
return Ok(new { code = -1, error = "扫码尚未完成或已过期" });
|
||||
|
||||
var account = await dyCookieService.GetByIdAsync(id);
|
||||
if (account == null)
|
||||
return Ok(new { code = -1, error = "账号不存在" });
|
||||
|
||||
account.Cookies = cookies;
|
||||
if (!string.IsNullOrEmpty(secUserId))
|
||||
account.SecUserId = secUserId;
|
||||
account.Status = 1;
|
||||
|
||||
var result = await dyCookieService.UpdateAsync(account);
|
||||
_qrCodeService.RemoveSession(token);
|
||||
|
||||
if (result)
|
||||
{
|
||||
await ReStartJob();
|
||||
return Ok(new { code = 0, data = new { secUserId } });
|
||||
}
|
||||
return Ok(new { code = -1, error = "保存失败" });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Serilog.Log.Error($"绑定Cookie失败: {ex.Message}");
|
||||
return Ok(new { code = -1, error = "绑定失败:" + ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
private void ReStartJob()
|
||||
{
|
||||
var config = commonService.GetConfig();
|
||||
|
||||
@@ -37,21 +37,6 @@ namespace dy.net.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有视频类型列表(用于下拉框)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("categories")]
|
||||
public async Task<IActionResult> GetAllCategories()
|
||||
{
|
||||
var categories = await dyCollectVideoService.GetAllCategoriesAsync();
|
||||
return Ok(new
|
||||
{
|
||||
code = 0,
|
||||
data = categories
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询统计数据
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user