初始化项目
This commit is contained in:
62
AUTS.Web/API/CacheController.cs
Normal file
62
AUTS.Web/API/CacheController.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
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.Web.Http;
|
||||
|
||||
namespace AUTS.Web.API
|
||||
{
|
||||
public class CacheController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
public string ClearCache()
|
||||
{
|
||||
CacheHelp.ClearUserDBProjectList();
|
||||
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
public HttpResponseMessage closeCache([FromBody]string value)
|
||||
{
|
||||
if (value!=""&&value.Length>0)
|
||||
{
|
||||
CacheHelp.ClearUserDBProjectList();
|
||||
}
|
||||
ReturnResult<object> result = new ReturnResult<object>
|
||||
{
|
||||
Status = 200,
|
||||
Data = System.Web.HttpContext.Current.Request.UserHostAddress
|
||||
};
|
||||
|
||||
//OBJ转化成JSON
|
||||
string json = JsonConvert.SerializeObject(result);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, Encoding.UTF8, "application/json"),
|
||||
};
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
43
AUTS.Web/API/CacheController1.cs
Normal file
43
AUTS.Web/API/CacheController1.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace AUTS.Web.API
|
||||
{
|
||||
public class CacheController1 : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
public string Get(int id)
|
||||
{
|
||||
return "value";
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
public void Post([FromBody]string value)
|
||||
{
|
||||
if (value!=""&&value.Length>0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
62
AUTS.Web/API/ClearCacheController.cs
Normal file
62
AUTS.Web/API/ClearCacheController.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
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.Web.Http;
|
||||
|
||||
namespace AUTS.Web.API
|
||||
{
|
||||
public class ClearCacheController : ApiController
|
||||
{
|
||||
// GET api/<controller>
|
||||
public IEnumerable<string> Get()
|
||||
{
|
||||
return new string[] { "value1", "value2" };
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string ClearC()
|
||||
{
|
||||
CacheHelp.ClearUserDBProjectList();
|
||||
|
||||
return "value";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage show([FromBody]string value)
|
||||
{
|
||||
if (value!=""&&value.Length>0)
|
||||
{
|
||||
CacheHelp.ClearUserDBProjectList();
|
||||
}
|
||||
ReturnResult<object> result = new ReturnResult<object>
|
||||
{
|
||||
Status = 200,
|
||||
Data = System.Web.HttpContext.Current.Request.UserHostAddress
|
||||
};
|
||||
|
||||
//OBJ转化成JSON
|
||||
string json = JsonConvert.SerializeObject(result);
|
||||
|
||||
return new HttpResponseMessage()
|
||||
{
|
||||
Content = new StringContent(json, Encoding.UTF8, "application/json"),
|
||||
};
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
public void Put(int id, [FromBody]string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
70
AUTS.Web/API/CommonController.cs
Normal file
70
AUTS.Web/API/CommonController.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
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"),
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user