修复up主视频不下载图文视频
优化ffmpeg命令
This commit is contained in:
+5
-2
@@ -5,6 +5,9 @@ WORKDIR /app
|
||||
EXPOSE 10101
|
||||
|
||||
COPY . .
|
||||
ENV ASPNETCORE_URLS http://*:10101
|
||||
|
||||
ENV ASPNETCORE_URLS=http://*:10101
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV DOWN_IMGVIDEO=0
|
||||
ENTRYPOINT ["dotnet", "dy.net.dll"]
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal-arm64v8 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 10101
|
||||
|
||||
RUN echo "deb http://mirrors.aliyun.com/debian/ bookworm main non-free contrib" > /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian-security/ bookworm-security main" >> /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free contrib" >> /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian/ bookworm-backports main non-free contrib" >> /etc/apt/sources.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends ffmpeg && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN ffmpeg -version
|
||||
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV ASPNETCORE_URLS=http://*:10101
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV DOWN_IMGVIDEO=1
|
||||
ENTRYPOINT ["dotnet", "dy.net.dll"]
|
||||
|
||||
+5
-3
@@ -5,7 +5,9 @@ WORKDIR /app
|
||||
EXPOSE 10101
|
||||
|
||||
COPY . .
|
||||
ENV ASPNETCORE_URLS http://*:10101
|
||||
ENTRYPOINT ["dotnet", "dy.net.dll"]
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV DOWN_IMGVIDEO=1
|
||||
ENV DOWN_IMGVIDEO=0
|
||||
ENV ASPNETCORE_URLS=http://*:10101
|
||||
ENTRYPOINT ["dotnet", "dy.net.dll"]
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 10102
|
||||
EXPOSE 10101
|
||||
|
||||
|
||||
RUN echo "deb http://mirrors.aliyun.com/debian/ bookworm main non-free contrib" > /etc/apt/sources.list && \
|
||||
@@ -16,7 +16,7 @@ RUN echo "deb http://mirrors.aliyun.com/debian/ bookworm main non-free contrib"
|
||||
RUN ffmpeg -version
|
||||
|
||||
COPY . .
|
||||
ENV ASPNETCORE_URLS=http://*:10102
|
||||
ENV ASPNETCORE_URLS=http://*:10101
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV DOWN_IMGVIDEO=1
|
||||
ENTRYPOINT ["dotnet", "dy.net.dll"]
|
||||
|
||||
@@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>E:\code\dysync\bin\Release\net6.0\publish\</_PublishTargetUrl>
|
||||
<History>True|2025-11-24T00:17:50.3994607Z||;True|2025-11-24T08:07:00.9951205+08:00||;True|2025-11-23T23:34:50.0030826+08:00||;True|2025-11-23T23:32:36.7452616+08:00||;True|2025-11-22T23:18:56.3202345+08:00||;True|2025-11-22T22:52:51.7203302+08:00||;True|2025-11-22T22:52:42.9620946+08:00||;True|2025-11-22T22:52:09.8257640+08:00||;True|2025-11-22T22:39:31.5894141+08:00||;True|2025-11-22T22:31:11.0704815+08:00||;True|2025-11-22T22:20:36.4579131+08:00||;True|2025-11-22T22:19:10.2281364+08:00||;True|2025-11-22T19:34:45.9336901+08:00||;True|2025-11-12T23:06:38.7834109+08:00||;False|2025-11-12T23:01:02.2269478+08:00||;True|2025-10-22T22:08:11.6423148+08:00||;True|2025-10-22T21:54:24.7180547+08:00||;True|2025-10-22T21:40:03.5194315+08:00||;True|2025-10-22T21:28:28.8962766+08:00||;True|2025-10-22T21:22:47.9631689+08:00||;True|2025-10-22T21:18:24.5274318+08:00||;True|2025-10-22T21:14:51.6386326+08:00||;False|2025-10-22T21:14:07.6282769+08:00||;True|2025-10-22T21:03:48.9892860+08:00||;True|2025-10-22T21:00:56.3617243+08:00||;False|2025-10-22T21:00:30.5472941+08:00||;True|2025-10-22T20:51:29.6155916+08:00||;False|2025-10-22T20:50:47.1882956+08:00||;True|2025-10-22T15:01:04.1668366+08:00||;True|2025-10-22T14:49:43.6340569+08:00||;True|2025-10-22T14:38:39.4685603+08:00||;True|2025-10-21T18:35:28.8392541+08:00||;True|2025-10-20T10:31:05.5865212+08:00||;True|2025-10-20T10:20:41.5717101+08:00||;True|2025-10-19T10:08:33.6669332+08:00||;False|2025-10-19T10:07:22.3337545+08:00||;False|2025-10-19T10:05:22.9484805+08:00||;True|2025-10-10T16:54:27.1472888+08:00||;False|2025-10-10T16:53:44.1700030+08:00||;False|2025-10-10T16:52:48.1740453+08:00||;False|2025-10-10T16:51:21.5067253+08:00||;False|2025-10-10T16:50:19.2140597+08:00||;False|2025-10-10T16:49:21.2213290+08:00||;False|2025-10-10T16:48:47.7229948+08:00||;False|2025-10-10T16:48:15.1258700+08:00||;True|2025-09-30T13:29:42.2354235+08:00||;True|2025-09-25T11:44:52.6858389+08:00||;True|2025-09-25T11:08:27.8810109+08:00||;True|2025-09-25T09:28:50.2563374+08:00||;True|2025-09-24T16:14:02.3072184+08:00||;True|2025-09-23T22:38:52.4414757+08:00||;True|2025-09-23T22:19:07.1006356+08:00||;True|2025-09-23T22:18:01.5945225+08:00||;True|2025-09-23T22:06:15.6293613+08:00||;True|2025-09-23T21:53:14.2977444+08:00||;True|2025-09-23T21:46:55.2322411+08:00||;False|2025-09-23T21:45:23.7858854+08:00||;False|2025-09-23T21:03:51.8325689+08:00||;True|2025-09-23T10:03:32.2251920+08:00||;False|2025-09-23T09:38:08.2372201+08:00||;False|2025-09-23T09:37:49.9390545+08:00||;True|2024-03-11T21:31:45.8102398+08:00||;True|2024-03-11T07:26:24.7660541+08:00||;True|2024-03-08T22:08:40.0154831+08:00||;True|2024-03-03T10:14:36.8109114+08:00||;True|2024-03-02T18:44:57.3288537+08:00||;True|2024-01-24T17:51:37.9164415+08:00||;True|2024-01-24T16:36:50.5612157+08:00||;True|2024-01-24T15:51:35.7556653+08:00||;True|2024-01-17T23:40:40.7526618+08:00||;True|2024-01-17T23:36:10.3692844+08:00||;True|2024-01-17T23:22:03.2378834+08:00||;True|2024-01-03T11:35:44.7118292+08:00||;True|2024-01-03T11:11:23.4270453+08:00||;True|2024-01-03T11:04:35.2081526+08:00||;True|2024-01-03T10:57:03.7053107+08:00||;True|2024-01-03T10:51:50.7463989+08:00||;False|2024-01-03T10:50:24.9775312+08:00||;True|2024-01-03T10:47:30.1128183+08:00||;True|2024-01-03T10:42:55.8640657+08:00||;True|2024-01-03T09:24:24.3436056+08:00||;True|2024-01-02T23:40:38.2001198+08:00||;True|2024-01-02T23:08:36.7230444+08:00||;True|2024-01-02T22:53:43.9658255+08:00||;True|2024-01-02T22:25:38.5545279+08:00||;False|2024-01-02T22:24:42.6577609+08:00||;True|2024-01-02T22:04:33.4708889+08:00||;True|2024-01-02T21:49:57.9249898+08:00||;True|2023-12-28T22:42:58.5976180+08:00||;True|2023-12-28T22:24:09.2051205+08:00||;True|2023-12-28T22:05:48.4865497+08:00||;True|2023-12-28T21:50:57.4549336+08:00||;True|2023-12-28T21:45:30.4557939+08:00||;True|2023-12-28T21:19:59.3614594+08:00||;False|2023-12-28T21:17:04.3069097+08:00||;False|2023-12-28T21:15:56.7788810+08:00||;False|2023-12-28T21:14:57.3617402+08:00||;False|2023-12-28T21:10:45.4382469+08:00||;True|2023-12-28T19:45:33.1431914+08:00||;True|2023-12-26T11:30:36.6418716+08:00||;</History>
|
||||
<History>True|2025-11-24T15:53:54.4283003Z||;True|2025-11-24T23:41:15.8248332+08:00||;True|2025-11-24T23:33:57.1844427+08:00||;True|2025-11-24T23:31:54.9228836+08:00||;True|2025-11-24T23:24:15.8681502+08:00||;True|2025-11-24T23:22:57.9046229+08:00||;True|2025-11-24T23:18:04.1131647+08:00||;True|2025-11-24T22:47:54.1336448+08:00||;True|2025-11-24T22:47:18.3613833+08:00||;True|2025-11-24T08:17:50.3994607+08:00||;True|2025-11-24T08:07:00.9951205+08:00||;True|2025-11-23T23:34:50.0030826+08:00||;True|2025-11-23T23:32:36.7452616+08:00||;True|2025-11-22T23:18:56.3202345+08:00||;True|2025-11-22T22:52:51.7203302+08:00||;True|2025-11-22T22:52:42.9620946+08:00||;True|2025-11-22T22:52:09.8257640+08:00||;True|2025-11-22T22:39:31.5894141+08:00||;True|2025-11-22T22:31:11.0704815+08:00||;True|2025-11-22T22:20:36.4579131+08:00||;True|2025-11-22T22:19:10.2281364+08:00||;True|2025-11-22T19:34:45.9336901+08:00||;True|2025-11-12T23:06:38.7834109+08:00||;False|2025-11-12T23:01:02.2269478+08:00||;True|2025-10-22T22:08:11.6423148+08:00||;True|2025-10-22T21:54:24.7180547+08:00||;True|2025-10-22T21:40:03.5194315+08:00||;True|2025-10-22T21:28:28.8962766+08:00||;True|2025-10-22T21:22:47.9631689+08:00||;True|2025-10-22T21:18:24.5274318+08:00||;True|2025-10-22T21:14:51.6386326+08:00||;False|2025-10-22T21:14:07.6282769+08:00||;True|2025-10-22T21:03:48.9892860+08:00||;True|2025-10-22T21:00:56.3617243+08:00||;False|2025-10-22T21:00:30.5472941+08:00||;True|2025-10-22T20:51:29.6155916+08:00||;False|2025-10-22T20:50:47.1882956+08:00||;True|2025-10-22T15:01:04.1668366+08:00||;True|2025-10-22T14:49:43.6340569+08:00||;True|2025-10-22T14:38:39.4685603+08:00||;True|2025-10-21T18:35:28.8392541+08:00||;True|2025-10-20T10:31:05.5865212+08:00||;True|2025-10-20T10:20:41.5717101+08:00||;True|2025-10-19T10:08:33.6669332+08:00||;False|2025-10-19T10:07:22.3337545+08:00||;False|2025-10-19T10:05:22.9484805+08:00||;True|2025-10-10T16:54:27.1472888+08:00||;False|2025-10-10T16:53:44.1700030+08:00||;False|2025-10-10T16:52:48.1740453+08:00||;False|2025-10-10T16:51:21.5067253+08:00||;False|2025-10-10T16:50:19.2140597+08:00||;False|2025-10-10T16:49:21.2213290+08:00||;False|2025-10-10T16:48:47.7229948+08:00||;False|2025-10-10T16:48:15.1258700+08:00||;True|2025-09-30T13:29:42.2354235+08:00||;True|2025-09-25T11:44:52.6858389+08:00||;True|2025-09-25T11:08:27.8810109+08:00||;True|2025-09-25T09:28:50.2563374+08:00||;True|2025-09-24T16:14:02.3072184+08:00||;True|2025-09-23T22:38:52.4414757+08:00||;True|2025-09-23T22:19:07.1006356+08:00||;True|2025-09-23T22:18:01.5945225+08:00||;True|2025-09-23T22:06:15.6293613+08:00||;True|2025-09-23T21:53:14.2977444+08:00||;True|2025-09-23T21:46:55.2322411+08:00||;False|2025-09-23T21:45:23.7858854+08:00||;False|2025-09-23T21:03:51.8325689+08:00||;True|2025-09-23T10:03:32.2251920+08:00||;False|2025-09-23T09:38:08.2372201+08:00||;False|2025-09-23T09:37:49.9390545+08:00||;True|2024-03-11T21:31:45.8102398+08:00||;True|2024-03-11T07:26:24.7660541+08:00||;True|2024-03-08T22:08:40.0154831+08:00||;True|2024-03-03T10:14:36.8109114+08:00||;True|2024-03-02T18:44:57.3288537+08:00||;True|2024-01-24T17:51:37.9164415+08:00||;True|2024-01-24T16:36:50.5612157+08:00||;True|2024-01-24T15:51:35.7556653+08:00||;True|2024-01-17T23:40:40.7526618+08:00||;True|2024-01-17T23:36:10.3692844+08:00||;True|2024-01-17T23:22:03.2378834+08:00||;True|2024-01-03T11:35:44.7118292+08:00||;True|2024-01-03T11:11:23.4270453+08:00||;True|2024-01-03T11:04:35.2081526+08:00||;True|2024-01-03T10:57:03.7053107+08:00||;True|2024-01-03T10:51:50.7463989+08:00||;False|2024-01-03T10:50:24.9775312+08:00||;True|2024-01-03T10:47:30.1128183+08:00||;True|2024-01-03T10:42:55.8640657+08:00||;True|2024-01-03T09:24:24.3436056+08:00||;True|2024-01-02T23:40:38.2001198+08:00||;True|2024-01-02T23:08:36.7230444+08:00||;True|2024-01-02T22:53:43.9658255+08:00||;True|2024-01-02T22:25:38.5545279+08:00||;False|2024-01-02T22:24:42.6577609+08:00||;True|2024-01-02T22:04:33.4708889+08:00||;True|2024-01-02T21:49:57.9249898+08:00||;True|2023-12-28T22:42:58.5976180+08:00||;True|2023-12-28T22:24:09.2051205+08:00||;True|2023-12-28T22:05:48.4865497+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -69,6 +69,27 @@ Cookie 及 `sec_user_id` 是同步功能的核心,需严格按步骤获取,
|
||||
## 🚀 4. 运行方式(推荐 Docker Compose,更易维护)
|
||||
|
||||
|
||||
# Dysync.net Docker 镜像版本说明
|
||||
|
||||
本文档详细描述了 `jianzhichu/dysync.net` Docker 镜像的各个版本、其功能特性、适用架构以及镜像大小。
|
||||
|
||||
## 镜像版本总览
|
||||
|
||||
| 镜像标签 | 架构 | 功能描述 | 镜像大小 | 适用场景 |
|
||||
|-----------------------------------|----------------|--------------------------------------------------------------------------|-----------|------------------------------|
|
||||
| `jianzhichu/dysync.net:latest` | x86_64 (amd64) | **标准版**<br>- 包含核心功能<br>- **不含 FFmpeg**<br>- 不能下载图文视频 | ~200M | 仅需基础功能,追求轻量部署 |
|
||||
| `jianzhichu/dysync.net:full_latest` | x86_64 (amd64) | **完整版**<br>- 包含全部核心功能<br>- **内置 FFmpeg**<br>- 支持图文视频下载与合成 | ~700M | 需要完整媒体处理能力的场景 |
|
||||
| `jianzhichu/dysync.net:arm_latest` | ARM64 | **ARM 标准版**<br>- 核心功能(与 `latest` 一致)<br>- **适配 ARM 架构** | ~200M | ARM 设备(如树莓派)的轻量部署 |
|
||||
| `jianzhichu/dysync.net:full_arm_latest` | ARM64 | **ARM 完整版**<br>- 完整功能(与 `full_latest` 一致)<br>- **适配 ARM 架构** | ~700M | ARM 设备的完整功能部署 |
|
||||
| `jianzhichu/dysync.net:beta_1.0` | x86_64 (amd64) | **测试版 v1.0**<br>- 包含最新开发特性<br>- 功能可能不稳定<br>- 不含 FFmpeg | ~200M | 开发测试、尝鲜新功能 |
|
||||
|
||||
## 构建命令示例
|
||||
|
||||
以下是构建上述各版本镜像的 Docker 命令参考:
|
||||
|
||||
```bash
|
||||
|
||||
|
||||
将下方命令中的「本地路径」替换为你的实际路径,终端执行即可:
|
||||
```bash
|
||||
|
||||
|
||||
@@ -7,25 +7,10 @@ import { Dayjs } from 'dayjs';
|
||||
import { EditFilled } from '@ant-design/icons-vue';
|
||||
import { useApiStore } from '@/store';
|
||||
import type { UnwrapRef } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
|
||||
const columns = [
|
||||
{
|
||||
title: 'Cookie名称',
|
||||
dataIndex: 'userName',
|
||||
width: 180,
|
||||
},
|
||||
{ title: '状态', dataIndex: 'status', width: 180 },
|
||||
{ title: '收藏路径', dataIndex: 'savePath' },
|
||||
{ title: '喜欢路径', dataIndex: 'favSavePath' },
|
||||
{ title: '博主路径', dataIndex: 'upSavePath' },
|
||||
{ title: '图片视频', dataIndex: 'imgSavePath' },
|
||||
{ title: 'Cookie', dataIndex: 'cookies' },
|
||||
// { title: '博主信息', dataIndex: 'upSecUserIds' },
|
||||
// { title: '自己', dataIndex: 'secUserId' },
|
||||
{ title: '操作', dataIndex: 'edit', width: 200 },
|
||||
// { title: 'id', dataIndex: 'id', width: 200, hiden: false },
|
||||
];
|
||||
const columns = ref([]);
|
||||
|
||||
// 定义数组中单个对象的类型:包含uper和uid字段(可选字符串类型,根据实际需求调整是否可选)
|
||||
interface UpSecUserIdItem {
|
||||
@@ -94,9 +79,7 @@ const GetRecords = () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
GetRecords();
|
||||
});
|
||||
// onMounted(() => {});
|
||||
|
||||
function addNew() {
|
||||
showModal.value = true;
|
||||
@@ -247,6 +230,67 @@ const removeRow = (index) => {
|
||||
form.upSecUserIdsJson.splice(index, 1);
|
||||
};
|
||||
const rowCount = 4;
|
||||
|
||||
// 组件挂载时获取配置
|
||||
onMounted(() => {
|
||||
getConfig();
|
||||
});
|
||||
const downImgVideo = ref(false);
|
||||
|
||||
// 获取配置数据
|
||||
const getConfig = () => {
|
||||
useApiStore()
|
||||
.apiGetConfig()
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
downImgVideo.value = res.data.downImageVideoFromEnv;
|
||||
if (!res.data.downImageVideoFromEnv) {
|
||||
columns.value = [
|
||||
{
|
||||
title: 'Cookie名称',
|
||||
dataIndex: 'userName',
|
||||
width: 180,
|
||||
},
|
||||
{ title: '状态', dataIndex: 'status', width: 180 },
|
||||
{ title: '收藏路径', dataIndex: 'savePath' },
|
||||
{ title: '喜欢路径', dataIndex: 'favSavePath' },
|
||||
{ title: '博主路径', dataIndex: 'upSavePath' },
|
||||
{ title: 'Cookie', dataIndex: 'cookies' },
|
||||
// { title: '博主信息', dataIndex: 'upSecUserIds' },
|
||||
// { title: '自己', dataIndex: 'secUserId' },
|
||||
{ title: '操作', dataIndex: 'edit', width: 200 },
|
||||
// { title: 'id', dataIndex: 'id', width: 200, hiden: false },
|
||||
];
|
||||
} else {
|
||||
columns.value = [
|
||||
{
|
||||
title: 'Cookie名称',
|
||||
dataIndex: 'userName',
|
||||
width: 180,
|
||||
},
|
||||
{ title: '状态', dataIndex: 'status', width: 180 },
|
||||
{ title: '收藏路径', dataIndex: 'savePath' },
|
||||
{ title: '喜欢路径', dataIndex: 'favSavePath' },
|
||||
{ title: '博主路径', dataIndex: 'upSavePath' },
|
||||
{ title: '图文视频', dataIndex: 'imgSavePath' },
|
||||
{ title: 'Cookie', dataIndex: 'cookies' },
|
||||
// { title: '博主信息', dataIndex: 'upSecUserIds' },
|
||||
// { title: '自己', dataIndex: 'secUserId' },
|
||||
{ title: '操作', dataIndex: 'edit', width: 200 },
|
||||
// { title: 'id', dataIndex: 'id', width: 200, hiden: false },
|
||||
];
|
||||
}
|
||||
GetRecords();
|
||||
} else {
|
||||
// message.error(res.erro || '获取配置失败', 8);
|
||||
console.error('获取配置失败:');
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('获取配置失败:', error);
|
||||
// message.error('获取配置失败,请稍后重试', 8);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<a-modal :title="form._isNew ? '新增' : '编辑'" v-model:visible="showModal" @ok="submit" @cancel="cancel" width="1000px">
|
||||
@@ -324,7 +368,7 @@ const rowCount = 4;
|
||||
</div>
|
||||
</a-form-item-rest>
|
||||
</a-form-item>
|
||||
<a-form-item label="图文视频路径" name="imgSavePath">
|
||||
<a-form-item label="图文视频路径" name="imgSavePath" v-if="downImgVideo">
|
||||
<div style="display: flex; align-items: center; gap: 6px;">
|
||||
<a-input v-model:value="form.imgSavePath" style="flex: 1;" />
|
||||
<a-tooltip title="同步图文视频必填!!!">
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"dbconn": "",
|
||||
"dbtype": "Sqlite",
|
||||
"DOWN_IMGVIDEO": "1"
|
||||
"DOWN_IMGVIDEO": "2"
|
||||
}
|
||||
@@ -86,6 +86,9 @@
|
||||
<None Update="Dockerfile-arm">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Dockerfile-arm-img">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Dockerfile-dev">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -135,8 +135,8 @@ namespace dy.net.job
|
||||
}
|
||||
|
||||
//将配置项打印日志
|
||||
Log.Debug($"最新:{JsonConvert.SerializeObject(config)}");
|
||||
|
||||
Console.WriteLine("当前配置如下:");
|
||||
config.PrintAsTable();
|
||||
|
||||
// 2. 从配置中获取每页请求数量
|
||||
if (config.BatchCount > 0)
|
||||
|
||||
@@ -20,23 +20,23 @@ namespace dy.net.service
|
||||
/// <returns></returns>
|
||||
public async Task StartJob(string expression,int delay=5000)
|
||||
{
|
||||
//await StartCollectJob(expression);
|
||||
await StartCollectJob(expression);
|
||||
|
||||
//await Task.Delay(delay);
|
||||
////如果是数字则加1分钟,减少并发
|
||||
//if (int.TryParse(expression, out int cron))
|
||||
//{
|
||||
// cron++;
|
||||
// expression = cron.ToString();
|
||||
//}
|
||||
//await StartFavoriteJob(expression);
|
||||
await Task.Delay(delay);
|
||||
//如果是数字则加1分钟,减少并发
|
||||
if (int.TryParse(expression, out int cron))
|
||||
{
|
||||
cron++;
|
||||
expression = cron.ToString();
|
||||
}
|
||||
await StartFavoriteJob(expression);
|
||||
|
||||
//await Task.Delay(delay);
|
||||
//if (int.TryParse(expression, out int cron2))
|
||||
//{
|
||||
// cron2++;
|
||||
// expression = cron2.ToString();
|
||||
//}
|
||||
await Task.Delay(delay);
|
||||
if (int.TryParse(expression, out int cron2))
|
||||
{
|
||||
cron2++;
|
||||
expression = cron2.ToString();
|
||||
}
|
||||
await StartUperPostJob(expression);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace dy.net.utils
|
||||
{
|
||||
public static class ObjectExtensions
|
||||
{
|
||||
public static void PrintAsTable(this object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
Console.WriteLine("对象为null");
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyInfo[] properties = obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
if (properties.Length == 0)
|
||||
{
|
||||
Console.WriteLine("没有找到公共属性");
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算最大宽度
|
||||
int maxNameLength = "属性名".Length;
|
||||
int maxValueLength = "值".Length;
|
||||
|
||||
foreach (var prop in properties)
|
||||
{
|
||||
maxNameLength = Math.Max(maxNameLength, prop.Name.Length);
|
||||
|
||||
object value = prop.GetValue(obj);
|
||||
string valueStr = value?.ToString() ?? "null";
|
||||
maxValueLength = Math.Max(maxValueLength, valueStr.Length);
|
||||
}
|
||||
|
||||
// 构建表格
|
||||
string separator = "+" + new string('-', maxNameLength + 2) + "+" + new string('-', maxValueLength + 2) + "+";
|
||||
|
||||
Serilog.Log.Debug(separator);
|
||||
Serilog.Log.Debug($"| {"属性名".PadRight(maxNameLength)} | {"值".PadRight(maxValueLength)} |");
|
||||
Serilog.Log.Debug(separator);
|
||||
|
||||
foreach (var prop in properties)
|
||||
{
|
||||
string name = prop.Name;
|
||||
object value = prop.GetValue(obj);
|
||||
string valueStr = value?.ToString() ?? "null";
|
||||
|
||||
// 处理过长的字符串
|
||||
if (valueStr.Length > maxValueLength)
|
||||
{
|
||||
valueStr = valueStr.Substring(0, maxValueLength - 3) + "...";
|
||||
}
|
||||
|
||||
Serilog.Log.Debug($"| {name.PadRight(maxNameLength)} | {valueStr.PadRight(maxValueLength)} |");
|
||||
}
|
||||
|
||||
Serilog.Log.Debug(separator);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user