44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using DataServer.api;
|
|
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;
|
|
using System.Web.Http;
|
|
|
|
namespace JinanCementFactoryAPI.Controllers.api
|
|
{
|
|
/// <summary>
|
|
/// 负荷调控策略
|
|
/// </summary>
|
|
public class GetLoadControlStrategyController : ApiController
|
|
{
|
|
DataServer.BLL.adjustable_load bll = new DataServer.BLL.adjustable_load();
|
|
// GET api/<controller>
|
|
public HttpResponseMessage Get()
|
|
{
|
|
var res = new get_load_control_strategy();
|
|
try
|
|
{
|
|
var alist = new List<load_control_strategyData>();
|
|
var model = new load_control_strategyData() { LevelRegulation = "一级", Target = 1500, ExecutionTime = "4小时" };
|
|
alist.Add(model);
|
|
var newData = new load_control_strategyData() { LevelRegulation = "二级", Target = 6000, ExecutionTime = "6小时" };
|
|
alist.Add(newData);
|
|
res.code = 200;
|
|
res.msg = "成功";
|
|
res.data = alist;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.code = 500;
|
|
res.msg = ex.Message;
|
|
}
|
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
|
return result;
|
|
}
|
|
}
|
|
} |