using CommonUtil; using CommonUtil.Web; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Operater.DTO; using CommonUtil; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Api.Operater.Controllers { [Route(TopConstants.API_ROUTE)] public class ShortLinkController : BaseController { [HttpPost] public IActionResult CreateShortLink([FromBody] CreateShortLinkRequest request) { Dictionary dic = new Dictionary(); dic.Add("Url",request.LongLink); dic.Add("AppName", "operate"); dic.Add("Nick", "欧锦希"); string res = new WebUtil().DoPostWithJson("http://vx8.cc/api/Top/Execute", dic,null); CreateShortLinkResponse response = JSONUtil.JsonToObject(res); if(!response.error.IsNull()) { return Error(response.error.message); } return Success(response.result.shortUrl); } } }