12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.Data.Entity;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Web.Http;
- using Serilog;
- using XdCxRhDw.Dto;
- using XdCxRhDW.App.Api;
- using XdCxRhDW.Core.Api;
- using XdCxRhDW.Dto;
- namespace XdCxRhDW.WebApi.Controllers
- {
- /// <summary>
- /// 星历推算功能相关接口
- /// </summary>
- public class XlController : BaseController
- {
- /// <summary>
- /// 推算某个时间点星历
- /// </summary>
- /// <param name="dto">推算参数</param>
- /// <returns></returns>
- [HttpPost]
- [CustomValidation(typeof(XlCalcDto), "Validate")]
- public AjaxResult<SatEphDto> Calc(XlCalcDto dto)
- {
- try
- {
- var p = EphHelper.Calc(dto.tleStr, dto.dt);
- return Success(new SatEphDto()
- {
- SatId = p.SatId,
- SatTime = p.SatTime,
- TleTime = p.TleTime,
- X = p.X,
- Y = p.Y,
- Z = p.Z,
- VX = p.VX,
- VY = p.VY,
- VZ = p.VZ,
- });
- }
- catch (Exception ex)
- {
- return Error<SatEphDto>(ex.Message);
- }
- }
- /// <summary>
- /// 推算某个时间段星星历
- /// </summary>
- /// <param name="dto">推算参数</param>
- /// <returns></returns>
- [HttpPost]
- [CustomValidation(typeof(XlCalcMultDto), "Validate")]
- public AjaxResult<List<EphResDto>> CalcMult(XlCalcMultDto dto)
- {
- try
- {
- var eph = EphHelper.CalcMult(dto.tleStr, dto.start, dto.end, dto.spanSeconds);
- return Success(eph.Select(p => new EphResDto()
- {
- SatId = p.SatId,
- SatTime = p.SatTime,
- TleTime = p.TleTime,
- X = p.X,
- Y = p.Y,
- Z = p.Z,
- VX = p.VX,
- VY = p.VY,
- VZ = p.VZ,
- }).ToList());
- }
- catch (Exception ex)
- {
- return Error<List<EphResDto>>(ex.Message);
- }
- }
- }
- }
|