using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebApi.Filter;
using Model;
namespace WebApi.Controllers
{
public class EprojectController: ApiController
{
[HttpPost]
public Model.ResponeData GetLogin([FromBody] LoginInput input)
{
var responeData = new Model.ResponeData();
if (string.IsNullOrEmpty(input.username) && string.IsNullOrEmpty(input.password))
{
responeData.code = 1001;
responeData.message = "用户名或密码不能为空";
return responeData;
}
//加密token
var token = BLL.CommonService.Base64Code($"{input.username}{input.password}");
//读取config配置文件的数据
var _myusername = "eproject_admin";
var _mypassword = "eproject$P@ssW0rd";
var _mytoken = BLL.CommonService.Base64Code($"{_myusername}{_mypassword}");
if (!token.Equals(_mytoken))
{
responeData.code = 1002;
responeData.message = "用户名或密码不正确";
return responeData;
}
responeData.code = 1000;
responeData.data = token;
responeData.message = "登录成功";
return responeData;
}
#region 获取EProject信息列表
///
/// 获取EProject信息列表
///
/// 任务代码
/// 任务状态
/// 创建日期起
/// 创建日期止
/// 修改日期起
/// 修改日期止
/// EProject信息列表
[HttpGet]
[Validate]
public Model.ResponeData GetEprojectInfoList(string jobNo, string jobStatus, DateTime? startCreateTime, DateTime? endCreateTime, DateTime? startUpdateTime, DateTime? endUpdateTime)
{
var responeData = new Model.ResponeData();
responeData.timestamp = BLL.Funs.DateTimeToTimestamp(DateTime.Now).ToString();
try
{
responeData.data = BLL.APIEpojectService.GetEprojectList(jobNo, jobStatus, startCreateTime, endCreateTime, startUpdateTime, endUpdateTime);
}
catch (Exception ex)
{
responeData.success = false;
responeData.code = 1010;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}