Files
Web_Faces_Prod/Face.Web/API/CommonController.cs

37 lines
905 B
C#
Raw Permalink Normal View History

2025-11-25 17:41:24 +08:00
using Face.Domain.ViewModels;
using Face.Services.Cache;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace Face.Web.API
{
public class CommonController : ApiController
{
[HttpGet]
public HttpResponseMessage GetIP()
{
ReturnResult<object> result = new ReturnResult<object>
{
Status = 200,
Data = System.Web.HttpContext.Current.Request.UserHostAddress
};
//OBJ转化成JSON
string json = JsonConvert.SerializeObject(result);
//返回json数
return new HttpResponseMessage()
{
Content = new StringContent(json, Encoding.UTF8, "application/json"),
};
}
}
}