using EasyBL;
using EasyBL.WebApi.Filters;
using EasyBL.WEBAPP;
using EasyBL.WEBAPP.SYS;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Web.Http;
namespace WebApp.Controllers
{
public class ServiceController : ApiController
{
///
/// 获取token
///
///
///
///
///
[HttpGet]
[ApiSecurityFilter]
public HttpResponseMessage GetToken(string orgId, string userId, string pasWd)
{
return new BaseAuthorizeService().GetToken(orgId, userId, pasWd);
}
///
/// 後臺登陸
///
///
///
[HttpPost]
[ApiSecurityFilter]
public HttpResponseMessage GetLogin([FromBody]dynamic data)
{
try
{
return new AuthorizeService().GetLogin(data, Request);
}
catch (Exception ex)
{
var sMsg = Util.GetLastExceptionMsg(ex);
LogService.MailSend(sMsg + @"Param:", ex, @"TE", @"apadmin", nameof(ServiceController), @"登陸", @"GetLogin(系統登陸)", @"", @"", @"");
return null;
}
}
//用Filter搜尋服務
[HttpGet]
public HttpResponseMessage GetServiceList(string Lang, string RegionID, string CountryID, string CityID, string SubCategoryID)
{
List rsRegionID = new List();
List rsCountryID = new List();
List rsCityID = new List();
List rsSubCategoryIDs = new List();
if (!string.IsNullOrEmpty(RegionID))
{
rsRegionID = JsonConvert.DeserializeObject>(RegionID);
}
if (!string.IsNullOrEmpty(CountryID))
{
rsCountryID = JsonConvert.DeserializeObject>(CountryID);
}
if (!string.IsNullOrEmpty(CityID))
{
rsCityID = JsonConvert.DeserializeObject>(CityID);
}
if (!string.IsNullOrEmpty(SubCategoryID))
{
rsSubCategoryIDs = JsonConvert.DeserializeObject>(SubCategoryID);
}
return new Services2Service().GetServiceList(Lang, rsRegionID, rsCountryID, rsCityID, rsSubCategoryIDs);
//return new ServicesService().GetServiceList(Lang, rsRegionID, rsCountryID, rsCityID, rsSubCategoryIDs);
}
}
}