90 lines
3.3 KiB
C#
90 lines
3.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.BLL;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Base;
|
|
using WX.CRM.IBLL.weapp;
|
|
using WX.CRM.Model.Entity;
|
|
using WX.CRM.WebHelper;
|
|
|
|
namespace WX.CRM.WEB.Controllers.Weapp
|
|
{
|
|
public class WeappSaleUsersController : BaseController
|
|
{
|
|
private readonly IWEAPP_SALEUSERS _weappSaleUsers;
|
|
private readonly IBAS_INNERUSERGROUP_Q _basInnerUserGroup;
|
|
public WeappSaleUsersController(IWEAPP_SALEUSERS weappSaleUers, IBAS_INNERUSERGROUP_Q basInnerUserGroup)
|
|
{
|
|
_weappSaleUsers = weappSaleUers;
|
|
_basInnerUserGroup = basInnerUserGroup;
|
|
}
|
|
|
|
[HttpGet]
|
|
public ActionResult Index()
|
|
{
|
|
Table tab = new Table("tablist");
|
|
tab.AddHeadCol("EID", "", "客服");
|
|
tab.AddHeadCol("GroupId", "", "客服所在组");
|
|
tab.AddHeadCol("ACCOUNTNUM", "", "公众号ID");
|
|
tab.AddHeadCol("STATE", "", "状态");
|
|
tab.AddHeadCol("CTIME", "", "创建时间");
|
|
|
|
tab.AddHeadRow();
|
|
ViewBag.inneruserid = UserId;
|
|
ViewBag.userGroupId = userGroupId;
|
|
ViewBag.saleDeptId = saleDeptId;
|
|
ViewBag.roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
|
ViewBag.gridTable = tab.GetTable();
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult Index(decimal? groupId, decimal? userId, decimal? eid, string columns)
|
|
{
|
|
try
|
|
{
|
|
Table tb = new Table(columns, true);
|
|
//var roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
|
|
//if (!(roleCodes.Contains("[GLY]") || roleCodes.Contains("[ZJ]")))
|
|
//{
|
|
// eid = Eid;
|
|
//}
|
|
var where = PredicateExtensionses.True<WEAPP_SALEUSERS>();
|
|
if (userId.HasValue)
|
|
where = where.And(p => p.INNERUSERID == userId.Value);
|
|
else if (groupId.HasValue)
|
|
{
|
|
var userids = _basInnerUserGroup.GetList(p => p.GID == groupId.Value).Select(m => m.INNERUSERID);
|
|
where = where.And(m => userids.Contains(m.INNERUSERID));
|
|
}
|
|
if (eid.HasValue)
|
|
{
|
|
where = where.And(m => m.EID == eid.Value);
|
|
}
|
|
var list = _weappSaleUsers.GetList(where);
|
|
foreach (var item in list)
|
|
{
|
|
tb.AddCol(InnerUserHelper.Instance.EidAndName(item.INNERUSERID));
|
|
tb.AddCol(InnerUserHelper.Instance.GetGroupName(InnerUserHelper.Instance.GetGroupId(item.INNERUSERID)));
|
|
tb.AddCol(item.ACCOUNTNUM);
|
|
tb.AddCol(item.STATE == 1 ? "正常" : "");
|
|
tb.AddCol(item.CTIME);
|
|
|
|
tb.AddRow();
|
|
}
|
|
var json = new
|
|
{
|
|
rowsList = tb.GetRows()
|
|
};
|
|
return Json(json, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
return JsonHandler.ManageMessage(ex.Message, false);
|
|
}
|
|
}
|
|
}
|
|
}
|