TG.WXCRM.V4/WEB/Controllers/WeiXin/MessageCountController.cs

77 lines
2.5 KiB
C#

using System;
using System.Web.Mvc;
using WX.CRM.Common;
using WX.CRM.IBLL.Wx;
using WX.CRM.WebHelper;
namespace WX.CRM.WEB.Controllers.WeiXin
{
public class MessageCountController : BaseController
{
private IWX_MESSAGE _message;
public MessageCountController(IWX_MESSAGE message)
{
_message = message;
}
//
// GET: /MessageCount/
[HttpGet]
[AuthorizeRedirect(Roles = InitRights.CONST_微信聊天信息统计)]
public ActionResult Index()
{
ToolBar tb = new ToolBar();
ViewBag.ToolBar = tb;
Pager pager = new Pager() { page = 1, rows = int.MaxValue };
Table tab = new Table("tablist");
tab.AddHeadCol("Groupname", "", "组别");
tab.AddHeadCol("SALESEID", "", "工号");
tab.AddHeadCol("UNAME", "", "姓名");
tab.AddHeadCol("oneCount", "", "一对一主动发出", true);
tab.AddHeadCol("qunfaCount", "", "群发数量", true);
tab.AddHeadCol("kehuCount", "", "沟通客户数", true);
tab.AddHeadCol("zhudongCount", "", "主动发出总量", true);
tab.AddHeadCol("allCount", "", "发出总量", true);
tab.AddHeadRow();
ViewBag.gridTable = tab.GetHead();
ViewBag.inneruserid = UserId;
ViewBag.userGroupId = userGroupId;
ViewBag.saleDeptId = saleDeptId;
ViewBag.roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
return View();
}
[HttpPost]
[AuthorizeRedirect(Roles = InitRights.CONST_微信聊天信息统计)]
public JsonResult Index(string columns, string groupId, string userId, DateTime sTime, DateTime eTime)
{
Table table = new Table(columns, true);
var list = _message.GetMessageCount(groupId, userId, sTime, eTime);
foreach (var item in list)
{
table.AddCol(item.GName);
table.AddCol(item.Eid);
table.AddCol(item.UName);
table.AddCol(item.zd);
table.AddCol(item.qf);
table.AddCol(item.kfs);
table.AddCol(item.zd - item.bd + item.qf);
table.AddCol(item.zd + item.qf);
table.AddRow();
}
var json = new
{
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
}
}