You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. using EasyBL;
  2. using EasyBL.WebApi.Filters;
  3. using EasyBL.WEBAPP;
  4. using EasyBL.WEBAPP.SYS;
  5. using Newtonsoft.Json;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Net.Http;
  9. using System.Web.Http;
  10. namespace WebApp.Controllers
  11. {
  12. public class ServiceController : ApiController
  13. {
  14. /// <summary>
  15. /// 获取token
  16. /// </summary>
  17. /// <param name="orgId"></param>
  18. /// <param name="userId"></param>
  19. /// <param name="pasWd"></param>
  20. /// <returns></returns>
  21. [HttpGet]
  22. [ApiSecurityFilter]
  23. public HttpResponseMessage GetToken(string orgId, string userId, string pasWd)
  24. {
  25. return new BaseAuthorizeService().GetToken(orgId, userId, pasWd);
  26. }
  27. /// <summary>
  28. /// 後臺登陸
  29. /// </summary>
  30. /// <param name="data"></param>
  31. /// <returns></returns>
  32. [HttpPost]
  33. [ApiSecurityFilter]
  34. public HttpResponseMessage GetLogin([FromBody]dynamic data)
  35. {
  36. try
  37. {
  38. return new AuthorizeService().GetLogin(data, Request);
  39. }
  40. catch (Exception ex)
  41. {
  42. var sMsg = Util.GetLastExceptionMsg(ex);
  43. LogService.MailSend(sMsg + @"Param:", ex, @"TE", @"apadmin", nameof(ServiceController), @"登陸", @"GetLogin(系統登陸)", @"", @"", @"");
  44. return null;
  45. }
  46. }
  47. //用Filter搜尋服務
  48. [HttpGet]
  49. public HttpResponseMessage GetServiceList(string Lang, string RegionID, string CountryID, string CityID, string SubCategoryID)
  50. {
  51. List<string> rsRegionID = new List<string>();
  52. List<string> rsCountryID = new List<string>();
  53. List<string> rsCityID = new List<string>();
  54. List<string> rsSubCategoryIDs = new List<string>();
  55. if (!string.IsNullOrEmpty(RegionID))
  56. {
  57. rsRegionID = JsonConvert.DeserializeObject<List<string>>(RegionID);
  58. }
  59. if (!string.IsNullOrEmpty(CountryID))
  60. {
  61. rsCountryID = JsonConvert.DeserializeObject<List<string>>(CountryID);
  62. }
  63. if (!string.IsNullOrEmpty(CityID))
  64. {
  65. rsCityID = JsonConvert.DeserializeObject<List<string>>(CityID);
  66. }
  67. if (!string.IsNullOrEmpty(SubCategoryID))
  68. {
  69. rsSubCategoryIDs = JsonConvert.DeserializeObject<List<string>>(SubCategoryID);
  70. }
  71. return new Services2Service().GetServiceList(Lang, rsRegionID, rsCountryID, rsCityID, rsSubCategoryIDs);
  72. //return new ServicesService().GetServiceList(Lang, rsRegionID, rsCountryID, rsCityID, rsSubCategoryIDs);
  73. }
  74. }
  75. }