ComplianceServer/oldcode/Core.Web/Controllers/WxMessageController.cs

70 lines
2.3 KiB
C#

using CRM.Core.BLL.Base;
using CRM.Core.Model.Entity;
using CRM.Core.Model.Enum;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Configuration;
using System.Web.Mvc;
namespace Core.Web.Controllers
{
public class WxMessageController : BaseController
{
private BAS_PARAMETER_BL paramter_bl = new BAS_PARAMETER_BL();
// GET: WxMessage
public ActionResult Index()
{
BAS_PARAMETER model = paramter_bl.GetModel(Parameter.WeiXin_IllegalKewords.ToString());
if (model == null)
ViewBag.KeyWords = "";
else
ViewBag.KeyWords = model.PARAVALUE;
return View();
}
[HttpGet]
public ActionResult List()
{
return View();
}
[HttpPost]
public JsonResult List(string resId, string companyCode)
{
//ConStringHelper.CompanyCode code = (ConStringHelper.CompanyCode)Enum.Parse(typeof(ConStringHelper.CompanyCode), companyCode);
var host = ConfigurationManager.AppSettings["WxMessage_" + companyCode].ToString();
var url = host + "/WxMessageSvr.svc/WxRcontact/Get/" + resId;
var res = CRM.Core.Common.Utility.GetData(url, string.Empty);
var result = JsonConvert.DeserializeObject<ajaxResult<IList<WxRcontactView>>>(res);
var data = new
{
msg = "数据加载成功!",
count = 1,
code = 0,
data = result.retmsg
};
return Json(data, JsonRequestBehavior.AllowGet);
}
public class WxRcontactView
{
public string username { get; set; }
public string jobwxusername { get; set; }
public string alias { get; set; }
public string conremark { get; set; }
public string nickname { get; set; }
public string resid { get; set; }
public decimal inneruserid { get; set; }
public decimal eid { get; set; }
public string uname { get; set; }
public string wokalias { get; set; }
}
public class ajaxResult<T>
{
public bool result { get; set; }
public int retcode { get; set; }
public T retmsg { get; set; }
}
}
}