新增关注博主-支持删除

This commit is contained in:
jianzhichu
2025-12-02 13:00:05 +08:00
parent de5813a874
commit 4b2f9aaa7c
12 changed files with 318 additions and 96 deletions
+6 -7
View File
@@ -21,14 +21,14 @@ namespace dy.net.Controllers
private readonly DouyinCommonService commonService; private readonly DouyinCommonService commonService;
private readonly DouyinQuartzJobService quartzJobService; 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.dyCookieService = dyCookieService;
this.commonService = commonService; this.commonService = commonService;
this.quartzJobService = quartzJobService; this.quartzJobService = quartzJobService;
this.httpClientFactory = httpClientFactory; this.douyinFollowService = douyinFollowService;
} }
@@ -65,9 +65,8 @@ namespace dy.net.Controllers
[HttpGet("list")] [HttpGet("list")]
public async Task<IActionResult> GetAllList() public async Task<IActionResult> GetAllList()
{ {
var list = await dyCookieService.GetAllOpendAsync(); var follows= await douyinFollowService.GetGroupByCookieAsync();
var result = list.Select(x => new { key= x.MyUserId, name= x.UserName }); return Ok(new { code = 0, data = follows });
return Ok(new { code = 0, data = result });
} }
/// <summary> /// <summary>
/// 新增用户Cookie /// 新增用户Cookie
@@ -150,7 +149,7 @@ namespace dy.net.Controllers
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("ExecuteJobNow")] [HttpGet("ExecuteJobNow")]
[Authorize] //[Authorize]
public async Task<IActionResult> ExecuteJobNow() public async Task<IActionResult> ExecuteJobNow()
{ {
var config = commonService.GetConfig(); var config = commonService.GetConfig();
+9 -32
View File
@@ -93,17 +93,16 @@ namespace dy.net.Controllers
}); });
} }
if (dto.SavePath.Length > 10) if (dto.SavePath.Length > 15)
{ {
return Ok(new return Ok(new
{ {
code = -1, code = -1,
msg = "请输入有效文件夹名称(最长10" msg = "请输入有效文件夹名称(最长15"
}); });
} }
} }
} }
var result= await _douyinFollowService.OpenOrCloseSync(dto); var result= await _douyinFollowService.OpenOrCloseSync(dto);
return Ok(new return Ok(new
{ {
@@ -120,37 +119,15 @@ namespace dy.net.Controllers
[HttpPost("openOrCloseFullSync")] [HttpPost("openOrCloseFullSync")]
public async Task<IActionResult> OpenOrCloseFullSync(FollowUpdateDto dto) 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) [HttpPost("delete")]
{ public async Task<IActionResult> DeleteFollow(FollowUpdateDto dto)
return Ok(new {
{ var result= await _douyinFollowService.DeleteFollow(dto);
code = -1, return Ok(new { code = result ? 0 : -1, data = result });
msg = "请输入有效文件夹名称(最长10)"
});
}
}
}
var result = await _douyinFollowService.OpenOrCloseFullSync(dto);
return Ok(new
{
code = result ? 0 : -1,
data = result
});
} }
} }
} }
@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl> <_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl>
<History>True|2025-12-02T01:13:01.7995414Z||;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-11-30T19:02:08.8184758+08:00||;False|2025-11-30T19:01:59.4711045+08:00||;True|2025-11-30T18:16:01.8372242+08:00||;True|2025-11-30T14:50:31.9356543+08:00||;True|2025-11-30T14:48:27.1833064+08:00||;True|2025-11-30T02:06:06.6099669+08:00||;True|2025-11-30T01:49:46.4358206+08:00||;False|2025-11-30T01:49:34.4884036+08:00||;True|2025-11-30T01:43:41.1028753+08:00||;True|2025-11-30T01:38:18.2856609+08:00||;True|2025-11-30T01:23:02.4378259+08:00||;True|2025-11-30T01:08:29.4041159+08:00||;True|2025-11-30T00:56:33.4172007+08:00||;False|2025-11-30T00:56:21.2777389+08:00||;True|2025-11-27T13:37:08.6884390+08:00||;False|2025-11-27T13:36:54.2595622+08:00||;True|2025-11-27T11:03:33.8401644+08:00||;False|2025-11-27T11:02:48.8942827+08:00||;True|2025-11-26T23:48:02.3957186+08:00||;True|2025-11-26T23:43:06.8154188+08:00||;False|2025-11-26T23:42:05.9191485+08:00||;True|2025-11-26T23:30:11.1295861+08:00||;True|2025-11-26T00:00:42.1507258+08:00||;True|2025-11-26T00:00:17.0107229+08:00||;True|2025-11-25T23:42:07.4349629+08:00||;False|2025-11-25T23:41:56.9328658+08:00||;True|2025-11-25T23:19:32.5262917+08:00||;True|2025-11-25T14:08:53.3850967+08:00||;True|2025-11-24T23:53:54.4283003+08:00||;True|2025-11-24T23:41:15.8248332+08:00||;True|2025-11-24T23:33:57.1844427+08:00||;</History> <History>True|2025-12-02T04:58:22.0951548Z||;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-11-30T19:02:08.8184758+08:00||;False|2025-11-30T19:01:59.4711045+08:00||;True|2025-11-30T18:16:01.8372242+08:00||;True|2025-11-30T14:50:31.9356543+08:00||;True|2025-11-30T14:48:27.1833064+08:00||;True|2025-11-30T02:06:06.6099669+08:00||;True|2025-11-30T01:49:46.4358206+08:00||;False|2025-11-30T01:49:34.4884036+08:00||;True|2025-11-30T01:43:41.1028753+08:00||;True|2025-11-30T01:38:18.2856609+08:00||;True|2025-11-30T01:23:02.4378259+08:00||;True|2025-11-30T01:08:29.4041159+08:00||;True|2025-11-30T00:56:33.4172007+08:00||;False|2025-11-30T00:56:21.2777389+08:00||;True|2025-11-27T13:37:08.6884390+08:00||;False|2025-11-27T13:36:54.2595622+08:00||;True|2025-11-27T11:03:33.8401644+08:00||;False|2025-11-27T11:02:48.8942827+08:00||;True|2025-11-26T23:48:02.3957186+08:00||;True|2025-11-26T23:43:06.8154188+08:00||;False|2025-11-26T23:42:05.9191485+08:00||;True|2025-11-26T23:30:11.1295861+08:00||;True|2025-11-26T00:00:42.1507258+08:00||;True|2025-11-26T00:00:17.0107229+08:00||;True|2025-11-25T23:42:07.4349629+08:00||;False|2025-11-25T23:41:56.9328658+08:00||;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+4 -4
View File
@@ -93,8 +93,8 @@ Cookie 及 `sec_user_id` 是同步功能的核心,需严格按步骤获取,
| 镜像标签 | 架构 | | 镜像标签 | 架构 |
| ----------------- | -------------- | | ----------------- | -------------- |
| `beta_1.7.0` | x86_64 (amd64) | | `beta_1.7.1` | x86_64 (amd64) |
| `arm_1.7.0` | ARM64 | | `arm_1.7.1` | ARM64 |
### 最新镜像查看 ### 最新镜像查看
[镜像列表](http://nas.synology2023.online:10108/api/docker/dysync/1) [镜像列表](http://nas.synology2023.online:10108/api/docker/dysync/1)
@@ -112,7 +112,7 @@ docker run -d --restart=always \
-v /opt/dysync/uper:/app/uper \ -v /opt/dysync/uper:/app/uper \
-p 10103:10101 \ -p 10103:10101 \
--name dysync2025 \ --name dysync2025 \
ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_1.7.0 ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_1.7.1
# 注意:-p 后面的容器端口,可以用环境变量类似:ASPNETCORE_URLS = http://+:10108 指定 # 注意:-p 后面的容器端口,可以用环境变量类似:ASPNETCORE_URLS = http://+:10108 指定
``` ```
@@ -126,7 +126,7 @@ version: '3.8'
services: services:
dysync: dysync:
image: ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_1.7.0 image: ccr.ccs.tencentyun.com/jianzhichu/dysync:beta_1.7.1
container_name: dysync2025 # 容器名称 container_name: dysync2025 # 容器名称
restart: unless-stopped # 始终重启容器,除非容器被手动停止或Docker服务停止 restart: unless-stopped # 始终重启容器,除非容器被手动停止或Docker服务停止
ports: ports:
+237 -43
View File
@@ -31,11 +31,17 @@
</div> </div>
<!-- 卡片列表区域 --> <!-- 卡片列表区域 -->
<div class="card-list-container" @scroll="handleScroll"> <div class="card-list-container" @scroll="handleScroll">
<a-card v-for="(item, index) in currentTabData" :key="item.id" :data-key="item.id" class="custom-card" :bordered="true" :hoverable="true"> <a-card v-for="(item, index) in currentTabData" :key="item.id" :data-key="item.id" class="custom-card" :bordered="true" :hoverable="true" :class="{ 'no-followed-card': item.isNoFollowed }">
<div class="card-inner"> <div class="card-inner">
<!-- 非关注标记 -->
<!-- <div v-if="item.isNoFollowed" class="no-followed-tag">
非关注
</div> -->
<div class="card-switch"> <div class="card-switch">
<a-switch v-model:checked="item.openSync" @change="(checked) => handleSwitchChange(item, checked)" checked-children="" un-checked-children="" /> <a-switch v-model:checked="item.openSync" @change="(checked) => handleSwitchChange(item, checked)" checked-children="" un-checked-children="" />
</div> </div>
<div class="card-main-content"> <div class="card-main-content">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<a-avatar shape="circle" size="large" :src="item.uperAvatar" v-if="item.uperAvatar" /> <a-avatar shape="circle" size="large" :src="item.uperAvatar" v-if="item.uperAvatar" />
@@ -44,12 +50,20 @@
</a-avatar> </a-avatar>
</div> </div>
<div class="card-content"> <div class="card-content">
<div class="card-name">{{ item.uperName }}</div> <div class="card-name">
{{ item.uperName }}
<!-- 非关注小标记 -->
<span v-if="item.isNoFollowed" class="no-followed-badge">非关注</span>
<!-- 删除按钮仅非关注项显示放在名字+非关注后面 -->
<a-button v-if="item.isNoFollowed" type="text" class="delete-btn" @click="(e) => { e.stopPropagation(); handleDeleteItem(item); }" :disabled="item.isSaving" title="删除该非关注博主">
<DeleteOutlined />
</a-button>
</div>
<!-- 签名多行显示高度控制 + 溢出截断 + Tooltip气泡 --> <!-- 签名多行显示高度控制 + 溢出截断 + Tooltip气泡 -->
<div class="card-desc"> <div class="card-desc">
<a-tooltip placement="top" :title="item.signature || '无签名'"> <a-tooltip placement="top" :title="item.signature || '无签名'">
<span class="signature-text"> <span class="signature-text">
{{ item.signature || '无签名' }} {{ truncateText(item.signature || '无签名', 30) }}
</span> </span>
</a-tooltip> </a-tooltip>
</div> </div>
@@ -71,7 +85,7 @@
</template> </template>
<template v-else> <template v-else>
<span class="path-text" :class="{ 'path-empty': !item.savePath }"> <span class="path-text" :class="{ 'path-empty': !item.savePath }">
{{ item.savePath || '默认用作者名字' }} {{ item.savePath || '默认用博主名字' }}
</span> </span>
<!-- 编辑按钮禁用item.isSaving true --> <!-- 编辑按钮禁用item.isSaving true -->
<a-button type="text" class="edit-btn" @click="() => handleEditPath(item)" title="编辑文件夹名称" :disabled="item.isSaving"> <a-button type="text" class="edit-btn" @click="() => handleEditPath(item)" title="编辑文件夹名称" :disabled="item.isSaving">
@@ -137,8 +151,17 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted, UnwrapRef, reactive, nextTick, Ref } from 'vue'; import { ref, computed, onMounted, onUnmounted, UnwrapRef, reactive, nextTick, Ref } from 'vue';
import { message, Spin, Empty, Tooltip, Modal, Form, FormInstance } from 'ant-design-vue'; import { message, Spin, Empty, Tooltip, Modal, Form, FormInstance, Popconfirm } from 'ant-design-vue';
import { useApiStore } from '@/store'; import { useApiStore } from '@/store';
import {
CloseOutlined,
SearchOutlined,
PlusOutlined,
SyncOutlined,
SaveOutlined,
EditOutlined,
DeleteOutlined,
} from '@ant-design/icons-vue';
// 类型定义 // 类型定义
interface TabItem { interface TabItem {
@@ -159,7 +182,8 @@ interface FollowItem {
savePath?: string; savePath?: string;
isEditing: boolean; isEditing: boolean;
isSaving?: boolean; isSaving?: boolean;
userId?: string; // 新增:UserId字段 uperId?: string; // 原userId改为uperId
isNoFollowed: boolean; // 新增:是否为非关注博主
} }
interface QuaryParam { interface QuaryParam {
@@ -241,7 +265,7 @@ const quaryData: UnwrapRef<QuaryParam> = reactive({
// 生命周期 - 挂载时初始化 // 生命周期 - 挂载时初始化
onMounted(() => { onMounted(() => {
quaryData.pageIndex = 0; quaryData.pageIndex = 0;
GetCookies(); initData();
}); });
// 生命周期 - 卸载时移除滚动监听 // 生命周期 - 卸载时移除滚动监听
@@ -252,23 +276,38 @@ onUnmounted(() => {
} }
}); });
// 获取Cookie列表(Tab数据 // 初始化数据(统一入口,避免循环
const GetCookies = () => { const initData = () => {
useApiStore() GetCookies().then(() => {
.CookieList() // Cookie获取成功后,直接加载当前Tab数据
.then((res) => { if (activeTabKey.value) {
if (res.code === 0) { quaryData.mySelfId = activeTabKey.value;
const tabs = (res.data || [{ key: 'tab1', name: '部门一' }]).map((tab) => ({ GetFollows(true);
...tab, }
total: 0, });
})); };
tabList.value = tabs;
activeTabKey.value = tabList.value[0]?.key || ''; // 获取Cookie列表(Tab数据)- 移除循环调用
quaryData.mySelfId = activeTabKey.value; const GetCookies = (): Promise<void> => {
GetFollows(true); return new Promise((resolve) => {
handleTabChange(activeTabKey.value); useApiStore()
} .CookieList()
}); .then((res) => {
if (res.code === 0) {
tabList.value = res.data;
// 设置默认选中第一个Tab
if (tabList.value.length > 0 && !activeTabKey.value) {
activeTabKey.value = tabList.value[0].key;
}
}
resolve();
})
.catch((err) => {
console.error('获取Tab数据失败:', err);
message.error('获取Tab数据失败,请刷新重试');
resolve();
});
});
}; };
// 获取关注用户列表 // 获取关注用户列表
@@ -284,12 +323,13 @@ const GetFollows = (isReset = false) => {
const newData = res.data.data || []; const newData = res.data.data || [];
const total = res.data.total || 0; const total = res.data.total || 0;
// 格式化数据 // 格式化数据 - 确保isNoFollowed有默认值
const formattedData = newData.map((item) => ({ const formattedData = newData.map((item) => ({
...item, ...item,
isSaving: false, isSaving: false,
isEditing: item.isEditing ?? false, isEditing: item.isEditing ?? false,
userId: item.userId || item.id, // 兼容旧数据,优先使用userId字段 uperId: item.uperId || item.id, // 兼容旧数据,优先使用uperId字段(原userId
isNoFollowed: item.isNoFollowed ?? false, // 新增字段默认值为false
})); }));
// 更新当前Tab的总数 // 更新当前Tab的总数
@@ -362,8 +402,10 @@ const handleSearch = () => {
GetFollows(true); GetFollows(true);
}; };
// Tab切换 // Tab切换 - 只在用户主动切换时触发,不再调用GetCookies
const handleTabChange = (key: string) => { const handleTabChange = (key: string) => {
if (activeTabKey.value === key) return; // 避免重复切换同一Tab
activeTabKey.value = key; activeTabKey.value = key;
quaryData.mySelfId = key; quaryData.mySelfId = key;
quaryData.pageIndex = 0; quaryData.pageIndex = 0;
@@ -371,6 +413,8 @@ const handleTabChange = (key: string) => {
hasMore.value = true; hasMore.value = true;
searchInputVisible.value = false; searchInputVisible.value = false;
quaryData.followUserName = null; quaryData.followUserName = null;
// 直接加载当前Tab数据,不再调用GetCookies
GetFollows(true); GetFollows(true);
}; };
@@ -432,7 +476,7 @@ const uploadSyncStatus = (item: FollowItem) => {
OpenSync: item.openSync, OpenSync: item.openSync,
FullSync: item.fullSync, FullSync: item.fullSync,
SavePath: item.savePath, SavePath: item.savePath,
UserId: item.userId, // 新增:传递UserId uperId: item.uperId, // 原userId改为uperId
}) })
.then((res) => { .then((res) => {
if (res.code === 0) { if (res.code === 0) {
@@ -477,6 +521,16 @@ const handleSyncAll = () => {
}); });
}; };
// 工具函数:文本截断,超过指定长度显示省略号
const truncateText = (text: string, maxLength: number): string => {
if (!text) return '';
// 计算字符串长度(中文算1个字符)
if (text.length <= maxLength) {
return text;
}
return text.slice(0, maxLength) + '...';
};
// ===================== 新增功能相关 ===================== // ===================== 新增功能相关 =====================
// 打开新增弹窗 // 打开新增弹窗
const handleAdd = () => { const handleAdd = () => {
@@ -535,6 +589,7 @@ const handleAddSubmit = () => {
signature: '', // 默认为空签名 signature: '', // 默认为空签名
uperAvatar: '', // 默认为空头像 uperAvatar: '', // 默认为空头像
enterprise: '', // 默认为空企业信息 enterprise: '', // 默认为空企业信息
isNoFollowed: true, // 新增的非关注博主,标记为true
}; };
// 调用新增接口 // 调用新增接口
@@ -574,6 +629,44 @@ const handleAddSubmit = () => {
}); });
}); });
}; };
// ===================== 删除功能相关 =====================
// 删除非关注博主
const handleDeleteItem = (item: FollowItem) => {
Modal.confirm({
title: '确认删除',
content: `确定要删除非关注博主「${item.uperName}」吗?删除后将无法恢复。`,
okText: '确认删除',
cancelText: '取消',
okType: 'danger',
maskClosable: false,
onOk: () => {
return new Promise((resolve, reject) => {
useApiStore()
.DelFollow({
id: item.id,
mySelfId: item.mySelfId,
uperId: item.uperId,
})
.then((res) => {
if (res.code === 0) {
message.success('删除成功!');
initData();
resolve(true);
} else {
message.error('删除失败:' + (res.msg || '未知错误'));
reject(false);
}
})
.catch((err) => {
console.error('删除非关注博主异常:', err);
message.error('网络异常,请重试');
reject(false);
});
});
},
});
};
</script> </script>
<style scoped> <style scoped>
@@ -689,6 +782,8 @@ const handleAddSubmit = () => {
display: flex !important; display: flex !important;
flex-direction: column !important; flex-direction: column !important;
background: transparent !important; background: transparent !important;
position: relative; /* 为非关注标记定位 */
/* 移除之前为右下角按钮预留的底部padding */
} }
.custom-card:hover { .custom-card:hover {
@@ -696,9 +791,76 @@ const handleAddSubmit = () => {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
} }
/* 非关注卡片特殊样式 */
.no-followed-card {
border: 1px solid #feb2b2 !important;
background-color: #fef7fb !important;
}
.no-followed-card:hover {
border-color: #fc8181 !important;
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.08) !important;
}
/* 非关注标记 */
.no-followed-tag {
position: absolute;
top: 12px;
left: 12px;
background-color: #ef4444;
color: white;
font-size: 11px;
padding: 2px 8px;
border-radius: 12px;
font-weight: 500;
z-index: 10;
}
/* 非关注小徽章 */
.no-followed-badge {
display: inline-block;
background-color: #fee2e2;
color: #dc2626;
font-size: 11px;
padding: 1px 6px;
border-radius: 4px;
margin-left: 8px;
vertical-align: middle;
}
/* 删除按钮(放在名字+非关注后面) */
.delete-btn {
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
margin-left: 8px !important;
padding: 4px !important;
height: 24px !important;
width: 24px !important;
color: #ef4444 !important;
border-radius: 4px !important;
transition: all 0.2s ease;
vertical-align: middle;
}
.delete-btn:hover {
color: #dc2626 !important;
background-color: #fee2e2 !important;
}
.delete-btn:disabled {
color: #fca5a5 !important;
cursor: not-allowed;
background-color: transparent !important;
}
.delete-btn .anticon {
font-size: 14px !important;
}
.card-inner { .card-inner {
position: relative; position: relative;
padding: 5px !important; padding: 0px 16px !important;
flex: 1 !important; flex: 1 !important;
display: flex !important; display: flex !important;
flex-direction: column !important; flex-direction: column !important;
@@ -706,7 +868,7 @@ const handleAddSubmit = () => {
.card-switch { .card-switch {
position: absolute !important; position: absolute !important;
top: 12px; top: 16px;
right: 16px; right: 16px;
z-index: 10; z-index: 10;
} }
@@ -751,6 +913,9 @@ const handleAddSubmit = () => {
font-weight: 600; font-weight: 600;
color: #1d2129; color: #1d2129;
line-height: 1.4; line-height: 1.4;
display: flex;
align-items: center;
flex-wrap: wrap;
} }
.card-desc { .card-desc {
@@ -990,6 +1155,17 @@ const handleAddSubmit = () => {
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
} }
/* 移动端删除按钮调整 */
.delete-btn {
margin-left: 6px !important;
height: 22px !important;
width: 22px !important;
}
.delete-btn .anticon {
font-size: 13px !important;
}
.form-switch-group { .form-switch-group {
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
@@ -1009,14 +1185,6 @@ html.dark-mode .dept-user-card-container .custom-card:hover {
border-color: #6366f1 !important; border-color: #6366f1 !important;
} }
html.dark-mode .dept-user-card-container .ant-card-bordered {
border-color: #374151 !important;
}
html.dark-mode .dept-user-card-container .ant-card-bordered:hover {
border-color: #6366f1 !important;
}
html.dark-mode .dept-user-card-container .card-name { html.dark-mode .dept-user-card-container .card-name {
color: #f3f4f6 !important; color: #f3f4f6 !important;
} }
@@ -1037,11 +1205,6 @@ html.dark-mode .dept-user-card-container .sync-label {
color: #9ca3af !important; color: #9ca3af !important;
} }
html.dark-mode .dept-user-card-container .loading-text,
html.dark-mode .dept-user-card-container .no-more-container span {
color: #9ca3af !important;
}
html.dark-mode .dept-user-card-container .sync-btn { html.dark-mode .dept-user-card-container .sync-btn {
color: #d1d5db !important; color: #d1d5db !important;
border-color: #4b5563 !important; border-color: #4b5563 !important;
@@ -1057,6 +1220,37 @@ html.dark-mode .switch-label {
color: #d1d5db !important; color: #d1d5db !important;
} }
/* 黑暗模式下非关注卡片样式 */
html.dark-mode .no-followed-card {
border-color: #7f1d1d !important;
background-color: transparent !important;
/* background-color: #2b0707 !important; */
}
html.dark-mode .no-followed-card:hover {
border-color: #991b1b !important;
box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15) !important;
}
html.dark-mode .no-followed-tag {
background-color: #dc2626 !important;
color: #fef2f2 !important;
}
html.dark-mode .no-followed-badge {
background-color: #7f1d1d !important;
color: #fecaca !important;
}
html.dark-mode .delete-btn {
color: #fecaca !important;
}
html.dark-mode .delete-btn:hover {
color: #fee2e2 !important;
background-color: #7f1d1d !important;
}
/* 精准控制uperId表单项的间距 */ /* 精准控制uperId表单项的间距 */
.uper-id-form-item { .uper-id-form-item {
--ant-form-item-extra-margin-top: 4px !important; /* 核心:减小extra与input的间距(默认12px */ --ant-form-item-extra-margin-top: 4px !important; /* 核心:减小extra与input的间距(默认12px */
+9
View File
@@ -229,8 +229,17 @@ export const useApiStore = defineStore('coreapi', () => {
}); });
} }
//删除非关注的博主
async function DelFollow(param: object) {
return http.request<any, Response<any>>('/api/follow/delete', 'post_json', param).then(r => {
return r.data;
}).finally(() => {
});
}
return { return {
DelFollow,
AddFollow, AddFollow,
CheckTag, CheckTag,
deleteCookie, deleteCookie,
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"dbconn": "", "dbconn": "",
"dbtype": "Sqlite", "dbtype": "Sqlite",
"tagName": "beta_1.7.0" "tagName": "beta_1.7.1"
} }
+15
View File
@@ -0,0 +1,15 @@
namespace dy.net.dto
{
public class DouyinFollowGroupDto
{
/// <summary>
/// MyUserId
/// </summary>
public string Key { get; set; }
public int Total { get; set; }
public string Name { get; set; }
}
}
+2
View File
@@ -47,5 +47,7 @@ namespace dy.net.dto
public string SavePath { get; set; } public string SavePath { get; set; }
public string UperId { get; set; }
} }
} }
+3 -1
View File
@@ -30,7 +30,9 @@ namespace dy.net.model
/// </summary> /// </summary>
[SugarColumn(Length =255,IsNullable =true)] [SugarColumn(Length =255,IsNullable =true)]
public string SavePath { get; set; } public string SavePath { get; set; }
/// <summary>
/// 1 开启同步 0 关闭同步
/// </summary>
public int Status { get; set; } public int Status { get; set; }
/// <summary> /// <summary>
+16
View File
@@ -14,6 +14,22 @@ namespace dy.net.repository
} }
public async Task<List<DouyinFollowGroupDto>> GetDouyinFollowGroup()
{
var data = this.Db.Queryable<DouyinFollowed>()
.LeftJoin<DouyinCookie>((f, u) => f.mySelfId == u.MyUserId)
.Where((f, u) => u.Status == 1) // 注意:LeftJoin+u.Status==1 等价于 InnerJoinu必须存在)
.GroupBy((f, u) => f.mySelfId) // 按 mySelfId 分组
.Select((f, u) => new DouyinFollowGroupDto
{
Key = f.mySelfId, // 分组键(mySelfId
Name = u.UserName, // 取每组的 UserName(因分组唯一,用 First() 兼容 SQL
Total = SqlFunc.AggregateCount(f.Id) // 统计每组的记录数(用主表主键避免 null 影响)
})
.ToList(); // 执行查询
return data;
}
/// <summary> /// <summary>
/// 分页查询收藏视频 /// 分页查询收藏视频
+15 -7
View File
@@ -17,6 +17,13 @@ namespace dy.net.service
_followRepository = followRepository; _followRepository = followRepository;
} }
public async Task<List<DouyinFollowGroupDto>> GetGroupByCookieAsync()
{
return await _followRepository.GetDouyinFollowGroup();
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -79,6 +86,13 @@ namespace dy.net.service
} }
public async Task<bool> DeleteFollow(FollowUpdateDto dto)
{
return await _followRepository.DeleteByIdAsync(dto.Id);
}
/// <summary> /// <summary>
/// 打开或关闭同步 /// 打开或关闭同步
/// </summary> /// </summary>
@@ -86,13 +100,7 @@ namespace dy.net.service
/// <returns></returns> /// <returns></returns>
public async Task<bool> OpenOrCloseFullSync(FollowUpdateDto dto) public async Task<bool> OpenOrCloseFullSync(FollowUpdateDto dto)
{ {
var followed = await _followRepository.GetByIdAsync(dto.Id); return await OpenOrCloseSync(dto);
if (followed != null)
{
followed.FullSync = dto.FullSync;
return await _followRepository.Update(followed);
}
return false;
} }
/// <summary> /// <summary>