From a36c815861cb6711e69244441707897c4d1e6f2e Mon Sep 17 00:00:00 2001 From: jianzhichu Date: Fri, 5 Dec 2025 08:30:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=BF=87=E6=9C=9F=E4=B8=8D?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controllers/AuthController.cs | 22 ++++++----- Controllers/ConfigController.cs | 1 + Controllers/FollowController.cs | 2 + Controllers/LogsController.cs | 38 +------------------ Controllers/VideoController.cs | 5 +-- Program.cs | 2 +- .../PublishProfiles/FolderProfile.pubxml.user | 2 +- app/src/components/switch/DayNightSwitch.vue | 2 +- app/src/router/index.ts | 2 +- app/src/store/account.ts | 2 +- app/src/store/http.ts | 30 ++++++++++----- appsettings.json | 2 +- 12 files changed, 44 insertions(+), 66 deletions(-) diff --git a/Controllers/AuthController.cs b/Controllers/AuthController.cs index 4ad34df..45643dc 100644 --- a/Controllers/AuthController.cs +++ b/Controllers/AuthController.cs @@ -18,9 +18,9 @@ namespace dy.net.Controllers private readonly IWebHostEnvironment webHostEnvironment; private readonly AdminUserService _userService; - public AuthController(AdminUserService userService, IWebHostEnvironment webHostEnvironment ) + public AuthController(AdminUserService userService, IWebHostEnvironment webHostEnvironment) { - _userService=userService; + _userService = userService; this.webHostEnvironment = webHostEnvironment; } @@ -39,13 +39,15 @@ namespace dy.net.Controllers } - - [Authorize] + /// + /// 获取头像 + /// + /// [HttpGet] public async Task GetUserAvatar() { var user = await _userService.GetUser(); - return Ok(new { code = 0, error = "", data = new { user?.Avatar, user?.Id,user?.UserName } }); + return Ok(new { code = 0, error = "", data = new { user?.Avatar, user?.Id, user?.UserName } }); } /// @@ -85,7 +87,7 @@ namespace dy.net.Controllers { Serilog.Log.Error($"delete file error ,{ex.Message}"); } - var update = await _userService.UpdateAvatar( fileName); + var update = await _userService.UpdateAvatar(fileName); return Ok(new { code = update ? 0 : -1, erro = update ? "" : "上传失败", data = update ? fileName : "" }); } @@ -136,13 +138,13 @@ namespace dy.net.Controllers } - private string GenerateJwtToken(string username) + private static string GenerateJwtToken(string username) { var claims = new[] { - new Claim(ClaimTypes.Name, username), - new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) - }; + new Claim(ClaimTypes.Name, username), + new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) + }; var k = Md5Util.JWT_TOKEN_KEY; var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(k)); var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); diff --git a/Controllers/ConfigController.cs b/Controllers/ConfigController.cs index 5649752..1bc49ed 100644 --- a/Controllers/ConfigController.cs +++ b/Controllers/ConfigController.cs @@ -15,6 +15,7 @@ namespace dy.net.Controllers { [Route("api/[controller]")] [ApiController] + [Authorize] public class ConfigController : ControllerBase { private readonly DouyinCookieService dyCookieService; diff --git a/Controllers/FollowController.cs b/Controllers/FollowController.cs index e4c3071..44c02ca 100644 --- a/Controllers/FollowController.cs +++ b/Controllers/FollowController.cs @@ -2,6 +2,7 @@ using dy.net.model; using dy.net.service; using dy.net.utils; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -9,6 +10,7 @@ namespace dy.net.Controllers { [Route("api/[controller]")] [ApiController] + [Authorize] public class FollowController : ControllerBase { private readonly DouyinFollowService _douyinFollowService; diff --git a/Controllers/LogsController.cs b/Controllers/LogsController.cs index ef274a0..cb2a0ae 100644 --- a/Controllers/LogsController.cs +++ b/Controllers/LogsController.cs @@ -1,5 +1,6 @@ using dy.net.dto; using dy.net.service; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Net.Http; @@ -37,42 +38,5 @@ namespace dy.net.Controllers //var fileContent = encoding.GetString(fileBytes); //return Content (fileContent, "text/plain", encoding); } - ///// - ///// 测试 - ///// - ///// - //[HttpGet] - //public async Task TestHttpClient() - //{ - // string count = "20"; - // string offset = "0"; - // string cookie = ""; - // bool hasmore = true; - - // { - // cookie = "gfkadpd=6383,41079; passport_csrf_token=a5da631bccfeddbc877bd4e1f72f142f; passport_csrf_token_default=a5da631bccfeddbc877bd4e1f72f142f; enter_pc_once=1; UIFID_TEMP=0e81ba593d64ebaca259bdbe302de8d7e55ac2e982f7412f10fbc5c77c64bb8b8830ffed112ea8b3bc54f3b6e2af3856daafa4efaafef18953612820da493aea7fe297beed13f9b141a7a3100c4d9aa7d1428f23d05cf5979bf209937ba9ad00da1efa59922c98942d4ce449e736ee2b; x-web-secsdk-uid=849eef8b-171b-4bd7-9cce-5752f14e53fd; douyin.com; device_web_cpu_core=32; device_web_memory_size=8; architecture=amd64; hevc_supported=true; dy_swidth=1707; dy_sheight=1067; s_v_web_id=verify_migsr5je_BJ1YiVbY_uR2U_4VXu_8Uje_GgwhVf7Y6hb8; fpk1=U2FsdGVkX19wNXQ61AQVcAXPKhYMylJU4AcD8JGkFeNZmB4mYB1XNB+bc+hU1lhq6ZruxA+I9Nwv4EeNoW414w==; fpk2=df46e1d3e7507fa3d6888a71a1894105; strategyABtestKey=%221764209447.927%22; volume_info=%7B%22isUserMute%22%3Afalse%2C%22isMute%22%3Afalse%2C%22volume%22%3A0.5%7D; xgplayer_user_id=90669686736; bd_ticket_guard_client_web_domain=2; is_dash_user=1; n_mh=Bdbeto8B8DXIgXtXZG-7Vw3HWofM6NyG-v3Wgk1pL6s; is_staff_user=false; __security_server_data_status=1; publish_badge_show_info=%220%2C0%2C0%2C1764209517482%22; UIFID=0e81ba593d64ebaca259bdbe302de8d7e55ac2e982f7412f10fbc5c77c64bb8b8830ffed112ea8b3bc54f3b6e2af3856daafa4efaafef18953612820da493aeaebdeac0537b99b8e68f343c2476cf6347f7751a87d92952128116470f147215cf46b949f43f31aedcb660fd3c5c7eb2145183cc93d1b4202205b4af7d7c69ab55e860f96e315899a2ee74a262273694ec973ba682bb6fdc351e0e66250b21cf9aef3ccaa3e0c28b085fd095e947d92a5336b9e65706d649a7b79541feab3487f; SelfTabRedDotControl=%5B%5D; xg_device_score=7.708466147936333; my_rd=2; stream_player_status_params=%22%7B%5C%22is_auto_play%5C%22%3A0%2C%5C%22is_full_screen%5C%22%3A0%2C%5C%22is_full_webscreen%5C%22%3A0%2C%5C%22is_mute%5C%22%3A0%2C%5C%22is_speed%5C%22%3A1%2C%5C%22is_visible%5C%22%3A0%7D%22; ttwid=1%7CffZO3FHfC8TRR6jdc7mfx3iFnrCqB_UuViDs3Lvj484%7C1764213923%7C12e8625d232e8a4ef61fc36807cbbf75d47e741e1e3ee82818ce82fc95612188; passport_mfa_token=Cjdg9xehkrlYj4Y1CWlAlHwJkHR2vpgE2ofiFeM3C8Zinm%2FK4vD%2BS%2Fk4k0uLAYrRsB3jJ8xoZlY6GkoKPAAAAAAAAAAAAABPwiYdUJ8TJRCoJEg7%2BU1U9xJn8%2FiVx37dL0fj0JsjXpjYp%2BFLThU1gLHtftqV3kgk4RDl0IIOGPax0WwgAiIBA3w4KGo%3D; d_ticket=b5badc9fd18022a5dd711f9f79bd33bf33b59; passport_assist_user=CkGOoW38C6tHKDGFYJ-Az5SHV8tHsa8HLiQy3uxuO_Qxf_gBNX1gwhyZd9i2pSAqGqUDpE5z3XSLYripy9Qf2KRRlRpKCjwAAAAAAAAAAAAAT8M736Jo4z6WK0kchkJMfk7WgAGu6ZEzrFSguCH7TfcT0niPHFmH_gIzWAEnmo8pqD4QmNKCDhiJr9ZUIAEiAQO-WDqX; sid_guard=a8f80e93207ab87a7128acf6da58e379%7C1764213945%7C5183999%7CMon%2C+26-Jan-2026+03%3A25%3A44+GMT; uid_tt=339c6ee64effdce094392ef399cb7ecc; uid_tt_ss=339c6ee64effdce094392ef399cb7ecc; sid_tt=a8f80e93207ab87a7128acf6da58e379; sessionid=a8f80e93207ab87a7128acf6da58e379; sessionid_ss=a8f80e93207ab87a7128acf6da58e379; session_tlb_tag=sttt%7C9%7CqPgOkyB6uHpxKKz22ljjef_________B-B1oMrODP-ItQszjCwbW8eVitD4IIGm5p5M8HZ9mUmY%3D; session_tlb_tag_bk=sttt%7C9%7CqPgOkyB6uHpxKKz22ljjef_________B-B1oMrODP-ItQszjCwbW8eVitD4IIGm5p5M8HZ9mUmY%3D; sid_ucp_v1=1.0.0-KDA1Mzc3NGFlYjkxMWVhYmYwMjRkYjFlNzlmOTExMTJjNDU4YmMwYWEKIQinwqCz24yVAhC5iZ_JBhjvMSAMMLHN7ZIGOAVA-wdIBBoCbHEiIGE4ZjgwZTkzMjA3YWI4N2E3MTI4YWNmNmRhNThlMzc5; ssid_ucp_v1=1.0.0-KDA1Mzc3NGFlYjkxMWVhYmYwMjRkYjFlNzlmOTExMTJjNDU4YmMwYWEKIQinwqCz24yVAhC5iZ_JBhjvMSAMMLHN7ZIGOAVA-wdIBBoCbHEiIGE4ZjgwZTkzMjA3YWI4N2E3MTI4YWNmNmRhNThlMzc5; login_time=1764213943926; _bd_ticket_crypt_cookie=8557ac65ef240b5ae1ef4f42fc295a33; download_guide=%223%2F20251127%2F0%22; stream_recommend_feed_params=%22%7B%5C%22cookie_enabled%5C%22%3Atrue%2C%5C%22screen_width%5C%22%3A1707%2C%5C%22screen_height%5C%22%3A1067%2C%5C%22browser_online%5C%22%3Atrue%2C%5C%22cpu_core_num%5C%22%3A32%2C%5C%22device_memory%5C%22%3A8%2C%5C%22downlink%5C%22%3A10%2C%5C%22effective_type%5C%22%3A%5C%224g%5C%22%2C%5C%22round_trip_time%5C%22%3A0%7D%22; __ac_signature=_02B4Z6wo00f01W7nUdgAAIDCMXJaFv5vWAFux1VAADKh6e; home_can_add_dy_2_desktop=%221%22; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCRmRYMTNGQjNZRC9jckpRMjRnbElqdVg3SFBINm5pSW5KSHVwczFkOWZYcTN6RG12RnZiNGxxVDhMOXkwV3dZRzZaVTJIZVZ5ZkFoMVBhRUJ6cGtGamc9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoyfQ%3D%3D; FOLLOW_NUMBER_YELLOW_POINT_INFO=%22MS4wLjABAAAAfHeXHAcMODTRd6RzfhNvGcNo9jzHveOylmtvMnmHQ6aeaM9kHHj9Oz5hffXp4TGT%2F1764259200000%2F0%2F1764220136874%2F0%22; odin_tt=edd4b1d4aae751ee0896cc364174559a12d84ce1f8b6a1da99790965bfb2bf9683312194f434f1f0b7226ff385ad0a5c3af1db88c3c746cb0e9a303dc8613b74; biz_trace_id=831e7c1c; WallpaperGuide=%7B%22showTime%22%3A1764223033231%2C%22closeTime%22%3A0%2C%22showCount%22%3A1%2C%22cursor1%22%3A8%2C%22cursor2%22%3A2%7D; FOLLOW_LIVE_POINT_INFO=%22MS4wLjABAAAAfHeXHAcMODTRd6RzfhNvGcNo9jzHveOylmtvMnmHQ6aeaM9kHHj9Oz5hffXp4TGT%2F1764259200000%2F1764217238572%2F1764223036809%2F0%22; sdk_source_info=7e276470716a68645a606960273f276364697660272927676c715a6d6069756077273f276364697660272927666d776a68605a607d71606b766c6a6b5a7666776c7571273f275e58272927666a6b766a69605a696c6061273f27636469766027292762696a6764695a7364776c6467696076273f275e582729277672715a646971273f2763646976602729277f6b5a666475273f2763646976602729276d6a6e5a6b6a716c273f2763646976602729276c6b6f5a7f6367273f27636469766027292771273f273c31333c303d35363731333234272927676c715a75776a716a666a69273f2763646976602778; bit_env=nl1wMQMlK740nH9CwNwtw9nW-axyI9dJrxf5kgYmELm5pzFHljUvSp4oQndC0NkuxnTy87qC0dvnETYah7B-A9apPsdLbcfSiM_Uut6c8ANQfqKhlvzSEI3nFSVsgT96_RHqMUfrRNUa1i6TZa917AZaz3WHrPF_5nlLzsF95CAlBpCxiI-W9wdKa5lMissqiUhAY4CRTEoGuXu2CuDqgrgI9WJ6cFngoB27EjQYAYt1k-K45Me1qCHbeJkPwuy7mA8DT9hJVrK7z3iOaw-ObHU1HL-al8AxFVAf6sfyIh_arjwxjG4ebl1wU6bkqyIYM7dgfo_Gdp-XzX8DbI5fUBGKsI7NSw9DO2rqpd4bdex4j-ZAqj4uK_KsCs4Uc1jRuMKRCps8d9AW_rc4AXPQHzI7b8-cE5GNomFe1lt4aFcnaNIAsmW77_Fax1PW3c8YeIbrjMKJ_RkJNkjs36nWTDf-W-Qt2gutul5cQXb18Isw5OBNyJM9cviGL7xJNsGLXl7gnfvgOswxAR3CvYActmevtbp3bBHQJnmFTlw_mSg%3D; gulu_source_res=eyJwX2luIjoiZjI1NzFkMzg0MDZkYWFhM2I1MGFkY2E0MjgxMDI4N2VmMDEwMDcxYjQzNTA2ZWJkY2RlOGYxZDZmMjYyZWQ0NCJ9; passport_auth_mix_state=yf0zr26dxo77w4o42cdt2f2w1ix5qz8q; __security_mc_1_s_sdk_crypt_sdk=3add21b7-4ccc-b199; __security_mc_1_s_sdk_cert_key=9e23dfb2-40a6-8498; __security_mc_1_s_sdk_sign_data_key_web_protect=a7f31503-424a-871a; bd_ticket_guard_client_data_v2=eyJyZWVfcHVibGljX2tleSI6IkJGZFgxM0ZCM1lEL2NySlEyNGdsSWp1WDdIUEg2bmlJbkpIdXBzMWQ5ZlhxM3pEbXZGdmI0bHFUOEw5eTBXd1lHNlpVMkhlVnlmQWgxUGFFQnpwa0ZqZz0iLCJ0c19zaWduIjoidHMuMi45NWViZjU5NzE3NzBkMTk3NTgxOWNhMzYyNTAzNGZhMzk3NWYyMTY2M2MwNmY0Yjk2MjZiNjhhNzgwMzEwMTJiYzRmYmU4N2QyMzE5Y2YwNTMxODYyNGNlZGExNDkxMWNhNDA2ZGVkYmViZWRkYjJlMzBmY2U4ZDRmYTAyNTc1ZCIsInJlcV9jb250ZW50Ijoic2VjX3RzIiwicmVxX3NpZ24iOiJEeElacmxmS3ROL2lzSytGRFZ3czNDaHQvTEt0L2dDazRQa0ZaMnJEVmpRPSIsInNlY190cyI6IiNjM3BLcFhDREpvczUxak9JUGw2RlMrNEtuWjllOVRGTy9KT2Qrdk1LZ3VtZk5WYm5Ob2s3QlRVNmprc2MifQ%3D%3D; IsDouyinActive=tru"; - // } - - // List followings = new List(); - // while (hasmore) - // { - // var response = await douyinHttpClientService.SyncMyFollows(count, offset, "MS4wLjABAAAAfHeXHAcMODTRd6RzfhNvGcNo9jzHveOylmtvMnmHQ6aeaM9kHHj9Oz5hffXp4TGT", cookie); - - // hasmore = response.HasMore; - - // if(response.Followings != null) - // { - // offset = response.Offset.ToString(); - // foreach (var item in response.Followings) - // { - // followings.Add(item); - // } - // } - // } - - // return Ok(followings); - //} - - } } diff --git a/Controllers/VideoController.cs b/Controllers/VideoController.cs index 9185bd0..b8dcf44 100644 --- a/Controllers/VideoController.cs +++ b/Controllers/VideoController.cs @@ -4,15 +4,12 @@ using dy.net.service; using dy.net.utils; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Formatters; -using Newtonsoft.Json; -using System.Drawing.Printing; -using System.Threading.Tasks; namespace dy.net.Controllers { [Route("api/[controller]")] [ApiController] + [Authorize] public class VideoController : ControllerBase { private readonly DouyinVideoService dyCollectVideoService; diff --git a/Program.cs b/Program.cs index bc4a4d3..d036a9d 100644 --- a/Program.cs +++ b/Program.cs @@ -197,7 +197,7 @@ ____/ _|_)_____/ _| _| \_|\____| // òƷͬ״̬Ϊδͬ commonService.UpdateAllCookieSyncedToZero(); - //if (!isDevelopment) + if (!isDevelopment) { // ʱ var quartzJobService = services.GetRequiredService(); diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user index ee66761..cb01bc6 100644 --- a/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\ - True|2025-12-04T13:58:29.4112766Z||;True|2025-12-04T21:58:10.0382218+08:00||;True|2025-12-04T21:57:55.3894059+08:00||;True|2025-12-04T21:10:38.8943797+08:00||;True|2025-12-04T21:09:31.5024569+08:00||;True|2025-12-04T08:22:47.9617427+08:00||;False|2025-12-04T08:22:41.3759733+08:00||;True|2025-12-04T08:14:02.2478893+08:00||;True|2025-12-04T07:57:00.2208139+08:00||;True|2025-12-03T23:58:13.3693303+08:00||;True|2025-12-03T23:57:40.4257893+08:00||;True|2025-12-03T23:56:38.8717769+08:00||;True|2025-12-03T23:56:24.0663568+08:00||;False|2025-12-03T23:55:36.1902974+08:00||;True|2025-12-03T23:51:30.6688504+08:00||;True|2025-12-03T23:34:17.1648971+08:00||;False|2025-12-03T23:34:07.7649161+08:00||;True|2025-12-03T22:32:56.2435003+08:00||;True|2025-12-03T22:27:45.6059666+08:00||;True|2025-12-03T15:55:28.0186597+08:00||;False|2025-12-03T15:54:17.5032724+08:00||;True|2025-12-03T15:53:10.2273509+08:00||;True|2025-12-02T22:11:37.4645042+08:00||;False|2025-12-02T22:10:47.1320259+08:00||;True|2025-12-02T14:39:58.8932130+08:00||;True|2025-12-02T14:36:37.1529072+08:00||;True|2025-12-02T12:58:22.0951548+08:00||;True|2025-12-02T09:30:33.7066474+08:00||;True|2025-12-02T09:30:14.5481844+08:00||;True|2025-12-02T09:30:00.3123364+08:00||;False|2025-12-02T09:29:54.4615520+08:00||;True|2025-12-02T09:13:01.7995414+08:00||;False|2025-12-02T09:12:55.8360281+08:00||;True|2025-12-02T09:12:31.0156791+08:00||;True|2025-12-02T08:55:11.3773395+08:00||;True|2025-12-02T08:53:21.3927713+08:00||;False|2025-12-02T08:48:55.8638037+08:00||;True|2025-12-02T07:29:25.2192447+08:00||;False|2025-12-02T07:29:10.2504665+08:00||;True|2025-12-02T07:28:29.0769286+08:00||;True|2025-12-01T21:53:07.6474834+08:00||;True|2025-12-01T21:44:28.1674315+08:00||;True|2025-12-01T21:18:47.2119609+08:00||;True|2025-12-01T20:51:19.9948301+08:00||;True|2025-12-01T20:50:36.9904697+08:00||;True|2025-12-01T20:44:10.1695142+08:00||;True|2025-12-01T19:27:58.0479456+08:00||;True|2025-12-01T19:16:02.2288214+08:00||;False|2025-12-01T19:15:56.0372115+08:00||;True|2025-12-01T19:15:16.4854821+08:00||;False|2025-12-01T19:15:06.7001019+08:00||;True|2025-12-01T17:10:38.9739466+08:00||;False|2025-12-01T17:10:18.8928139+08:00||;True|2025-12-01T17:03:59.3171589+08:00||;True|2025-12-01T17:03:12.5681656+08:00||;True|2025-12-01T16:42:51.4415025+08:00||;True|2025-12-01T01:29:59.6975567+08:00||;True|2025-12-01T01:29:45.1898652+08:00||;False|2025-12-01T01:29:33.1787721+08:00||;True|2025-12-01T01:27:33.1297605+08:00||;True|2025-12-01T01:27:27.3976862+08:00||;False|2025-12-01T01:27:20.5193052+08:00||;True|2025-12-01T01:11:11.0210582+08:00||;True|2025-12-01T01:04:04.3307782+08:00||;True|2025-12-01T00:55:49.8018864+08:00||;True|2025-12-01T00:27:25.1323561+08:00||;True|2025-11-30T23:58:20.7284116+08:00||;True|2025-11-30T23:57:58.3027622+08:00||;True|2025-11-30T23:57:43.0829614+08:00||;False|2025-11-30T23:57:33.5606716+08:00||;True|2025-11-30T23:54:29.6203368+08:00||;True|2025-11-30T23:54:27.5383120+08:00||;False|2025-11-30T23:54:17.0823982+08:00||;True|2025-11-30T22:41:11.4538820+08:00||;True|2025-11-30T22:38:19.7064566+08:00||;True|2025-11-30T22:37:35.2889186+08:00||;True|2025-11-30T21:42:31.1408314+08:00||;True|2025-11-30T21:42:19.5385333+08:00||;False|2025-11-30T21:42:13.3290237+08:00||;True|2025-11-30T21:33:28.0806806+08:00||;True|2025-11-30T21:16:56.7088027+08:00||;False|2025-11-30T21:16:46.1444944+08:00||;True|2025-11-30T20:21:24.4059664+08:00||;False|2025-11-30T20:21:17.6006098+08:00||;True|2025-11-30T20:20:08.2030141+08:00||;False|2025-11-30T20:16:12.3608968+08:00||;True|2025-11-30T20:15:35.6048313+08:00||;True|2025-11-30T19:45:18.7229552+08:00||;True|2025-11-30T19:45:08.6083368+08:00||;False|2025-11-30T19:44:54.7824905+08:00||;True|2025-11-30T19:44:17.0179491+08:00||;True|2025-11-30T19:44:06.7073484+08:00||;False|2025-11-30T19:43:58.2896556+08:00||;True|2025-11-30T19:42:08.2261927+08:00||;True|2025-11-30T19:28:15.7115077+08:00||;False|2025-11-30T19:28:10.2280725+08:00||;True|2025-11-30T19:23:31.7859158+08:00||;True|2025-11-30T19:23:20.7788277+08:00||;True|2025-11-30T19:17:11.8583296+08:00||;False|2025-11-30T19:10:41.8369574+08:00||; + True|2025-12-05T00:22:51.7343317Z||;True|2025-12-05T08:20:32.0383739+08:00||;True|2025-12-04T21:58:29.4112766+08:00||;True|2025-12-04T21:58:10.0382218+08:00||;True|2025-12-04T21:57:55.3894059+08:00||;True|2025-12-04T21:10:38.8943797+08:00||;True|2025-12-04T21:09:31.5024569+08:00||;True|2025-12-04T08:22:47.9617427+08:00||;False|2025-12-04T08:22:41.3759733+08:00||;True|2025-12-04T08:14:02.2478893+08:00||;True|2025-12-04T07:57:00.2208139+08:00||;True|2025-12-03T23:58:13.3693303+08:00||;True|2025-12-03T23:57:40.4257893+08:00||;True|2025-12-03T23:56:38.8717769+08:00||;True|2025-12-03T23:56:24.0663568+08:00||;False|2025-12-03T23:55:36.1902974+08:00||;True|2025-12-03T23:51:30.6688504+08:00||;True|2025-12-03T23:34:17.1648971+08:00||;False|2025-12-03T23:34:07.7649161+08:00||;True|2025-12-03T22:32:56.2435003+08:00||;True|2025-12-03T22:27:45.6059666+08:00||;True|2025-12-03T15:55:28.0186597+08:00||;False|2025-12-03T15:54:17.5032724+08:00||;True|2025-12-03T15:53:10.2273509+08:00||;True|2025-12-02T22:11:37.4645042+08:00||;False|2025-12-02T22:10:47.1320259+08:00||;True|2025-12-02T14:39:58.8932130+08:00||;True|2025-12-02T14:36:37.1529072+08:00||;True|2025-12-02T12:58:22.0951548+08:00||;True|2025-12-02T09:30:33.7066474+08:00||;True|2025-12-02T09:30:14.5481844+08:00||;True|2025-12-02T09:30:00.3123364+08:00||;False|2025-12-02T09:29:54.4615520+08:00||;True|2025-12-02T09:13:01.7995414+08:00||;False|2025-12-02T09:12:55.8360281+08:00||;True|2025-12-02T09:12:31.0156791+08:00||;True|2025-12-02T08:55:11.3773395+08:00||;True|2025-12-02T08:53:21.3927713+08:00||;False|2025-12-02T08:48:55.8638037+08:00||;True|2025-12-02T07:29:25.2192447+08:00||;False|2025-12-02T07:29:10.2504665+08:00||;True|2025-12-02T07:28:29.0769286+08:00||;True|2025-12-01T21:53:07.6474834+08:00||;True|2025-12-01T21:44:28.1674315+08:00||;True|2025-12-01T21:18:47.2119609+08:00||;True|2025-12-01T20:51:19.9948301+08:00||;True|2025-12-01T20:50:36.9904697+08:00||;True|2025-12-01T20:44:10.1695142+08:00||;True|2025-12-01T19:27:58.0479456+08:00||;True|2025-12-01T19:16:02.2288214+08:00||;False|2025-12-01T19:15:56.0372115+08:00||;True|2025-12-01T19:15:16.4854821+08:00||;False|2025-12-01T19:15:06.7001019+08:00||;True|2025-12-01T17:10:38.9739466+08:00||;False|2025-12-01T17:10:18.8928139+08:00||;True|2025-12-01T17:03:59.3171589+08:00||;True|2025-12-01T17:03:12.5681656+08:00||;True|2025-12-01T16:42:51.4415025+08:00||;True|2025-12-01T01:29:59.6975567+08:00||;True|2025-12-01T01:29:45.1898652+08:00||;False|2025-12-01T01:29:33.1787721+08:00||;True|2025-12-01T01:27:33.1297605+08:00||;True|2025-12-01T01:27:27.3976862+08:00||;False|2025-12-01T01:27:20.5193052+08:00||;True|2025-12-01T01:11:11.0210582+08:00||;True|2025-12-01T01:04:04.3307782+08:00||;True|2025-12-01T00:55:49.8018864+08:00||;True|2025-12-01T00:27:25.1323561+08:00||;True|2025-11-30T23:58:20.7284116+08:00||;True|2025-11-30T23:57:58.3027622+08:00||;True|2025-11-30T23:57:43.0829614+08:00||;False|2025-11-30T23:57:33.5606716+08:00||;True|2025-11-30T23:54:29.6203368+08:00||;True|2025-11-30T23:54:27.5383120+08:00||;False|2025-11-30T23:54:17.0823982+08:00||;True|2025-11-30T22:41:11.4538820+08:00||;True|2025-11-30T22:38:19.7064566+08:00||;True|2025-11-30T22:37:35.2889186+08:00||;True|2025-11-30T21:42:31.1408314+08:00||;True|2025-11-30T21:42:19.5385333+08:00||;False|2025-11-30T21:42:13.3290237+08:00||;True|2025-11-30T21:33:28.0806806+08:00||;True|2025-11-30T21:16:56.7088027+08:00||;False|2025-11-30T21:16:46.1444944+08:00||;True|2025-11-30T20:21:24.4059664+08:00||;False|2025-11-30T20:21:17.6006098+08:00||;True|2025-11-30T20:20:08.2030141+08:00||;False|2025-11-30T20:16:12.3608968+08:00||;True|2025-11-30T20:15:35.6048313+08:00||;True|2025-11-30T19:45:18.7229552+08:00||;True|2025-11-30T19:45:08.6083368+08:00||;False|2025-11-30T19:44:54.7824905+08:00||;True|2025-11-30T19:44:17.0179491+08:00||;True|2025-11-30T19:44:06.7073484+08:00||;False|2025-11-30T19:43:58.2896556+08:00||;True|2025-11-30T19:42:08.2261927+08:00||;True|2025-11-30T19:28:15.7115077+08:00||;False|2025-11-30T19:28:10.2280725+08:00||;True|2025-11-30T19:23:31.7859158+08:00||;True|2025-11-30T19:23:20.7788277+08:00||; diff --git a/app/src/components/switch/DayNightSwitch.vue b/app/src/components/switch/DayNightSwitch.vue index fed7e27..b8200ba 100644 --- a/app/src/components/switch/DayNightSwitch.vue +++ b/app/src/components/switch/DayNightSwitch.vue @@ -70,7 +70,7 @@ watch( watch( _value, (newMode) => { - console.log('mode switched to:', newMode); + // console.log('mode switched to:', newMode); if (typeof window !== 'undefined') { localStorage.setItem(STORAGE_KEY, newMode); } diff --git a/app/src/router/index.ts b/app/src/router/index.ts index e274c4c..3c39756 100644 --- a/app/src/router/index.ts +++ b/app/src/router/index.ts @@ -9,7 +9,7 @@ const router = createRouter( routes, } ); -console.log(router) +// console.log(router) // 注册导航守卫 guards.before.forEach(router.beforeEach); guards.after.forEach(router.afterEach); diff --git a/app/src/store/account.ts b/app/src/store/account.ts index 16ceea2..6fd047c 100644 --- a/app/src/store/account.ts +++ b/app/src/store/account.ts @@ -39,7 +39,7 @@ export const useAccountStore = defineStore('account', { if (response.code === 200 && response.data.code === 0) { this.logged = true; this.logged2 = true - console.log(response) + // console.log(response) http.setAuthorization(`Bearer ${response.data.token}`, response.data.expires); // await useMenuStore().getMenuList(); return response.data; diff --git a/app/src/store/http.ts b/app/src/store/http.ts index 6146868..d6be51c 100644 --- a/app/src/store/http.ts +++ b/app/src/store/http.ts @@ -3,7 +3,8 @@ import createHttp from '@/utils/axiosHttp'; import { isResponse } from '@/types'; import NProgress from 'nprogress'; import { useAccountStore } from '@/store'; - +import { message } from 'ant-design-vue'; +import router from '@/router'; // 关键:导入路由实例(路径要和实际一致) const http = createHttp({ timeout: 60000, baseURL: '/', @@ -28,21 +29,32 @@ http.interceptors.request.use((req: AxiosRequestConfig) => { http.interceptors.response.use( (rep: AxiosResponse) => { const { data } = rep; - // if (data.code != null) - // console.log(data) - // if (data.code === 401) { - // console.log(data) - // } if (isResponse(data)) { return data.code === 0 ? data : Promise.reject(data); } return Promise.reject({ message: rep.statusText, code: rep.status, data }); }, (error) => { - // console.log(error) - // debugger if (error.response.status === 401) { - useAccountStore().setLogged(false) + const accountStore = useAccountStore(); + // 1. 清除登录状态 + accountStore.setLogged(false); + // 可选:提示用户登录过期 + message.warning('登录状态已过期,请重新登录'); // 如使用Element Plus + + + setTimeout(() => { + const redirectPath = router.currentRoute.value.fullPath; + router.push({ + path: '/login', + query: { redirect: redirectPath } + }).then(() => { + console.log('跳转登录页成功'); + }).catch((err) => { + console.error('跳转登录页失败:', err); // 关键!捕获跳转失败的原因 + }); + }, 1000); + } else { if (error.response && isAxiosResponse(error.response)) { return Promise.reject({ diff --git a/appsettings.json b/appsettings.json index e5cc7af..32ee7eb 100644 --- a/appsettings.json +++ b/appsettings.json @@ -1,6 +1,6 @@ { "dbconn": "", "dbtype": "Sqlite", - "tagName": "beta_1.7.6", + "tagName": "beta_1.7.7", //"tagName": "dev_1.2" } \ No newline at end of file