diff --git a/Controllers/ConfigController.cs b/Controllers/ConfigController.cs index 05888f9..f794573 100644 --- a/Controllers/ConfigController.cs +++ b/Controllers/ConfigController.cs @@ -405,84 +405,6 @@ namespace dy.net.Controllers } - /// - /// 获取抖音扫码登录二维码 - /// - [HttpGet("qrcode")] - [Authorize] - public async Task 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 }); - } - } - - /// - /// 轮询扫码状态(前端每2秒调一次) - /// status: 1=待扫码, 2=已扫码待确认, 3=登录成功, -1=已过期 - /// - [HttpGet("qrstatus")] - [Authorize] - public async Task 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 }); - } - } - - /// - /// 扫码成功后,将 Cookie 绑定到指定账号 - /// - [HttpPost("qrbind")] - [Authorize] - public async Task 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(); diff --git a/Controllers/VideoController.cs b/Controllers/VideoController.cs index dbc9db5..72c5593 100644 --- a/Controllers/VideoController.cs +++ b/Controllers/VideoController.cs @@ -36,21 +36,6 @@ namespace dy.net.Controllers pageSize = dto.PageSize }); } - - /// - /// 获取所有视频类型列表(用于下拉框) - /// - /// - [HttpGet("categories")] - public async Task GetAllCategories() - { - var categories = await dyCollectVideoService.GetAllCategoriesAsync(); - return Ok(new - { - code = 0, - data = categories - }); - } /// /// 查询统计数据