| | |
| | | /// <returns></returns> |
| | | [Route("GetRealValue")] |
| | | [HttpGet] |
| | | public async Task<IStation.Dto.ApiResult> GetRealValue() |
| | | public IStation.Dto.ApiResult GetRealValue() |
| | | { |
| | | var d = ZyConnectHelper.GetRealReservoirWaterLevel(); |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取实时值 |
| | | /// 获取最后一条 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("GetLastPredictValue")] |
| | |
| | | return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = ex.Message }; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取最后一条 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("GetPredictRecordBySingleHour")] |
| | | [HttpGet] |
| | | public IStation.Dto.ApiResult GetPredictRecordBySingleHour(DateTime time) |
| | | { |
| | | try |
| | | { |
| | | IStation.DAL.WaterPredictRecord dal = new DAL.WaterPredictRecord(); |
| | | var records = dal.GetBySingleHour(time); |
| | | if (records == null ) |
| | | { |
| | | return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = "数据为空" }; |
| | | } |
| | | return new IStation.Dto.ApiResult<IStation.Model.WaterPredictRecord>() { Code = ApiResultCode.Error, Data = records }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取最后一条 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("GetPredictRecordByHourRange")] |
| | | [HttpGet] |
| | | public IStation.Dto.ApiResult GetPredictRecordByHourRange(string start_time, string end_time) |
| | | { |
| | | if (string .IsNullOrEmpty(start_time) || string .IsNullOrEmpty(end_time)) |
| | | { |
| | | return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = "start_time 或者 end_time 数据为空" }; |
| | | } |
| | | try |
| | | { |
| | | IStation.DAL.WaterPredictRecord dal = new DAL.WaterPredictRecord(); |
| | | var records = dal.GetByHourRangle(DateTime.Parse( start_time), DateTime.Parse(end_time)); |
| | | if (records == null) |
| | | { |
| | | return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = "数据为空" }; |
| | | } |
| | | return new IStation.Dto.ApiResult<List<IStation.Model.WaterPredictRecord>>() { Code = ApiResultCode.Error, Data = records }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 获取今日预测值(24点时) |