zhaojs
2023-09-27 74098f1401afe40f961d1d167bb18dd0a71c4d59
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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<string, object> dic = new Dictionary<string, object>();
            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<CreateShortLinkResponse>(res);
            if(!response.error.IsNull())
            {
                return Error(response.error.message);
            }
            return Success(response.result.shortUrl);
        }
    }
}