public DvrVideoResponseList GetDvrVideoList(ReqGetDvrVideo rgdv)
        {
            ResponseStruct rs;
            var            ret = MediaServerApis.GetDvrVideoList(rgdv, out rs);

            if (rs.Code != ErrorNumber.None)
            {
                throw new HttpResponseException(JsonHelper.ToJson(rs));
            }
            return(ret);
        }
        /// <summary>
        /// 文件一个一个删除
        /// </summary>
        /// <param name="videoSize"></param>
        /// <param name="sdp"></param>
        private void deleteFileOneByOne(decimal videoSize, StreamDvrPlan sdp)
        {
            var mediaServer = Common.MediaServerList.FindLast(x => x.MediaServerId.Equals(sdp.MediaServerId));

            if (mediaServer == null || !mediaServer.IsRunning)
            {
                return;
            }

            long deleteSize = 0;
            List <OrderByStruct> orderBy = new List <OrderByStruct>();

            orderBy.Add(new OrderByStruct()
            {
                FieldName  = "starttime",
                OrderByDir = OrderByDir.ASC,
            });
            ReqGetDvrVideo rgdv = new ReqGetDvrVideo()
            {
                CameraId       = sdp.CameraId,
                MediaServerId  = sdp.MediaServerId,
                EndTime        = null,
                IncludeDeleted = false,
                OrderBy        = orderBy,
                PageIndex      = 1,
                PageSize       = 10,
                StartTime      = null,
            };

            while (videoSize - deleteSize > sdp.LimitSpace)
            {
                DvrVideoResponseList videoList = MediaServerApis.GetDvrVideoList(rgdv, out ResponseStruct rs);
                if (videoList != null && videoList.DvrVideoList != null && videoList.DvrVideoList.Count > 0)
                {
                    OrmService.Db.Transaction(() =>
                    {
                        foreach (var ret in videoList.DvrVideoList)
                        {
                            if (ret != null)
                            {
                                if (mediaServer.CheckFileExists(ret.VideoPath, out _))
                                {
                                    mediaServer.DeleteFile(ret.VideoPath, out _);
                                    deleteSize += (long)ret.FileSize !;
                                    OrmService.Db.Update <RecordFile>().Set(x => x.UpdateTime, DateTime.Now)
                                    .Set(x => x.Deleted, true)
                                    .Where(x => x.Id == ret !.Id).ExecuteAffrows();
                                    LogWriter.WriteLog("删除录制文件", ret.VideoPath !);
                                    Thread.Sleep(20);
                                }
                            }

                            if ((videoSize - deleteSize) < sdp.LimitSpace)
                            {
                                break;
                            }
                        }
                    });
                }
            }
        }