ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/ISerialPortRepository/IFaceRecognitionRepository.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,10 @@ using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Model.Models; namespace WIDESEA_ISerialPortRepository { public interface IFaceRecognitionRepository : IRepository<Dt_FaceRecognition> { } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/ISerialPortService/IFaceRecognitionServer .cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,17 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_ITaskInfoService { public interface IFaceRecognitionServer : IService<Dt_FaceRecognition> { WebResponseContent AddGroup(string groupName); } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/SerialPortRepository/FaceRecognitionRepository.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,13 @@ using WIDESEA_ISerialPortRepository; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Model.Models; namespace WIDESEA_SerialPortRepository { public class FaceRecognitionRepository : RepositoryBase<Dt_FaceRecognition>, IFaceRecognitionRepository { public FaceRecognitionRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) { } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/SerialPortService/FaceRecognitionServer .cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,64 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using WIDESEA_ISerialPortRepository; using WIDESEA_SerialPortRepository; using WIDESEAWCS_Common; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_TaskInfoService { public class FaceRecognitionServer : ServiceBase<Dt_FaceRecognition, IFaceRecognitionRepository>, IFaceRecognitionServer { public FaceRecognitionServer( IFaceRecognitionRepository BaseDal) : base(BaseDal) { } public override PageGridData<Dt_FaceRecognition> GetPageData(PageDataOptions options) { OrderByParameters = new Dictionary<string, SqlSugar.OrderByType> { { nameof(Dt_ArticleInfom.ID),SqlSugar.OrderByType.Asc }, }; return base.GetPageData(options); } public WebResponseContent AddGroup(string groupName) { try { // 1. è°ç¨ç¾åº¦ API è¿è¡ç¨æ·ç»å建 string apiResult = BaiDuFaceHelper.GroupAdd(groupName); // 2. è§£æ API è¿åç JSON ç»æ dynamic resultObj = JsonConvert.DeserializeObject(apiResult); if (resultObj.error_code == 0) { return WebResponseContent.Instance.OK("ç¨æ·ç»å建æå"); } else { return WebResponseContent.Instance.Error("ç¾åº¦ API å建失败ï¼" + resultObj.error_msg); } } catch (Exception ex) { return WebResponseContent.Instance.Error("åå»ºç¨æ·ç»å¤±è´¥ï¼" + ex.Message); } } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Common/BaiDuFaceHelper.cs
@@ -22,7 +22,7 @@ NLog.LogManager.GetCurrentClassLogger().Trace("ç¾åº¦äººè¸è¯å«è¿åï¼" + returnStr); BDToken token = JsonConvert.DeserializeObject<BDToken>(returnStr); token.getdate = DateTime.Now.ToString(); token.getdate = DateTime.Now.ToString(); return token.access_token; } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Common/WIDESEAWCS_Common.csproj
@@ -7,6 +7,8 @@ </PropertyGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="NLog" Version="5.4.0" /> </ItemGroup> </Project> ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_DTO/SerialPort/AddUserDTO.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEAWCS_DTO.SerialPort { public class AddUserDTO { public string username { get; set; } public int log_id { get; set; } //public string facetoken { get; set; } public string phoneno { get; set; } public int roleid { get; set; } public string rolename { get; set; } public byte enable { get; set; } public string path { get; set; } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_DTO/SerialPort/PaginationDTO.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,41 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEAWCS_DTO.Telescopic { public class PaginationDTO { /// <summary> /// 第å 页 /// </summary> public int pageIndex { get; set; } /// <summary> /// ä¸é¡µå¤å°ä¸ªæ°æ® /// </summary> public int pageSize { get; set; } /// <summary> /// æ¨¡ç³æ¥è¯¢çåæ®µ /// </summary> public string? searchKeyword { get; set; } /// <summary> /// å¼å§æ¶é´ /// </summary> public DateTime ?startDate { get; set; } /// <summary> /// ç»ææ¶é´ /// </summary> public DateTime? endDate { get; set; } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_DTO/SerialPort/UserDTO.cs
@@ -26,7 +26,7 @@ /// <summary> /// çµè¯ /// </summary> public string phone { get; set; } public string phone { get; set; } /// <summary> /// å¾ç ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_ISystemServices/ISys_UserService.cs
@@ -6,9 +6,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_DTO.SerialPort; using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_Model; using WIDESEAWCS_Model.Models; @@ -61,5 +63,25 @@ /// <param name="id"></param> /// <returns></returns> WebResponseContent Upuserbase(UserDTO userDTO); /// <summary> /// 人è¸è¯å« /// </summary> /// <param name="paginationDTO"></param> /// <returns></returns> WebResponseContent GetUserFace(PaginationDTO paginationDTO); /// <summary> /// æ·»å ç¨æ· /// </summary> /// <param name="addUserDTO"></param> /// <returns></returns> WebResponseContent AdduserData(AddUserDTO addUserDTO); WebResponseContent UpuserData(AddUserDTO addUserDTO); WebResponseContent DeleteUserData(DeleteUserImg deleteUserDTO); } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Model/LoginInfo.cs
@@ -11,5 +11,10 @@ public string UserName { get; set; } public string Password { get; set; } /// <summary> /// 人è¸è¯å« /// </summary> public string? path { get; set; } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Model/Models/SerialPort/Dt_FaceRecognition.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SqlSugar; using WIDESEAWCS_Core.DB.Models; using WIDESEAWCS_Core.Tenants; namespace WIDESEAWCS_Model.Models { [SugarTable("Dt_FaceRecognition", "人è¸è¯å«è¡¨"), MultiTenant] public class Dt_FaceRecognition:BaseEntity { /// <summary> /// id /// </summary> [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] public int ID { get; set; } /// <summary> /// 人è¸è¯å«ç» /// </summary> [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "人è¸è¯å«ç»")] public string GroupID { get; set; } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Model/Models/System/Sys_User.cs
@@ -21,6 +21,13 @@ /// </summary> [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "ç¨æ·ID")] public int User_Id { get; set; } [SugarColumn( IsNullable = true, ColumnDescription = "人è¸è¯å«id")] public int Log_id { get; set; } [SugarColumn(Length = 100, IsNullable = true, ColumnDescription = "人è¸è¯å«token")] public string Face_token { get; set; } /// <summary> ///å¸å· ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/Controllers/SerialPort/ArticleInfomController.cs
@@ -17,7 +17,7 @@ public ArticleInfomController(IArticleInfomServer service) : base(service) { } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/Controllers/SerialPort/FaceRecognitionController .cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,33 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting.Server; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseController; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_TaskInfoService; namespace WIDESEAWCS_Server.Controllers.SerialPort { [Route("api/[controller]")] [ApiController] public class FaceRecognitionController : ApiBaseController<IFaceRecognitionServer, Dt_FaceRecognition> { public FaceRecognitionController(IFaceRecognitionServer service) : base(service) { } [HttpPost,Route("AddGroup"),AllowAnonymous] public WebResponseContent AddGroup(string groupName) { return Service.AddGroup(groupName); } } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/Controllers/System/Sys_UserController.cs
@@ -5,6 +5,7 @@ using Microsoft.Extensions.Caching.Memory; using Newtonsoft.Json; using StackExchange.Profiling; using WIDESEAWCS_Common; using WIDESEAWCS_Core; using WIDESEAWCS_Core.Authorization; using WIDESEAWCS_Core.BaseController; @@ -14,6 +15,7 @@ using WIDESEAWCS_Core.HttpContextUser; using WIDESEAWCS_Core.Utilities; using WIDESEAWCS_DTO.SerialPort; using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_ISystemServices; using WIDESEAWCS_Model; using WIDESEAWCS_Model.Models; @@ -181,6 +183,52 @@ { return Service.Upuserbase(userDTO); } /// <summary> /// å±ç¤ºäººè¸ç¨æ·ä¿¡æ¯ /// </summary> /// <param name="paginationDTO"></param> /// <returns></returns> [HttpPost, Route("GetUserFace"), AllowAnonymous] public WebResponseContent GetUserFace([FromBody] PaginationDTO paginationDTO) { return Service.GetUserFace(paginationDTO); } /// <summary> /// æ·»å ç¨æ· /// </summary> /// <param name="addUserDTO"></param> /// <returns></returns> [HttpPost, Route("AdduserData"), AllowAnonymous] public WebResponseContent AdduserData([FromBody]AddUserDTO addUserDTO) { return Service.AdduserData(addUserDTO); } /// <summary> /// æ´æ°ç¨æ· /// </summary> /// <param name="addUserDTO"></param> /// <returns></returns> [HttpPost, Route("UpuserData"), AllowAnonymous] public WebResponseContent UpuserData([FromBody] AddUserDTO addUserDTO) { return Service.UpuserData(addUserDTO); } /// <summary> /// å é¤ç¨æ· /// </summary> /// <param name="deleteUserDTO"></param> /// <returns></returns> [HttpPost, Route("DeleteUserData"), AllowAnonymous] public WebResponseContent DeleteUserData([FromBody] DeleteUserImg deleteUserDTO) { return Service.DeleteUserData(deleteUserDTO); } } ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492051182.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492244242.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492263811.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492568523.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492760375.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492791698.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492809549.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/1743492833343.png
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Server/wwwroot/image/filesBinary files differ
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_SystemServices/Sys_UserService.cs
@@ -17,6 +17,9 @@ using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; using Microsoft.AspNetCore.Builder; using WIDESEAWCS_DTO.SerialPort; using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_Common; using Newtonsoft.Json; namespace WIDESEAWCS_SystemServices { @@ -28,8 +31,11 @@ private readonly ISys_RoleRepository _RoleRepository; private readonly ILoginHistoryRepository _loginHistoryRepository; private readonly IPutakeRepository _putakeRepository; private readonly IFaceRecognitionRepository _faceRecognitionRepository; public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, public Sys_UserService(IFaceRecognitionRepository faceRecognitionRepository, ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService, ISys_RoleRepository roleRepository, ILoginHistoryRepository loginHistoryRepository, IPutakeRepository putakeRepository) : base(repository) { _unitOfWorkManage = unitOfWorkManage; @@ -39,6 +45,8 @@ _RoleRepository = roleRepository; _loginHistoryRepository = loginHistoryRepository; _putakeRepository = putakeRepository; _faceRecognitionRepository = faceRecognitionRepository; } public WebResponseContent Login(LoginInfo loginInfo) @@ -46,7 +54,7 @@ WebResponseContent content = new WebResponseContent(); try { //BaseDal.QueryFirst(x => x.UserName == loginInfo.UserName); // BaseDal.QueryFirst(x => x.UserName == loginInfo.UserName); string msg = string.Empty; @@ -60,51 +68,71 @@ } #endregion UserInfo user = BaseDal.GetUserInfo(loginInfo.UserName, loginInfo.Password); var disbled = BaseDal.QueryFirst(x => x.UserName == loginInfo.UserName);//æ ¹æ®è¿ä¸ªç¨æ·åæ¥æ¥çç¨æ· if (user != null) if (!string.IsNullOrEmpty(loginInfo.path)) { object obj = _menuService.GetMenuActionList(user.RoleId); if (obj is not IEnumerable<object> list) var faceResult = BaiDuFaceHelper.FaceSearch(loginInfo.path); if (faceResult != null && faceResult.error_code == 0) { return WebResponseContent.Instance.Error("æ ç»å½æé"); } if (!list.Any()) { return WebResponseContent.Instance.Error("æ ç»å½æé"); } if (disbled.Enable != 1) { return WebResponseContent.Instance.Error("ä½ çè´¦å·å·²è¢«ç¦ç¨ï¼è¯·è系管çå"); // è·åæé«å¹é 度çç¨æ· var bestMatch = faceResult.result.user_list.OrderByDescending(u => u.score).FirstOrDefault();//æ¿ç¬¬ä¸ä¸ªæé«ç if (bestMatch != null && double.TryParse(bestMatch.score, out double score) && score > 80) // 设å®80å为å¯ä¿¡åº¦éå¼ { return new WebResponseContent { Data = true }; } } string token = JwtHelper.IssueJwt(new TokenModelJwt() { UserId = user.UserId, RoleId = user.RoleId, UserName = user.UserName, TenantId = user.TenantId, }); var loghis = new Dt_LoginHistory { Account = user.UserName, TrurName = user.UserTrueName, CreateDate = DateTime.Now }; _cacheService.AddOrUpdate(user.UserId.ToString(), token); _loginHistoryRepository.AddData(loghis); content = WebResponseContent.Instance.OK(data: new { token, userName = user.UserTrueName, img = user.HeadImageUrl, ID = user.UserId, RoleId=user.RoleId }); return WebResponseContent.Instance.Error("人è¸è¯å«å¤±è´¥ï¼è¯·éè¯"); } else { content = WebResponseContent.Instance.Error("è´¦å·æå¯ç é误"); UserInfo user = BaseDal.GetUserInfo(loginInfo.UserName, loginInfo.Password); var disbled = BaseDal.QueryFirst(x => x.UserName == loginInfo.UserName);//æ ¹æ®è¿ä¸ªç¨æ·åæ¥æ¥çç¨æ· if (user != null) { object obj = _menuService.GetMenuActionList(user.RoleId); if (obj is not IEnumerable<object> list) { return WebResponseContent.Instance.Error("æ ç»å½æé"); } if (!list.Any()) { return WebResponseContent.Instance.Error("æ ç»å½æé"); } if (disbled.Enable != 1) { return WebResponseContent.Instance.Error("ä½ çè´¦å·å·²è¢«ç¦ç¨ï¼è¯·è系管çå"); } string token = JwtHelper.IssueJwt(new TokenModelJwt() { UserId = user.UserId, RoleId = user.RoleId, UserName = user.UserName, TenantId = user.TenantId, }); var loghis = new Dt_LoginHistory { Account = user.UserName, TrurName = user.UserTrueName, CreateDate = DateTime.Now }; _cacheService.AddOrUpdate(user.UserId.ToString(), token); _loginHistoryRepository.AddData(loghis); content = WebResponseContent.Instance.OK(data: new { token, userName = user.UserTrueName, img = user.HeadImageUrl, ID = user.UserId, RoleId = user.RoleId }); } else { content = WebResponseContent.Instance.Error("è´¦å·æå¯ç é误"); } } } catch (Exception ex) { content = WebResponseContent.Instance.Error(ex.Message); @@ -355,7 +383,7 @@ if (newPwd.Length < 6) return content.Error("å¯ç ä¸è½å°äº6ä½"); // è·åç¨æ·å½åå¯ç string userCurrentPwd = BaseDal.QueryFirst(x => x.User_Id == id, s => s.UserPwd) ?? ""; string userCurrentPwd = BaseDal.QueryFirst(x => x.User_Id == id, s => s.UserPwd) ?? ""; if (string.IsNullOrEmpty(userCurrentPwd)) return content.Error("ç¨æ·ä¸å卿å¯ç æªè®¾ç½®"); @@ -398,7 +426,7 @@ try { var user = BaseDal.QueryData(x => x.User_Id == userDTO.id).FirstOrDefault(); if (user==null) if (user == null) { return new WebResponseContent { Status = false, Message = "没æ¾å°è¯¥ç¨æ·" }; } @@ -411,10 +439,205 @@ catch (Exception ex) { return new WebResponseContent { Status = false ,Message="失败ï¼"+ex}; return new WebResponseContent { Status = false, Message = "失败ï¼" + ex }; } } /// <summary> /// æ¥çç¨æ·ä¿¡æ¯å人è¸è¯å«è¡¨ /// </summary> /// <param name="paginationDTO"></param> /// <returns></returns> public WebResponseContent GetUserFace(PaginationDTO paginationDTO) { try { int totalCount = 0; var sys = Db.Queryable<Sys_User>(); var face = _faceRecognitionRepository.Db.Queryable<Dt_FaceRecognition>(); if (face == null) { return new WebResponseContent { Status = false, Message = "æ°æ®ä¸ºç©º" }; } var query = sys.LeftJoin<Dt_FaceRecognition>((a, b) => a.Log_id == b.ID); if (!string.IsNullOrEmpty(paginationDTO.searchKeyword)) { query = query.Where((a, b) => a.UserName.Contains(paginationDTO.searchKeyword) || a.UserTrueName.Contains(paginationDTO.searchKeyword) || a.PhoneNo.Contains(paginationDTO.searchKeyword) || a.RoleName.Contains(paginationDTO.searchKeyword) || a.Role_Id.ToString().Contains(paginationDTO.searchKeyword) ); } if (paginationDTO.startDate.HasValue && paginationDTO.endDate.HasValue) { query = query.Where((a, b) => a.CreateDate >= paginationDTO.startDate && a.CreateDate <= paginationDTO.endDate); } var result = query.Select((a, b) => new { a.User_Id, a.UserName, a.UserTrueName, a.PhoneNo, a.Role_Id, a.RoleName, a.HeadImageUrl, a.Enable, a.CreateDate, a.Face_token, b.GroupID, }).ToPageList(paginationDTO.pageIndex, paginationDTO.pageSize, ref totalCount); return new WebResponseContent { Status = true, Data = new { TotalCount = totalCount,//æ»æ° PageIndex = paginationDTO.pageIndex,//é¡µæ° PaseSize = paginationDTO.pageSize,//ä¸é¡µå¤å°æ°æ® Items = result//è¿ååæ®µ } }; } catch (Exception) { throw; } } public WebResponseContent AdduserData(AddUserDTO addUserDTO) { try { var baiduResult = BaiDuFaceHelper.AddUser(new BDUserInfo { ImgPath = addUserDTO.path, user_id = addUserDTO.username, group_id = addUserDTO.log_id // è¿éåºè¯¥å¡«ç¾åº¦äººè¸åºåç» }); // 夿ç¾åº¦è¿åæ¯å¦æå if (baiduResult == null || baiduResult.error_code != 0) { return new WebResponseContent { Status = false, Data = "äººè¸æ³¨å失败ï¼" + baiduResult.error_msg }; } // åå»ºç¨æ·æ°æ® var sys = new Sys_User { UserName = addUserDTO.username, HeadImageUrl=addUserDTO.path, Log_id = addUserDTO.log_id, Face_token = baiduResult.result.face_token, PhoneNo = addUserDTO.phoneno, Role_Id = addUserDTO.roleid, RoleName = addUserDTO.rolename, Enable = addUserDTO.enable, UserPwd= "j79rYYvCz4vdhcboB1Ausg==" }; BaseDal.AddData(sys); return new WebResponseContent { Status = true, Data = sys }; } catch (Exception ex) { return new WebResponseContent { Status = false, Message = "失败" + ex }; } } public WebResponseContent UpuserData(AddUserDTO addUserDTO) { try { var baiduResult = BaiDuFaceHelper.AddUser(new BDUserInfo { ImgPath = addUserDTO.path, user_id = addUserDTO.username, group_id = addUserDTO.log_id // è¿éåºè¯¥å¡«ç¾åº¦äººè¸åºåç» }); // 夿ç¾åº¦è¿åæ¯å¦æå if (baiduResult == null || baiduResult.error_code != 0) { return new WebResponseContent { Status = false, Data = "äººè¸æ´æ°å¤±è´¥ï¼" + baiduResult.error_msg }; } // æ´æ°ç¨æ·æ°æ® var sys = new Sys_User { UserName = addUserDTO.username, HeadImageUrl = addUserDTO.path, Log_id = addUserDTO.log_id, Face_token = baiduResult.result.face_token, PhoneNo = addUserDTO.phoneno, Role_Id = addUserDTO.roleid, RoleName = addUserDTO.rolename, Enable = addUserDTO.enable, }; BaseDal.UpdateData(sys); return new WebResponseContent { Status = true, Data = sys }; } catch (Exception ex) { return new WebResponseContent { Status = false, Message = "失败" + ex }; } } /// <summary> /// å é¤ /// </summary> /// <param name="deleteUserDTO"></param> /// <returns></returns> public WebResponseContent DeleteUserData(DeleteUserImg deleteUserDTO) { try { string apiResult = BaiDuFaceHelper.DeleteUser(deleteUserDTO); // 2. è§£æè¿åç»æï¼å¤æå 餿¯å¦æå dynamic resultObj = JsonConvert.DeserializeObject(apiResult); if (resultObj.error_code == 0) { // ç¾åº¦å 餿ååï¼å 餿°æ®åºä¸çç¨æ· var user = BaseDal.QueryData(deleteUserDTO.user_id); if (user != null) { BaseDal.DeleteData(user); } return WebResponseContent.Instance.OK("ç¨æ·å 餿å"); } else { return WebResponseContent.Instance.Error("ç¾åº¦ API å é¤å¤±è´¥ï¼" + resultObj.error_msg); } } catch (Exception ex) { return WebResponseContent.Instance.Error("å é¤ç¨æ·å¤±è´¥ï¼" + ex.Message); } } } }