71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
using AUTS.Domain.Entities;
|
|
using AUTS.Domain.ViewModels;
|
|
using AUTS.Services.Cache;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
|
|
namespace AUTS.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"),
|
|
};
|
|
|
|
}
|
|
|
|
[HttpGet]
|
|
public HttpResponseMessage ClearCache(string cmd,string dbName)
|
|
{
|
|
ReturnResult result = new ReturnResult();
|
|
result.Message = "false";
|
|
result.Status = 400;
|
|
if (cmd != null && cmd.ToLower() == "up" &&dbName!=null)
|
|
{
|
|
dbName = dbName.ToLower();
|
|
var db = new Uts_ManageEntities();
|
|
if(db.TBL_UTS_Manage_DBList.SingleOrDefault(e => e.DatabaseName == dbName).ID > 0)
|
|
{
|
|
CacheHelp.ClearUserDBProjectList(dbName);
|
|
CacheHelp.ClearUserDBStationList(dbName);
|
|
CacheHelp.ClearUserDBOrderList(dbName);
|
|
CacheHelp.ClearUserDBOrderIList(dbName);
|
|
result.Message = "pass";
|
|
result.Status = 200;
|
|
}
|
|
}
|
|
|
|
//OBJ转化成JSON
|
|
string json = JsonConvert.SerializeObject(result);
|
|
|
|
//返回json数
|
|
return new HttpResponseMessage()
|
|
{
|
|
Content = new StringContent(json, Encoding.UTF8, "application/json"),
|
|
};
|
|
|
|
}
|
|
}
|
|
}
|