您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

116 行
3.8 KiB

  1. using BPA.KitChen.GroupMeal.Application.BaseDto;
  2. using BPA.KitChen.GroupMeal.Application.Service.Authorization.Dtos;
  3. using BPA.KitChen.GroupMeal.Core.Entity;
  4. using Furion.DatabaseAccessor;
  5. using Furion.DynamicApiController;
  6. using Furion.FriendlyException;
  7. using Microsoft.AspNetCore.Authorization;
  8. using Microsoft.AspNetCore.Mvc;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. namespace BPA.KitChen.GroupMeal.Application.Service.Authorization
  15. {
  16. [ApiDescriptionSettings("授权管理", Tag = "授权管理")]
  17. public class AuthorizationServices: IDynamicApiController
  18. {
  19. private readonly Services.IAuthorizationService _authorizationService;
  20. public AuthorizationServices(Services.IAuthorizationService authorizationService)
  21. {
  22. _authorizationService = authorizationService;
  23. }
  24. /// <summary>
  25. /// 分页店铺授权码
  26. /// </summary>
  27. /// <param name="input"></param>
  28. /// <returns></returns>
  29. [HttpPost("/api/authorization/pagestoreauthorization")]
  30. public async Task<PageUtil> PageStoreAuthorization(PageInputBase input)
  31. {
  32. return await _authorizationService.PageStoreAuthorization(input);
  33. }
  34. /// <summary>
  35. /// 添加店铺授权码
  36. /// </summary>
  37. /// <returns></returns>
  38. [HttpPost("/api/authorization/addstoreauthorization")]
  39. public async Task<bool> AddStoreAuthorization(CreateOrUpDateStoreAuthorizationDto input)
  40. {
  41. return await _authorizationService.AddStoreAuthorization(input);
  42. }
  43. /// <summary>
  44. /// 修改店铺授权码
  45. /// </summary>
  46. /// <param name="id"></param>
  47. /// <returns></returns>
  48. [HttpPost("/api/authorization/updatestoreauthorization")]
  49. public async Task<bool> UpdateStoreAuthorization(string id)
  50. {
  51. return await _authorizationService.UpdateStoreAuthorization(id);
  52. }
  53. /// <summary>
  54. /// 修改店铺授权时间
  55. /// </summary>
  56. /// <param name="input"></param>
  57. /// <returns></returns>
  58. [HttpPost("/api/authorization/updatestoreauthtime")]
  59. public async Task<bool> UpdateStoreAuthTime(CreateOrUpDateStoreAuthorizationDto input)
  60. {
  61. return await _authorizationService.UpdateStoreAuthTime(input);
  62. }
  63. /// <summary>
  64. /// 删除店铺权限
  65. /// </summary>
  66. /// <param name="id"></param>
  67. /// <returns></returns>
  68. [HttpPost("/api/authorization/delstoreauthorization")]
  69. public async Task<bool> DelStoreAuthorization(string id)
  70. {
  71. return await _authorizationService.DelStoreAuthorization(id);
  72. }
  73. /// <summary>
  74. /// 查询店铺授权信息
  75. /// </summary>
  76. /// <param name="id"></param>
  77. /// <returns></returns>
  78. [HttpGet("/api/authorization/GetStoreAuthorizationById")]
  79. public async Task<BPA_StoreAuthorization> GetStoreAuthorizationById(string id)
  80. {
  81. return await _authorizationService.GetStoreAuthorizationById(id);
  82. }
  83. /// <summary>
  84. /// 查询店铺授权信息 更具KEY
  85. /// </summary>
  86. /// <param name="key"></param>
  87. /// <returns></returns>
  88. [HttpGet("/api/authorization/GetStoreAuthorizationByKey"), AllowAnonymous]
  89. public async Task<BPA_StoreAuthorization> GetStoreAuthorizationByKey(string key)
  90. {
  91. return await _authorizationService.GetStoreAuthorizationByKey(key);
  92. }
  93. /// <summary>
  94. /// CodeFirst
  95. /// </summary>
  96. /// <param name="tableNames"></param>
  97. public void CodeFirst()
  98. {
  99. _authorizationService.CodeFirst();
  100. }
  101. }
  102. }