From e0c194524b58129616ccc0cdc25d79287f12cd53 Mon Sep 17 00:00:00 2001 From: Jimmy <584481786@qq.com> Date: Sat, 16 Jan 2021 16:19:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=A7=E8=83=BD=E4=B8=8E=E8=B7=A8=E5=9F=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FigureNumber/FigureNumberAppService.cs | 5 +-- .../GalleryFiles/GalleryFilesAppService.cs | 7 ++-- .../GalleryInformationAppService.cs | 7 ++-- .../MaterialNumberAppService.cs | 7 ++-- .../ProductNumber/ProductNumberAppService.cs | 7 ++-- .../UserInfo/UserInfoAppService.cs | 38 +++++++++++++++++-- .../appsettings.json | 8 ++-- Pages/js/PublicParameters/PublicParameters.js | 5 ++- .../FigureNumber/FigureNumberList.html | 4 +- .../Graphic/FigureNumber/addFigureNumber.html | 2 +- Pages/page/table/addUser.html | 26 +++++++++---- 部署报错解决方法/解决方法.txt | 5 +++ 12 files changed, 85 insertions(+), 36 deletions(-) diff --git a/Code/src/MineTec.ProManager.Application/FigureNumber/FigureNumberAppService.cs b/Code/src/MineTec.ProManager.Application/FigureNumber/FigureNumberAppService.cs index ff7d5a0..ee4ee02 100644 --- a/Code/src/MineTec.ProManager.Application/FigureNumber/FigureNumberAppService.cs +++ b/Code/src/MineTec.ProManager.Application/FigureNumber/FigureNumberAppService.cs @@ -31,8 +31,7 @@ namespace MineTec.ProManager.FigureNumber var entity = _FigureNumberRepository.GetAll().FirstOrDefault(a => a.FigureNum == input.FigureNum && a.IsDelete == 0); if (entity == null) { - entity = ObjectMapper.Map(input); - _FigureNumberRepository.InsertAndGetId(entity); + _FigureNumberRepository.InsertAndGetId(ObjectMapper.Map(input)); //base.CreateAsync(input); result.code = 1;//成功 result.msg = "保存成功!"; @@ -51,7 +50,7 @@ namespace MineTec.ProManager.FigureNumber return result; } - public async Task GetAllFigureNumber(GetAllFigureNumber input) + public FigureNumberOutPut GetAllFigureNumber(GetAllFigureNumber input) { var result = new FigureNumberOutPut(); diff --git a/Code/src/MineTec.ProManager.Application/GalleryFiles/GalleryFilesAppService.cs b/Code/src/MineTec.ProManager.Application/GalleryFiles/GalleryFilesAppService.cs index dbf5a68..9fef338 100644 --- a/Code/src/MineTec.ProManager.Application/GalleryFiles/GalleryFilesAppService.cs +++ b/Code/src/MineTec.ProManager.Application/GalleryFiles/GalleryFilesAppService.cs @@ -33,7 +33,8 @@ namespace MineTec.ProManager.GalleryFiles .WhereIf(!string.IsNullOrEmpty(input.GalleryInformationID), t => t.GalleryInformationID == input.GalleryInformationID).FirstOrDefault(); if (entity == null) { - base.CreateAsync(input); + _GalleryFilesRepository.InsertAndGetId(ObjectMapper.Map(input)); + //base.CreateAsync(input); result.code = 1;//成功 result.msg = "保存成功!"; } @@ -51,7 +52,7 @@ namespace MineTec.ProManager.GalleryFiles return result; } - public async Task GetAllGalleryFiles(GetAllGalleryFiles input) + public GalleryFilesOutPut GetAllGalleryFiles(GetAllGalleryFiles input) { var result = new GalleryFilesOutPut(); @@ -78,7 +79,7 @@ namespace MineTec.ProManager.GalleryFiles return result; } - public async Task UpdateGalleryFiles(UpdateGalleryFiles input) + public OutputBase UpdateGalleryFiles(UpdateGalleryFiles input) { var result = new OutputBase(); diff --git a/Code/src/MineTec.ProManager.Application/GalleryInformation/GalleryInformationAppService.cs b/Code/src/MineTec.ProManager.Application/GalleryInformation/GalleryInformationAppService.cs index ba31624..8fd769c 100644 --- a/Code/src/MineTec.ProManager.Application/GalleryInformation/GalleryInformationAppService.cs +++ b/Code/src/MineTec.ProManager.Application/GalleryInformation/GalleryInformationAppService.cs @@ -35,7 +35,8 @@ namespace MineTec.ProManager.GalleryInformation var entity = _GalleryInformationRepository.GetAll().FirstOrDefault(a => a.GalleryNum == input.GalleryNum && a.IsDelete == 0); if (entity == null) { - base.CreateAsync(input); + _GalleryInformationRepository.InsertAndGetId(ObjectMapper.Map(input)); + //base.CreateAsync(input); result.code = 1;//成功 result.msg = "保存成功!"; } @@ -53,7 +54,7 @@ namespace MineTec.ProManager.GalleryInformation return result; } - public async Task GetAllGalleryInformation(GetAllGalleryInformation input) + public GalleryInformationOutPut GetAllGalleryInformation(GetAllGalleryInformation input) { var result = new GalleryInformationOutPut(); @@ -76,7 +77,7 @@ namespace MineTec.ProManager.GalleryInformation return result; } - public async Task UpdateGalleryInformation(UpdateGalleryInformation input) + public OutputBase UpdateGalleryInformation(UpdateGalleryInformation input) { var result = new OutputBase(); diff --git a/Code/src/MineTec.ProManager.Application/MaterialNumber/MaterialNumberAppService.cs b/Code/src/MineTec.ProManager.Application/MaterialNumber/MaterialNumberAppService.cs index 9c3fef5..edacc64 100644 --- a/Code/src/MineTec.ProManager.Application/MaterialNumber/MaterialNumberAppService.cs +++ b/Code/src/MineTec.ProManager.Application/MaterialNumber/MaterialNumberAppService.cs @@ -30,7 +30,8 @@ namespace MineTec.ProManager.MaterialNumber var entity = _MaterialNumberRepository.GetAll().FirstOrDefault(a => a.MaterialNum == input.MaterialNum && a.IsDelete == 0); if (entity == null) { - base.CreateAsync(input); + _MaterialNumberRepository.InsertAndGetId(ObjectMapper.Map(input)); + //base.CreateAsync(input); result.code = 1;//成功 result.msg = "保存成功!"; } @@ -48,7 +49,7 @@ namespace MineTec.ProManager.MaterialNumber return result; } - public async Task GetAllMaterialNumber(GetAllMaterialNumber input) + public MaterialNumberOutput GetAllMaterialNumber(GetAllMaterialNumber input) { var result = new MaterialNumberOutput(); @@ -71,7 +72,7 @@ namespace MineTec.ProManager.MaterialNumber return result; } - public async Task UpdateMaterialNumber(UpdateMaterialNumber input) + public OutputBase UpdateMaterialNumber(UpdateMaterialNumber input) { var result = new OutputBase(); diff --git a/Code/src/MineTec.ProManager.Application/ProductNumber/ProductNumberAppService.cs b/Code/src/MineTec.ProManager.Application/ProductNumber/ProductNumberAppService.cs index 2726037..3ce0e07 100644 --- a/Code/src/MineTec.ProManager.Application/ProductNumber/ProductNumberAppService.cs +++ b/Code/src/MineTec.ProManager.Application/ProductNumber/ProductNumberAppService.cs @@ -31,7 +31,8 @@ namespace MineTec.ProManager.ProductNumber var entity = _ProductNumberRepository.GetAll().FirstOrDefault(a => a.ProductNum == input.ProductNum && a.IsDelete == 0); if (entity == null) { - base.CreateAsync(input); + _ProductNumberRepository.InsertAndGetId(ObjectMapper.Map(input)); + //base.CreateAsync(input); result.code = 1;//成功 result.msg = "保存成功!"; } @@ -49,7 +50,7 @@ namespace MineTec.ProManager.ProductNumber return result; } - public async Task GetAllProductNumber(GetAllProductNumber input) + public ProductNumberOutput GetAllProductNumber(GetAllProductNumber input) { var result = new ProductNumberOutput(); @@ -72,7 +73,7 @@ namespace MineTec.ProManager.ProductNumber return result; } - public async Task UpdateProductNumber(UpdateProductNumber input) + public OutputBase UpdateProductNumber(UpdateProductNumber input) { var result = new OutputBase(); diff --git a/Code/src/MineTec.ProManager.Application/UserInfo/UserInfoAppService.cs b/Code/src/MineTec.ProManager.Application/UserInfo/UserInfoAppService.cs index b084f8b..daab125 100644 --- a/Code/src/MineTec.ProManager.Application/UserInfo/UserInfoAppService.cs +++ b/Code/src/MineTec.ProManager.Application/UserInfo/UserInfoAppService.cs @@ -2,6 +2,7 @@ using Abp.Application.Services.Dto; using Abp.Collections.Extensions; using Abp.Domain.Repositories; +using MineTec.ProManager.Commd; using MineTec.ProManager.UserInfo.Dto; using System; using System.Collections.Generic; @@ -14,10 +15,12 @@ namespace MineTec.ProManager.UserInfo CreateUpdateUserInfoDto, CreateUpdateUserInfoDto>, IUserInfoAppService { - public UserInfoAppService(IRepository repository) + private readonly IRepository _UserRepository; + + public UserInfoAppService(IRepository repository, IRepository UserRepository) : base(repository) { - + _UserRepository = UserRepository; } public override Task CreateAsync(CreateUpdateUserInfoDto input) @@ -26,7 +29,34 @@ namespace MineTec.ProManager.UserInfo return base.CreateAsync(input); } - public async Task> GetLoginUser(GetLoginUser input) + public OutputBase CreateUser(CreateUpdateUserInfoDto input) + { + var result = new OutputBase(); + try + { + var entity = _UserRepository.GetAll().FirstOrDefault(a => a.Account == input.Account && a.IsDelete == 0); + if (entity == null) + { + _UserRepository.InsertAndGetId(ObjectMapper.Map(input)); + //base.CreateAsync(input); + result.code = 1;//成功 + result.msg = "保存成功!"; + } + else + { + result.code = 2;//重复 + result.msg = "已经存在相同的用户账号,请修改!"; + } + } + catch (Exception e) + { + result.code = 0;//失败 + result.msg = e.Message; + } + return result; + } + + public PagedResultDto GetLoginUser(GetLoginUser input) { var query = base.CreateFilteredQuery(input).WhereIf(input.Account.Length > 0, t => t.IsDelete == 0 && t.IsLeaving == 0 && t.Account == input.Account && t.PassWord == input.PassWord); var usercount = query.Count(); @@ -39,7 +69,7 @@ namespace MineTec.ProManager.UserInfo } - public async Task GetAllUsers(GetAllUsers input) + public UserInfoOutput GetAllUsers(GetAllUsers input) { var result = new UserInfoOutput(); diff --git a/Code/src/MineTec.ProManager.Web.Host/appsettings.json b/Code/src/MineTec.ProManager.Web.Host/appsettings.json index 2932a75..c58d4a1 100644 --- a/Code/src/MineTec.ProManager.Web.Host/appsettings.json +++ b/Code/src/MineTec.ProManager.Web.Host/appsettings.json @@ -4,9 +4,9 @@ "Default": "Data Source=.;User ID=sa;Password=123456;Integrated Security=False;Initial Catalog=ProManagerDb;Connect Timeout=40;" }, "App": { - "ServerRootAddress": "http://10.10.0.158:21021/", - "ClientRootAddress": "http://10.10.0.158:880/", - "CorsOrigins": "http://localhost:4200,http://localhost:8080,http://localhost:880,http://localhost:3000,http://192.168.3.152:880,http://10.10.0.158:880" + "ServerRootAddress": "http://localhost:21021/", + "ClientRootAddress": "http://localhost:880/", + "CorsOrigins": "http://localhost:4200,http://localhost:8080,http://localhost:880,http://localhost:3000,http://192.168.3.152:880,http://10.10.0.158:880,http://192.168.1.2:880" }, "Authentication": { "JwtBearer": { @@ -19,7 +19,7 @@ "Kestrel": { "Endpoints": { "Http": { - "Url": "http://10.10.0.158:21021/" + "Url": "http://localhost:21021/" } } } diff --git a/Pages/js/PublicParameters/PublicParameters.js b/Pages/js/PublicParameters/PublicParameters.js index 1cc747f..8d908f7 100644 --- a/Pages/js/PublicParameters/PublicParameters.js +++ b/Pages/js/PublicParameters/PublicParameters.js @@ -1,6 +1,7 @@ //WebApi公共部分url -//var apiUrl = 'http://localhost:21021'; -var apiUrl = 'http://10.10.0.158:21021'; +var apiUrl = 'http://localhost:21021'; +//var apiUrl = 'http://10.10.0.158:21021'; +//var apiUrl = 'http://192.168.1.2:21021'; diff --git a/Pages/page/Graphic/FigureNumber/FigureNumberList.html b/Pages/page/Graphic/FigureNumber/FigureNumberList.html index 5ee2aa5..21ed1c8 100644 --- a/Pages/page/Graphic/FigureNumber/FigureNumberList.html +++ b/Pages/page/Graphic/FigureNumber/FigureNumberList.html @@ -187,7 +187,7 @@ $.ajax({ url: apiUrl + "/api/services/app/FigureNumber/UpdateFigureNumber", //请求的url地址 dataType: "json", //返回格式为json - async: false,//请求是否异步,默认为异步,这也是ajax重要特性 + //async: false,//请求是否异步,默认为异步,这也是ajax重要特性 contentType: 'application/json', data: JSON.stringify({ id: data[index].id, @@ -230,7 +230,7 @@ $.ajax({ url: apiUrl + "/api/services/app/FigureNumber/UpdateFigureNumber", //请求的url地址 dataType: "json", //返回格式为json - async: false,//请求是否异步,默认为异步,这也是ajax重要特性 + //async: false,//请求是否异步,默认为异步,这也是ajax重要特性 contentType: 'application/json', data: JSON.stringify({ id: data.id, diff --git a/Pages/page/Graphic/FigureNumber/addFigureNumber.html b/Pages/page/Graphic/FigureNumber/addFigureNumber.html index 7ff4c36..e0f7651 100644 --- a/Pages/page/Graphic/FigureNumber/addFigureNumber.html +++ b/Pages/page/Graphic/FigureNumber/addFigureNumber.html @@ -60,7 +60,7 @@ $.ajax({ url: apiUrl + "/api/services/app/FigureNumber/CreateFigureNumber", //请求的url地址 dataType: "json", //返回格式为json - async: false,//请求是否异步,默认为异步,这也是ajax重要特性 + //async: false,//请求是否异步,默认为异步,这也是ajax重要特性 contentType: 'application/json', data: JSON.stringify({ figureNum: figureNum, diff --git a/Pages/page/table/addUser.html b/Pages/page/table/addUser.html index 8ba1877..7dbbb40 100644 --- a/Pages/page/table/addUser.html +++ b/Pages/page/table/addUser.html @@ -96,7 +96,7 @@ var password = b64_md5(data.field.password); var CurrUserInfo = layui.sessionData('CurrUserInfo'); $.ajax({ - url: apiUrl + "/api/services/app/UserInfo/Create", //请求的url地址 + url: apiUrl + "/api/services/app/UserInfo/CreateUser", //请求的url地址 dataType: "json", //返回格式为json //async: false,//请求是否异步,默认为异步,这也是ajax重要特性 contentType: 'application/json', @@ -118,13 +118,23 @@ type: "POST", //请求方式 success: function (req) { //请求成功时处理 - layer.msg('保存成功', { time: 1000 }, function () { - // 关闭弹出层 - var iframeIndex = parent.layer.getFrameIndex(window.name); - // 刷新父页面 - window.parent.location.reload(); - parent.layer.close(iframeIndex); - }); + if (req.result.code == 1) { + layer.msg('保存成功', { time: 1000 }, function () { + // 关闭弹出层 + var iframeIndex = parent.layer.getFrameIndex(window.name); + // 刷新父页面 + window.parent.location.reload(); + parent.layer.close(iframeIndex); + }); + } + else if (req.result.code == 2) { + layer.msg(req.result.msg); + return false; + } + else { + layer.msg(req.result.msg); + return false; + } }, error: function () { /*错误信息处理*/ diff --git a/部署报错解决方法/解决方法.txt b/部署报错解决方法/解决方法.txt index f929b4f..92bd9a9 100644 --- a/部署报错解决方法/解决方法.txt +++ b/部署报错解决方法/解决方法.txt @@ -1,3 +1,8 @@ ASP.NET Core部署在IIS中后,报无法打开登录所请求的数据库 "xxxx"。登录失败 + https://blog.csdn.net/zhuyu19911016520/article/details/78241825 +ABP PUT、DELETE请求错误405.0 - Method Not Allowed 因为使用了无效方法(HTTP 谓词) 引发客户端错误 No 'Access-Control-Allow-Origin' header is present on the requested resource + +https://www.cnblogs.com/donaldtdz/p/8094300.html +