新增文件控制

development
温天培 2 years ago
parent fc8c4cab4b
commit 931238bff1

@ -2,42 +2,48 @@
using SqlSugar; using SqlSugar;
using System.ComponentModel; using System.ComponentModel;
using GDZZ.Core.Entity; using GDZZ.Core.Entity;
using System.Collections.Generic;
namespace GDZZ.Application.Entity namespace GDZZ.Application.Entity
{ {
/// <summary> /// <summary>
/// 课程表 /// 课程表
/// </summary> /// </summary>
[SugarTable("mini_course")] [SugarTable("mini_course")]
[Description("课程表")] [Description("课程表")]
public class Course : DEntityBase public class Course : DEntityBase
{ {
/// <summary> /// <summary>
/// 文件ID字段 /// 文件描述
/// </summary> /// </summary>
public long FileID { get; set; } public string Info { get; set; }
/// <summary> /// <summary>
/// 文件描述 /// 标价
/// </summary> /// </summary>
public string Info { get; set; } public decimal Price { get; set; }
/// <summary> /// <summary>
/// 标价 /// 标签
/// </summary> /// </summary>
public decimal Price { get; set; } public string Tags { get; set; }
/// <summary> /// <summary>
/// 标签 /// 缩略图
/// </summary> /// </summary>
public string Tags { get; set; } public string Url { get; set; }
/// <summary> /// <summary>
/// 缩略图 /// 标题
/// </summary> /// </summary>
public string Url { get; set; } public string Title { get; set; }
/// <summary> /// <summary>
/// 标题 /// 是否免费
/// </summary> /// </summary>
public string Title { get; set; } public int IsFree { get; set; }
/// <summary>
/// 是否免费 /// <summary>
/// </summary> /// 文件列表
public int IsFree { get; set; } /// </summary>
} [Navigate(NavigateType.OneToMany, nameof(SysFile.CID))]
public List<SysFile> SysFiles { get; set; }
}
} }

@ -149,11 +149,6 @@
课程表 课程表
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Application.Entity.Course.FileID">
<summary>
文件ID字段
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Course.Info"> <member name="P:GDZZ.Application.Entity.Course.Info">
<summary> <summary>
文件描述 文件描述
@ -184,6 +179,11 @@
是否免费 是否免费
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Application.Entity.Course.SysFiles">
<summary>
文件列表
</summary>
</member>
<member name="T:GDZZ.Application.Entity.FeedBack"> <member name="T:GDZZ.Application.Entity.FeedBack">
<summary> <summary>
意见反馈 意见反馈
@ -1358,11 +1358,6 @@
主键Id 主键Id
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Application.CourseDto.FileID">
<summary>
文件ID字段
</summary>
</member>
<member name="P:GDZZ.Application.CourseDto.Info"> <member name="P:GDZZ.Application.CourseDto.Info">
<summary> <summary>
文件描述 文件描述
@ -1393,11 +1388,6 @@
课程表输入参数 课程表输入参数
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Application.CourseInput.FileID">
<summary>
文件ID字段
</summary>
</member>
<member name="P:GDZZ.Application.CourseInput.Info"> <member name="P:GDZZ.Application.CourseInput.Info">
<summary> <summary>
文件描述 文件描述
@ -1448,11 +1438,6 @@
主键Id 主键Id
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Application.CourseOutput.FileID">
<summary>
文件ID字段
</summary>
</member>
<member name="P:GDZZ.Application.CourseOutput.Info"> <member name="P:GDZZ.Application.CourseOutput.Info">
<summary> <summary>
文件描述 文件描述
@ -1483,6 +1468,11 @@
视频路径 视频路径
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Application.CourseOutput.sysFile">
<summary>
课程视频对象
</summary>
</member>
<member name="T:GDZZ.Application.FeedBackDto"> <member name="T:GDZZ.Application.FeedBackDto">
<summary> <summary>
意见反馈输出参数 意见反馈输出参数

