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

53 lines
2.0 KiB
C#

using Core.Web.App_Start;
using Core.Web.WebHelper;
using CRM.Core.BLL.Wx;
using CRM.Core.Common.Layui;
using CRM.Core.Model.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WX.CRM.Common;
namespace Core.Web.Controllers
{
public class CanOpenGifController : BaseController
{
// GET: InnerUser
[AuthorizeRedirect(RightsConfig.CONST_授权码管理, ToolBarConfig.CONST_NotButton, true)]
public ActionResult Index()
{
ViewBag.rightCode = RightsConfig.CONST_授权码管理;
return View();
}
[AuthorizeRedirect(RightsConfig.CONST_授权码管理, ToolBarConfig.CONST_NotButton, false)]
public JsonResult GetList(Laypage pager, string username, string remark)
{
var list = new Wx_CanOpenGifOrder_BL().GetList(ref pager, username, remark);
var data = new LayuiData<Wx_CanOpenGifOrder>()
{
msg = "数据加载成功!",
count = pager.count,
code = 0,
data = list
};
return Json(data, JsonRequestBehavior.AllowGet);
}
[AuthorizeRedirect(RightsConfig.CONST_授权码管理, ToolBarConfig.CONST_Add, true)]
public ActionResult Add()
{
return View();
}
ValidationErrors errors = new ValidationErrors();
[AuthorizeRedirect(RightsConfig.CONST_授权码管理, ToolBarConfig.CONST_Add, false)]
public JsonResult Save(string username, string remark)
{
string code = new Wx_CanOpenGifOrder_BL().Create(ref errors, username, remark, Eid +"-"+ UserName);
if (errors.Count() > 0)
return Json(new { result = false, code = 1, msg = errors.Error, data = code }, JsonRequestBehavior.AllowGet);
else
return Json(new { result = true, code = 0, msg = "提交成功!", data = code }, JsonRequestBehavior.AllowGet);
}
}
}