using Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BLW_Log.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RCUController : ControllerBase
    {
         /// <summary>
        /// 登录接口
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost()]
        public async Task<ReturnInfo> Login(LoginData data)
        {
            ReturnInfo r = new ReturnInfo();
            try
            {
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add("username", data.username??"");
                dic.Add("password", data.password??"");
                r = await Http.HttpPostSendData(dic, "/api/LogSystemloginNew");
            }
            catch (Exception ex)
            {
                r.isok = false;
                r.response = ex.Message;
            }
            return r;
        }
        /// <summary>
        /// 获取RCU的状态
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost()]
        public async Task<ReturnInfo> GetRCUStatus(dynamic data)
        {
            ReturnInfo r = new ReturnInfo();
            try
            {
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add("code", data.code);
                dic.Add("creatDate", data.creatDate);
                dic.Add("roomNumber", data.roomNumber);
                r = await Http.HttpGetSendData(dic, "/api/GetRCUStatus");
            }
            catch (Exception ex)
            {
                r.isok = false;
                r.response = ex.Message;
            }
            return r;
        }
    }
}
