葛恒:奖惩

This commit is contained in:
2026-03-16 20:12:55 +08:00
parent 13364fcbf7
commit ab33ffa365
53 changed files with 6455 additions and 1032 deletions
+46 -6
View File
@@ -1,8 +1,9 @@
using System;
using System.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
@@ -28,7 +29,8 @@ namespace BLL
string TeamGroupId = null;
if (!string.IsNullOrEmpty(TeamGroupName))
{
var tg = Funs.DB.ProjectData_TeamGroup.Where(x => x.TeamGroupName == TeamGroupName && x.ProjectId == projectId && x.UnitId == unitId).ToList();
var tg = Funs.DB.ProjectData_TeamGroup.Where(x =>
x.TeamGroupName == TeamGroupName && x.ProjectId == projectId && x.UnitId == unitId).ToList();
if (tg.Count == 0)
{
Model.ProjectData_TeamGroup newTeamGroup = new Model.ProjectData_TeamGroup
@@ -47,10 +49,10 @@ namespace BLL
TeamGroupId = tg.FirstOrDefault().TeamGroupId;
}
}
return TeamGroupId;
}
#endregion
#region
@@ -97,7 +99,6 @@ namespace BLL
#endregion
#region
/// <summary>
@@ -611,7 +612,46 @@ namespace BLL
}
#endregion
/// <summary>
/// 下载并保存文件
/// </summary>
/// <param name="webUrl"></param>
/// <param name="fileUrl"></param>
/// <returns></returns>
public static byte[] SafeDownloadHeadImageAsync(string webUrl, string fileUrl)
{
try
{
if (string.IsNullOrEmpty(fileUrl))
return null;
// 构造完整的远程文件 URL
string fullRemoteUrl = $"{webUrl.TrimEnd('/')}/{fileUrl.TrimStart('/')}";
// 构造本地文件路径
string localFilePath = Path.Combine(ConfigurationManager.AppSettings["localRoot"], fileUrl);
// 确保本地目录存在
string directoryPath = Path.GetDirectoryName(localFilePath);
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
}
//下载文件到本地
using (WebClient client = new WebClient())
{
byte[] fileData = client.DownloadData(fullRemoteUrl);
// 将文件数据写入本地文件
File.WriteAllBytes(localFilePath, fileData);
return fileData;
}
}
catch (Exception ex)
{
BLL.ErrLogInfo.WriteLog($"下载头像失败: {fileUrl}, 错误: {ex.Message}");
return null;
}
}
}
}