性能与跨域设置

This commit is contained in:
Jimmy 2021-01-16 16:19:10 +08:00
parent 4fc43a0298
commit e0c194524b
12 changed files with 85 additions and 36 deletions

View File

@ -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<Entitys.Graphic.FigureNumber.FigureNumber>(input);
_FigureNumberRepository.InsertAndGetId(entity);
_FigureNumberRepository.InsertAndGetId(ObjectMapper.Map<Entitys.Graphic.FigureNumber.FigureNumber>(input));
//base.CreateAsync(input);
result.code = 1;//成功
result.msg = "保存成功!";
@ -51,7 +50,7 @@ namespace MineTec.ProManager.FigureNumber
return result;
}
public async Task<FigureNumberOutPut> GetAllFigureNumber(GetAllFigureNumber input)
public FigureNumberOutPut GetAllFigureNumber(GetAllFigureNumber input)
{
var result = new FigureNumberOutPut();

View File

@ -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<Entitys.Graphic.GalleryFiles.GalleryFiles>(input));
//base.CreateAsync(input);
result.code = 1;//成功
result.msg = "保存成功!";
}
@ -51,7 +52,7 @@ namespace MineTec.ProManager.GalleryFiles
return result;
}
public async Task<GalleryFilesOutPut> 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<OutputBase> UpdateGalleryFiles(UpdateGalleryFiles input)
public OutputBase UpdateGalleryFiles(UpdateGalleryFiles input)
{
var result = new OutputBase();

View File

@ -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<Entitys.Graphic.GalleryInformation.GalleryInformation>(input));
//base.CreateAsync(input);
result.code = 1;//成功
result.msg = "保存成功!";
}
@ -53,7 +54,7 @@ namespace MineTec.ProManager.GalleryInformation
return result;
}
public async Task<GalleryInformationOutPut> 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<OutputBase> UpdateGalleryInformation(UpdateGalleryInformation input)
public OutputBase UpdateGalleryInformation(UpdateGalleryInformation input)
{
var result = new OutputBase();

View File

@ -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<Entitys.Graphic.MaterialNumber.MaterialNumber>(input));
//base.CreateAsync(input);
result.code = 1;//成功
result.msg = "保存成功!";
}
@ -48,7 +49,7 @@ namespace MineTec.ProManager.MaterialNumber
return result;
}
public async Task<MaterialNumberOutput> 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<OutputBase> UpdateMaterialNumber(UpdateMaterialNumber input)
public OutputBase UpdateMaterialNumber(UpdateMaterialNumber input)
{
var result = new OutputBase();

View File

@ -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<Entitys.Graphic.ProductNumber.ProductNumber>(input));
//base.CreateAsync(input);
result.code = 1;//成功
result.msg = "保存成功!";
}
@ -49,7 +50,7 @@ namespace MineTec.ProManager.ProductNumber
return result;
}
public async Task<ProductNumberOutput> 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<OutputBase> UpdateProductNumber(UpdateProductNumber input)
public OutputBase UpdateProductNumber(UpdateProductNumber input)
{
var result = new OutputBase();

View File

@ -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<Entitys.UserInfo, Guid> repository)
private readonly IRepository<Entitys.UserInfo, Guid> _UserRepository;
public UserInfoAppService(IRepository<Entitys.UserInfo, Guid> repository, IRepository<Entitys.UserInfo, Guid> UserRepository)
: base(repository)
{
_UserRepository = UserRepository;
}
public override Task<UserInfoDto> CreateAsync(CreateUpdateUserInfoDto input)
@ -26,7 +29,34 @@ namespace MineTec.ProManager.UserInfo
return base.CreateAsync(input);
}
public async Task<PagedResultDto<UserInfoDto>> 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<Entitys.UserInfo>(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<UserInfoDto> 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<UserInfoOutput> GetAllUsers(GetAllUsers input)
public UserInfoOutput GetAllUsers(GetAllUsers input)
{
var result = new UserInfoOutput();

View File

@ -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/"
}
}
}

View File

@ -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';

View File

@ -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,

View File

@ -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,

View File

@ -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 () {
/*错误信息处理*/

View File

@ -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