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信息列表 /// /// 获取FC信息列表 /// /// FO编码 /// FC状态 /// 创建日期起 /// 创建日期止 /// 修改日期起 /// 修改日期止 /// FC信息列表 [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 } }