37 lines
905 B
C#
37 lines
905 B
C#
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"),
|
|
};
|
|
|
|
}
|
|
}
|
|
}
|