initFCL
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
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 FCController: 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 = "fc_admin";
|
||||
var _mypassword = "fc$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 获取FC信息列表
|
||||
/// <summary>
|
||||
/// 获取FC信息列表
|
||||
/// </summary>
|
||||
/// <param name="foCode">FO编码</param>
|
||||
/// <param name="fcStatus">FC状态</param>
|
||||
/// <param name="startCreateTime">创建日期起</param>
|
||||
/// <param name="endCreateTime">创建日期止</param>
|
||||
/// <param name="startUpdateTime">修改日期起</param>
|
||||
/// <param name="endUpdateTime">修改日期止</param>
|
||||
/// <returns>FC信息列表</returns>
|
||||
[HttpGet]
|
||||
[Validate]
|
||||
public Model.ResponeData GetFCInfoList(string foCode, string fcStatus, 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.APIFCLService.GetFCList(foCode, fcStatus, startCreateTime, endCreateTime, startUpdateTime, endUpdateTime);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.success = false;
|
||||
responeData.code = 1010;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user