@ -76,7 +76,7 @@ namespace GDZZ.Application.Service.Auth
/// 手机端登录 /// 手机端登录
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost("Mini/SignIn")] [HttpPost("/Mini/SignIn")]
[AllowAnonymous] [AllowAnonymous]
public async Task<AuthUserOut> SignInAsync(PhoneModel phoneModel) public async Task<AuthUserOut> SignInAsync(PhoneModel phoneModel)
{ {
@ -233,7 +233,7 @@ namespace GDZZ.Application.Service.Auth
/// 获取当前登录用户信息 /// 获取当前登录用户信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("Mini/GetLoginUser")] [HttpGet("/Mini/GetLoginUser")]
public async Task<AuthUserOut> GetLoginUserAsync() public async Task<AuthUserOut> GetLoginUserAsync()
{ {
return await this.cacheService.GetUserInfoAsync(UserManager.UserId); return await this.cacheService.GetUserInfoAsync(UserManager.UserId);

@ -8,6 +8,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using GDZZ.Application.Entity; using GDZZ.Application.Entity;
using GDZZ.Core.Entity; using GDZZ.Core.Entity;
using System.Collections.Generic;
namespace GDZZ.Application namespace GDZZ.Application
{ {
@ -18,10 +19,12 @@ namespace GDZZ.Application
public class CourseService : ICourseService, IDynamicApiController, ITransient public class CourseService : ICourseService, IDynamicApiController, ITransient
{ {
private readonly SqlSugarRepository<Course> _rep; private readonly SqlSugarRepository<Course> _rep;
private readonly SqlSugarRepository<SysFile> sysFileRep;
public CourseService(SqlSugarRepository<Course> rep) public CourseService(SqlSugarRepository<Course> rep, SqlSugarRepository<SysFile> sysFileRep)
{ {
_rep = rep; _rep = rep;
this.sysFileRep = sysFileRep;
} }
/// <summary> /// <summary>
@ -33,21 +36,11 @@ namespace GDZZ.Application
public async Task<dynamic> Page([FromQuery] CourseInput input) public async Task<dynamic> Page([FromQuery] CourseInput input)
{ {
var entities = await _rep.AsQueryable() var entities = await _rep.AsQueryable()
.InnerJoin<SysFile>((n, u) => n.FileID == u.Id) .Includes(x=>x.SysFiles)
.Where(x=>x.SysFiles.Any(z=>z.FileSuffix == "mp4"))
.WhereIF(!UserManager.IsTenantAdmin, n => n.CreatedUserId == UserManager.UserId) .WhereIF(!UserManager.IsTenantAdmin, n => n.CreatedUserId == UserManager.UserId)
.WhereIF(!string.IsNullOrWhiteSpace(input.Tags), n => n.Tags == input.Tags) .WhereIF(!string.IsNullOrWhiteSpace(input.Tags), n => n.Tags == input.Tags)
.WhereIF(!string.IsNullOrWhiteSpace(input.Title), n => n.Title == input.Title) .WhereIF(!string.IsNullOrWhiteSpace(input.Title), n => n.Title == input.Title)
.Select((n, u) => new CourseOutput
{
FileID = u.Id,
Id = n.Id,
Info = n.Info,
Price = n.Price,
Tags = n.Tags,
Title = n.Title,
Url = n.Url,
VoiderUrl = "/"+u.FilePath+"/"+u.FileObjectName
})
.ToPagedListAsync(input.PageNo, input.PageSize); .ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult(); return entities.XnPagedResult();
} }
@ -57,7 +50,7 @@ namespace GDZZ.Application
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("/Mini/Course/page")] [HttpPost("/Mini/Course/add")]
public async Task Add(AddCourseInput input) public async Task Add(AddCourseInput input)
{ {
var entity = input.Adapt<Course>(); var entity = input.Adapt<Course>();

@ -13,10 +13,7 @@ namespace GDZZ.Application
/// </summary> /// </summary>
public long Id { get; set; } public long Id { get; set; }
/// <summary>
/// 文件ID字段
/// </summary>
public long FileID { get; set; }
/// <summary> /// <summary>
/// 文件描述 /// 文件描述

@ -9,10 +9,7 @@ namespace GDZZ.Application
/// </summary> /// </summary>
public class CourseInput : PageInputBase public class CourseInput : PageInputBase
{ {
/// <summary>
/// 文件ID字段
/// </summary>
public virtual long FileID { get; set; }
/// <summary> /// <summary>
/// 文件描述 /// 文件描述

@ -1,4 +1,6 @@
using System; using GDZZ.Core.Entity;
using System;
using System.Collections.Generic;
namespace GDZZ.Application namespace GDZZ.Application
{ {
@ -12,10 +14,7 @@ namespace GDZZ.Application
/// </summary> /// </summary>
public long Id { get; set; } public long Id { get; set; }
/// <summary>
/// 文件ID字段
/// </summary>
public long FileID { get; set; }
/// <summary> /// <summary>
/// 文件描述 /// 文件描述
@ -47,6 +46,11 @@ namespace GDZZ.Application
/// </summary> /// </summary>
public string VoiderUrl { get; set; } public string VoiderUrl { get; set; }
/// <summary>
/// 课程视频对象
/// </summary>
public List<SysFile> sysFile { get; set; }
} }
} }

@ -6,13 +6,13 @@ using System.ComponentModel.DataAnnotations;
namespace GDZZ.Core.Entity namespace GDZZ.Core.Entity
{ {
/// <summary> /// <summary>
/// 文件信息表 /// 文件信息表
/// </summary> /// </summary>
[SugarTable("sys_file")] [SugarTable("sys_file")]
[Description("文件信息表")] [Description("文件信息表")]
public class SysFile : DEntityBase public class SysFile : DEntityBase
{ {
/// <summary> /// <summary>
/// 文件存储位置1:阿里云2:腾讯云3:minio4:本地) /// 文件存储位置1:阿里云2:腾讯云3:minio4:本地)
/// </summary> /// </summary>
@ -74,5 +74,14 @@ namespace GDZZ.Core.Entity
[MaxLength(2000)] [MaxLength(2000)]
[SugarColumn(ColumnDescription = "文件描述", IsNullable = true)] [SugarColumn(ColumnDescription = "文件描述", IsNullable = true)]
public string Info { get; set; } public string Info { get; set; }
}
/// <summary>
/// 课件ID
/// </summary>
[SugarColumn(ColumnDescription = "课件ID", IsNullable = true)]
public long CID { get; set; }
}
} }

@ -1100,6 +1100,11 @@
文件描述 文件描述
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Core.Entity.SysFile.CID">
<summary>
课件ID
</summary>
</member>
<member name="T:GDZZ.Core.Entity.SysLogAudit"> <member name="T:GDZZ.Core.Entity.SysLogAudit">
<summary> <summary>
系统操作/审计日志表 系统操作/审计日志表
@ -6037,11 +6042,21 @@
存储路径 存储路径
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Core.Service.FileInput.FileType">
<summary>
文件类型
</summary>
</member>
<member name="P:GDZZ.Core.Service.DeleteFileInfoInput.Id"> <member name="P:GDZZ.Core.Service.DeleteFileInfoInput.Id">
<summary> <summary>
文件Id 文件Id
</summary> </summary>
</member> </member>
<member name="P:GDZZ.Core.Service.BinDingFileInfoInput.VideoIDs">
<summary>
视频列表
</summary>
</member>
<member name="T:GDZZ.Core.Service.FileOutput"> <member name="T:GDZZ.Core.Service.FileOutput">
<summary> <summary>
上传文件参数 上传文件参数
@ -6064,6 +6079,20 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:GDZZ.Core.Service.SysFileService.QueryMP4FileInfoPageList(GDZZ.Core.Service.FileInput)">
<summary>
分页获取MP文件列表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:GDZZ.Core.Service.SysFileService.BinDingFileInfo(GDZZ.Core.Service.BinDingFileInfoInput)">
<summary>
排课
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:GDZZ.Core.Service.SysFileService.GetFileInfoList(GDZZ.Core.Service.FileOutput)"> <member name="M:GDZZ.Core.Service.SysFileService.GetFileInfoList(GDZZ.Core.Service.FileOutput)">
<summary> <summary>
获取文件列表 获取文件列表

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace GDZZ.Core.Service; namespace GDZZ.Core.Service;
@ -47,6 +48,11 @@ public class FileInput : PageInputBase
/// 存储路径 /// 存储路径
/// </summary> /// </summary>
public string FilePath { get; set; } public string FilePath { get; set; }
/// <summary>
/// 文件类型
/// </summary>
public int FileType { get; set; }
} }
public class DeleteFileInfoInput public class DeleteFileInfoInput
@ -62,3 +68,13 @@ public class QueryFileInoInput : DeleteFileInfoInput
{ {
} }
public class BinDingFileInfoInput: DeleteFileInfoInput
{
/// <summary>
/// 视频列表
/// </summary>
public List<long> VideoIDs { get; set; }
}

@ -55,6 +55,57 @@ public class SysFileService : ISysFileService, IDynamicApiController, ITransient
return files.XnPagedResult(); return files.XnPagedResult();
} }
/// <summary>
/// 分页获取MP文件列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/sysFileInfo/mppage")]
public async Task<dynamic> QueryMP4FileInfoPageList([FromQuery] FileInput input)
{
var fileBucket = !string.IsNullOrEmpty(input.FileBucket?.Trim());
var fileOriginName = !string.IsNullOrEmpty(input.FileOriginName?.Trim());
//rmrf-
var files = await _sysFileInfoRep.AsQueryable()
.WhereIF(input.FileLocation > 0, u => u.FileLocation == input.FileLocation)
.Where(u=>u.FileSuffix =="MP4")
.WhereIF(input.FileType == 1,u=> u.CID == 0)
.WhereIF(input.FileType == 2, u => u.CID != 0)
.WhereIF(!UserManager.IsSuperAdmin, u => u.CreatedUserId == UserManager.UserId)
.WhereIF(!string.IsNullOrWhiteSpace(input.FileBucket), u => u.FileBucket.Contains(input.FileBucket.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.FileOriginName), u => u.FileOriginName.Contains(input.FileOriginName.Trim()))
.Select<FileOutput>()
.ToPagedListAsync(input.PageNo, input.PageSize);
return files.XnPagedResult();
}
/// <summary>
/// 排课
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/sysFileInfo/binding")]
public async Task BinDingFileInfo(BinDingFileInfoInput input)
{
foreach (var item in input.VideoIDs)
{
var file = await _sysFileInfoRep.FirstOrDefaultAsync(u => u.Id == item);
if (file != null)
{
file.CID = input.Id;
await _sysFileInfoRep.UpdateAsync(file);
}
}
}
/// <summary> /// <summary>
/// 获取文件列表 /// 获取文件列表
/// </summary> /// </summary>

Loading…
Cancel
Save