| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using CallCenter.Utility;
- using CallCenterApi.Interface.Controllers.Base;
- using CallCenterAPI.WechatSDK;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.weixin
- {
- public class WxCustomController : BaseController
- {
- /// <summary>
- /// 获取用户聊天记录
- /// </summary>
- /// <returns></returns>
- public ActionResult GetRecordList()
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- int strpageindex = RequestString.GetInt("pageindex", 1);
- int strpagesize = RequestString.GetInt("pagesize", 10);
- DateTime stime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
- DateTime etime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");
- if (strstarttime.Trim() != "" && strendtime != "")
- {
- stime = DateTime.Parse(strstarttime);
- etime = DateTime.Parse(strendtime);
- }
- var obj = new
- {
- rows = WxHelper.GetRecord(stime, etime, strpagesize, strpageindex),
- total = 0
- };
- res = Content(obj.ToJson());
- }
- return res;
- }
- /// <summary>
- /// 获取聊天记录
- /// </summary>
- /// <returns></returns>
- public ActionResult GetMsgList()
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- DateTime stime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
- DateTime etime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");
- if (strstarttime.Trim() != "" && strendtime != "")
- {
- stime = DateTime.Parse(strstarttime);
- etime = DateTime.Parse(strendtime);
- }
- res = Success("加载成功", WxHelper.GetMsgList(stime, etime, (pageindex - 1) * pagesize, pagesize));
- }
- return res;
- }
- }
- }
|