新增 Mjpegplayer 用来播放 Web 流
This commit is contained in:
75
SHH.MjpegPlayer/Server/CoreImagesService.cs
Normal file
75
SHH.MjpegPlayer/Server/CoreImagesService.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using Ayay.SerilogLogs;
|
||||
using Core.WcfProtocol;
|
||||
using Serilog;
|
||||
|
||||
namespace SHH.MjpegPlayer
|
||||
{
|
||||
/// <summary>
|
||||
/// CoreImagesService 服务
|
||||
/// </summary>
|
||||
public class CoreImagesService : ICoreImagesService
|
||||
{
|
||||
private static readonly ILogger _sysLog = Log.ForContext("SourceContext", LogModules.Core);
|
||||
|
||||
#region Defines
|
||||
|
||||
/// <summary>
|
||||
/// 按秒统计
|
||||
/// </summary>
|
||||
public static SumByTime _sumBySecond = new SumByTime();
|
||||
|
||||
#endregion
|
||||
|
||||
#region UploadImage
|
||||
|
||||
/// <summary>
|
||||
/// 上传图片
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
public UploadImageReply UploadImage(UploadImageRequest req)
|
||||
{
|
||||
var reply = new UploadImageReply();
|
||||
|
||||
try
|
||||
{
|
||||
// 日志准备
|
||||
_sumBySecond.Refresh("UploadImage");
|
||||
|
||||
PrismMsg<UploadImageRequest>.Publish(req);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_sysLog.Warning($"上传图片失败, {ex.Message} {ex.StackTrace}");
|
||||
reply.ReplyFalt(ex.Message, ex.Source);
|
||||
}
|
||||
|
||||
reply.ReplySuccess();
|
||||
return reply;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UploadImageOneWay
|
||||
|
||||
/// <summary>
|
||||
/// 上传图片
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
public void UploadImageOneWay(UploadImageRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
_sumBySecond.Refresh("UploadImage");
|
||||
|
||||
PrismMsg<UploadImageRequest>.Publish(req);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_sysLog.Warning($"上传图片失败, {ex.Message} {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user