diff --git a/GDZZ.Application/Service/Annex/AnnexService.cs b/GDZZ.Application/Service/Annex/AnnexService.cs
index 5af3572..84d09e6 100644
--- a/GDZZ.Application/Service/Annex/AnnexService.cs
+++ b/GDZZ.Application/Service/Annex/AnnexService.cs
@@ -67,8 +67,6 @@ namespace GDZZ.Application
}
-
-
///
/// 增加附件管理
///
@@ -79,22 +77,24 @@ namespace GDZZ.Application
public async Task Add(IFormFile file,string FileName)
{
- var entity = await this._rep.AsQueryable().Where(x => x.CreatedUserId == UserManager.UserId).FirstAsync();
+ var entity = await this._rep.Where(x => x.CreatedUserId == UserManager.UserId).FirstAsync();
var fileInfo =await Utils.UploadFile(file, this._options.Default.path, FileLocation.LOCAL);
if (fileInfo == null)
throw new Exception("文件上传失败!");
- entity.FileName = FileName;
- entity.FileSize = file.Length.ToString();
- entity.FileUrl = fileInfo.FileUrl;
- //查询
-
- if(entity != null )
+ if (entity.IsEmpty())
{
- await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+ entity = new Annex();
+ entity.FileName = FileName;
+ entity.FileSize = file.Length.ToString();
+ entity.FileUrl = fileInfo.FileUrl;
+ await _rep.InsertAsync(entity);
}
else
{
- await _rep.InsertAsync(entity);
+ entity.FileName = FileName;
+ entity.FileSize = file.Length.ToString();
+ entity.FileUrl = fileInfo.FileUrl;
+ await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
return entity;
}
@@ -112,7 +112,6 @@ namespace GDZZ.Application
}
-
///
/// 删除附件管理
///
diff --git a/GDZZ.Application/Service/MiniBanner/Dto/MiniBannerInput.cs b/GDZZ.Application/Service/MiniBanner/Dto/MiniBannerInput.cs
index 544d074..b4af50b 100644
--- a/GDZZ.Application/Service/MiniBanner/Dto/MiniBannerInput.cs
+++ b/GDZZ.Application/Service/MiniBanner/Dto/MiniBannerInput.cs
@@ -1,5 +1,6 @@
using GDZZ.Application.Enum;
using GDZZ.Core;
+using Microsoft.AspNetCore.Http;
using System;
using System.ComponentModel.DataAnnotations;
@@ -10,6 +11,7 @@ namespace GDZZ.Application
///
public class MiniBannerInput : PageInputBase
{
+
///
/// 活动名字
///
@@ -37,7 +39,7 @@ namespace GDZZ.Application
public class AddMiniBannerInput : MiniBannerInput
{
-
+
}
public class DeleteMiniBannerInput
diff --git a/GDZZ.Application/Service/MiniBanner/IMiniBannerService.cs b/GDZZ.Application/Service/MiniBanner/IMiniBannerService.cs
index 800c9d5..3270dd3 100644
--- a/GDZZ.Application/Service/MiniBanner/IMiniBannerService.cs
+++ b/GDZZ.Application/Service/MiniBanner/IMiniBannerService.cs
@@ -2,6 +2,8 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
+using Microsoft.AspNetCore.Http;
+
namespace GDZZ.Application
{
public interface IMiniBannerService
diff --git a/GDZZ.Application/Service/MiniBanner/MiniBannerService.cs b/GDZZ.Application/Service/MiniBanner/MiniBannerService.cs
index 223cbb6..7d8533f 100644
--- a/GDZZ.Application/Service/MiniBanner/MiniBannerService.cs
+++ b/GDZZ.Application/Service/MiniBanner/MiniBannerService.cs
@@ -8,6 +8,9 @@ using System.Linq;
using System.Threading.Tasks;
using GDZZ.Application.Entity;
using Microsoft.AspNetCore.Authorization;
+using GDZZ.Application.Help;
+using System;
+using Microsoft.Extensions.Options;
namespace GDZZ.Application
{
@@ -18,10 +21,16 @@ namespace GDZZ.Application
public class MiniBannerService : IMiniBannerService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _rep;
+ private readonly SqlSugarRepository AnnexRep;
+ private readonly UploadFileOptions _options;
- public MiniBannerService(SqlSugarRepository rep)
+ public MiniBannerService(SqlSugarRepository rep,
+ IOptions options,
+ SqlSugarRepository AnnexRep)
{
_rep = rep;
+ this.AnnexRep = AnnexRep;
+ this._options = options.Value;
}
///
@@ -44,10 +53,15 @@ namespace GDZZ.Application
///
///
[HttpPost("/Mini/BannerAdd")]
- public async Task Add(AddMiniBannerInput input)
+ public async Task Add([FromForm] AddMiniBannerInput input)
{
- var entity = input.Adapt();
- await _rep.InsertAsync(entity);
+
+ //var fileInfo = await Utils.UploadFile(input.File, this._options.Default.path, FileLocation.LOCAL);
+ //if (fileInfo == null)
+ // throw new Exception("文件上传失败!");
+ //input.Url = input.FileUrl;
+ var banner = input.Adapt();
+ await _rep.InsertAsync(banner);
}
///
@@ -67,7 +81,7 @@ namespace GDZZ.Application
///
///
///
- [HttpPost("/Mini/BannerEdit")]
+ [HttpPost("/Mini/BannerEdit")]
public async Task Update(UpdateMiniBannerInput input)
{
var entity = input.Adapt();
diff --git a/GDZZ.Core/Hubs/ChatHub.cs b/GDZZ.Core/Hubs/ChatHub.cs
index 3a8ae20..a633f45 100644
--- a/GDZZ.Core/Hubs/ChatHub.cs
+++ b/GDZZ.Core/Hubs/ChatHub.cs
@@ -31,7 +31,7 @@ public class ChatHub : Hub
///
public override async Task OnConnectedAsync()
{
- Console.WriteLine("上线连接");
+
var token = Context.GetHttpContext().Request.Query["access_token"];
var claims = JWTEncryption.ReadJwtToken(token)?.Claims;
var userId = claims.FirstOrDefault(e => e.Type == ClaimConst.CLAINM_USERID)?.Value;
@@ -39,7 +39,8 @@ public class ChatHub : Hub
var name= claims.FirstOrDefault(e => e.Type == ClaimConst.CLAINM_NAME)?.Value;
var tenantId= claims.FirstOrDefault(e => e.Type == ClaimConst.TENANT_ID)?.Value;
var ip = HttpNewUtil.Ip;
- if (await _sysOnlineUerRep.AsQueryable().Filter("TenantId", true).AnyAsync(m => m.Account.Equals(account))) {
+ if (await _sysOnlineUerRep.AsQueryable().Filter("TenantId", true).AnyAsync(m => m.Account.Equals(account)))
+ {
await _sysOnlineUerRep.DeleteAsync(m => m.Account == account && m.LastLoginIp == ip);
}
diff --git a/GDZZ.Core/Service/File/SysFileService.cs b/GDZZ.Core/Service/File/SysFileService.cs
index 11df905..777d4a8 100644
--- a/GDZZ.Core/Service/File/SysFileService.cs
+++ b/GDZZ.Core/Service/File/SysFileService.cs
@@ -195,7 +195,7 @@ public class SysFileService : ISysFileService, IDynamicApiController, ITransient
public async Task UploadFileDefault(IFormFile file)
{
// 可以读取系统配置来决定将文件存储到什么地方
- await UploadFile(file, _options.Default.path, FileLocation.LOCAL);
+ await UploadFile(file, _options.Default.path, FileLocation.LOCAL);
}
///
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494899761672261.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494899761672261.jpg
new file mode 100644
index 0000000..9e468db
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494899761672261.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494903727992902.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494903727992902.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494903727992902.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494903789449286.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494903789449286.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494903789449286.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494904124624966.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494904124624966.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494904124624966.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494904580190278.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494904580190278.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494904580190278.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494904810995782.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494904810995782.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494904810995782.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494905233506373.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494905233506373.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494905233506373.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494906823057477.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494906823057477.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494906823057477.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494907329683526.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494907329683526.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494907329683526.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/494907561394246.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/494907561394246.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/494907561394246.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495094522662982.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495094522662982.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495094522662982.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495246857404486.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495246857404486.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495246857404486.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495251333734470.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495251333734470.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495251333734470.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495476238532678.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495476238532678.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495476238532678.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495874276950086.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495874276950086.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495874276950086.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495876176027718.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495876176027718.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495876176027718.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495888410894405.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495888410894405.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495888410894405.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/495888695603270.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/495888695603270.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/495888695603270.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496863572734022.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496863572734022.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496863572734022.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496863643799622.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496863643799622.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496863643799622.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496865161539654.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496865161539654.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496865161539654.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496865730797637.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496865730797637.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496865730797637.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496867278979142.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496867278979142.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496867278979142.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496867541008454.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496867541008454.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496867541008454.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496867698331718.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496867698331718.jpg
new file mode 100644
index 0000000..c2213e3
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496867698331718.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496868438962246.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496868438962246.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496868438962246.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496879288614982.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496879288614982.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496879288614982.jpg differ
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/496879535095878.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/496879535095878.jpg
new file mode 100644
index 0000000..676cf44
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/496879535095878.jpg differ