using CRM.Core.DTO; using Ninject; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using WX.CRM.BLL.Base; using WX.CRM.BLL.Util; using WX.CRM.IBLL.WeWork; using WX.CRM.IBLL.Ww; using WX.CRM.Model.Enum; using WX.CRM.WebHelper; namespace WX.CRM.WEB.Controllers.WeWork { public class WxResourceController : BaseController { private CACHE_BL _cache = new CACHE_BL(); private BAS_BUSSINESSLINE_BL line_bl = new BAS_BUSSINESSLINE_BL(); [Inject] public IWw_huser _iww_hhuser_service { get; set; } [Inject] public IWxResource _resourceservice { get; set; } public WxResourceController() { } [HttpGet] [AuthorizeToolBar(InitRights.CONST_企微资源流转, InitToolBar.CONST_Other1)] public ActionResult WxResourceTab() { return View(); } [HttpGet] [AuthorizeToolBar(InitRights.CONST_企微资源流转, InitToolBar.CONST_Other1)] public ActionResult Index() { ViewBag.apiPath = _cache.GetValue_Parameter(Parameter.ZXD_CORE_WEBAPI); //ViewBag.apiPath = "http://localhost:5244"; var busineeLine = line_bl.GetBusinessLineByRoot(UserId); ViewBag.Deptid = string.Join(",", busineeLine.Select(n => n.BUSINESSID)); return View(); } [HttpGet] [AuthorizeToolBar(InitRights.CONST_企微资源流转, InitToolBar.CONST_Other1)] public ActionResult Setting() { var croplist = _iww_hhuser_service.Corp_GetByCompanyCode(companyCode); ViewBag.AllChannel = JsonHelper.ObjDivertToJson(croplist); var groupList = _resourceservice.GetGroupList(UserId); List allgroup = new List(); foreach (var item in groupList) { allgroup.Add(new { name = item.text, value = item.id, deptId = item.deptId }); } ViewBag.AllGroup = JsonHelper.ObjDivertToJson(allgroup); ViewBag.apiPath = _cache.GetValue_Parameter(Parameter.ZXD_CORE_WEBAPI); //ViewBag.apiPath = "http://localhost:5244"; return View(); } [HttpPost] [AuthorizeToolBar(InitRights.CONST_企微资源流转, InitToolBar.CONST_Other1)] public JsonResult SubmitResourceTask(ResourceConfigCreateDto model) { try { model.eid = Convert.ToInt32(Eid); bool result = _resourceservice.SubmitResourceTask(model); retMsg ret = new retMsg() { result = result, retcode = 200 }; return Json(ret); } catch (Exception ex) { retMsg ret = new retMsg() { result = false, retcode = 400, retmsg = ex.Message }; return Json(ret); } } } }