更新banner控制

development
温天培 11 months ago
parent 1984a9c1b8
commit 73fb3a7b0e

@ -67,8 +67,6 @@ namespace GDZZ.Application
}
/// <summary>
/// 增加附件管理
/// </summary>
@ -79,22 +77,24 @@ namespace GDZZ.Application
public async Task<Annex> 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
}
/// <summary>
/// 删除附件管理
/// </summary>

@ -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
/// </summary>
public class MiniBannerInput : PageInputBase
{
/// <summary>
/// 活动名字
/// </summary>

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

@ -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<MiniBanner> _rep;
private readonly SqlSugarRepository<Annex> AnnexRep;
private readonly UploadFileOptions _options;
public MiniBannerService(SqlSugarRepository<MiniBanner> rep)
public MiniBannerService(SqlSugarRepository<MiniBanner> rep,
IOptions<UploadFileOptions> options,
SqlSugarRepository<Annex> AnnexRep)
{
_rep = rep;
this.AnnexRep = AnnexRep;
this._options = options.Value;
}
/// <summary>
@ -44,10 +53,15 @@ namespace GDZZ.Application
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/Mini/BannerAdd")]
public async Task Add(AddMiniBannerInput input)
public async Task Add([FromForm] AddMiniBannerInput input)
{
var entity = input.Adapt<MiniBanner>();
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<MiniBanner>();
await _rep.InsertAsync(banner);
}
/// <summary>

@ -31,7 +31,7 @@ public class ChatHub : Hub<IChatClient>
/// <returns></returns>
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<IChatClient>
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);
}

@ -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);
}
/// <summary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Loading…
Cancel
Save