Нет описания

WxCustomController.cs 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using CallCenter.Utility;
  2. using CallCenterApi.Interface.Controllers.Base;
  3. using CallCenterAPI.WechatSDK;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. namespace CallCenterApi.Interface.Controllers.weixin
  10. {
  11. public class WxCustomController : BaseController
  12. {
  13. /// <summary>
  14. /// 获取用户聊天记录
  15. /// </summary>
  16. /// <returns></returns>
  17. public ActionResult GetRecordList()
  18. {
  19. ActionResult res = NoToken("未知错误,请重新登录");
  20. if (Request.IsAuthenticated)
  21. {
  22. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  23. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  24. int strpageindex = RequestString.GetInt("pageindex", 1);
  25. int strpagesize = RequestString.GetInt("pagesize", 10);
  26. DateTime stime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
  27. DateTime etime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");
  28. if (strstarttime.Trim() != "" && strendtime != "")
  29. {
  30. stime = DateTime.Parse(strstarttime);
  31. etime = DateTime.Parse(strendtime);
  32. }
  33. var obj = new
  34. {
  35. rows = WxHelper.GetRecord(stime, etime, strpagesize, strpageindex),
  36. total = 0
  37. };
  38. res = Content(obj.ToJson());
  39. }
  40. return res;
  41. }
  42. /// <summary>
  43. /// 获取聊天记录
  44. /// </summary>
  45. /// <returns></returns>
  46. public ActionResult GetMsgList()
  47. {
  48. ActionResult res = NoToken("未知错误,请重新登录");
  49. if (Request.IsAuthenticated)
  50. {
  51. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  52. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  53. string strpageindex = RequestString.GetQueryString("page");
  54. int pageindex = 1;
  55. string strpagesize = RequestString.GetQueryString("pagesize");
  56. int pagesize = 10;
  57. DateTime stime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
  58. DateTime etime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");
  59. if (strstarttime.Trim() != "" && strendtime != "")
  60. {
  61. stime = DateTime.Parse(strstarttime);
  62. etime = DateTime.Parse(strendtime);
  63. }
  64. res = Success("加载成功", WxHelper.GetMsgList(stime, etime, (pageindex - 1) * pagesize, pagesize));
  65. }
  66. return res;
  67. }
  68. }
  69. }