MerchantAmountSummayController.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.Extensions.Logging;
  7. using Microsoft.Extensions.Options;
  8. using Microsoft.AspNetCore.Authorization;
  9. using System.Web;
  10. using MySystem.Service.Main;
  11. using MySystem.Models;
  12. using LitJson;
  13. using Library;
  14. namespace MySystem.Areas.Api.Controllers.v1
  15. {
  16. [Area("Api")]
  17. [Route("/v1/qrcodeplatemain/[controller]/[action]")]
  18. public class MerchantAmountSummayController : BaseController
  19. {
  20. public MerchantAmountSummayController(IHttpContextAccessor accessor) : base(accessor)
  21. {
  22. }
  23. #region 已激活商户-达标信息列表
  24. // [Authorize]
  25. public JsonResult List(string value)
  26. {
  27. value = PublicFunction.DesDecrypt(value); ;
  28. JsonData data = JsonMapper.ToObject(value);
  29. List<Dictionary<string, object>> dataList = ListDo(value);
  30. return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
  31. }
  32. private List<Dictionary<string, object>> ListDo(string value)
  33. {
  34. JsonData data = JsonMapper.ToObject(value);
  35. int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户
  36. int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
  37. int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
  38. List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
  39. dataList = MerchantAmountSummayUtil.ListDo(MerchantId, pageSize, pageNum);
  40. return dataList;
  41. }
  42. #endregion
  43. #region 检查签名是否合法,合法返回1,不合法返回提示信息
  44. /// <summary>
  45. /// 检查签名是否合法,合法返回1,不合法返回提示信息
  46. /// </summary>
  47. /// <param name="value">请求的参数(json字符串)</param>
  48. /// <param name="signField">要签名的字段</param>
  49. /// <returns></returns>
  50. private string CheckSign(string value, string[] signField)
  51. {
  52. JsonData json = JsonMapper.ToObject(value);
  53. Dictionary<string, string> dic = new Dictionary<string, string>();
  54. for (int i = 0; i < signField.Length; i++)
  55. {
  56. dic.Add(signField[i], json[signField[i]].ToString());
  57. }
  58. string sign = json["sign"].ToString(); //客户端签名字符串
  59. return new Sign().sign(dic, sign);
  60. }
  61. #endregion
  62. }
  63. }