143 lines
5.4 KiB
C#
143 lines
5.4 KiB
C#
using Newtonsoft.Json;
|
|
using Ninject;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.BLL.ActivityProduct;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.Common.Layui;
|
|
using WX.CRM.Common.StockHelper;
|
|
using WX.CRM.IBLL.ActivityProduct;
|
|
using WX.CRM.Model.Enum;
|
|
using WX.CRM.Model.MAP;
|
|
using WX.CRM.WebHelper;
|
|
|
|
namespace WX.CRM.WEB.Controllers.ActivityProduct
|
|
{
|
|
/// <summary>
|
|
/// 企微侧边栏活动和在线支付
|
|
/// </summary>
|
|
public class ActivityProductController : BaseController
|
|
{
|
|
private ActivityProduct_BL _actProduct = new ActivityProduct_BL();
|
|
private CACHE_BL cACHE_BL = new CACHE_BL();
|
|
|
|
public readonly string apiPath = new CACHE_BL().GetValue_Parameter(Parameter.Core_ZxdService_WebApi) + "Api";
|
|
//public readonly string apiPath = "https://localhost:7163/Api";
|
|
|
|
[HttpGet]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_产品活动管理)]
|
|
public ActionResult Index()
|
|
{
|
|
//ToolBar
|
|
ViewBag.apiPath = apiPath;
|
|
ToolBar tool = new ToolBar();
|
|
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.产品活动管理, userRightId);
|
|
tool.AllowButton(toolbtn);
|
|
ViewBag.ToolBar = tool;
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_产品活动管理)]
|
|
public JsonResult GetActivityList(string columns, Laypage pager, QueryUserComboDto usercomboDto, ActivityQueryDto dto)
|
|
{
|
|
var layUidata = new LayuiData<ActivityModel>();
|
|
var list = _actProduct.GetActivityModelList(ref pager, usercomboDto, dto, UserId);
|
|
layUidata.msg = "数据加载成功";
|
|
layUidata.code = 0;
|
|
layUidata.data = list;
|
|
layUidata.count = pager.count;
|
|
return Json(layUidata);
|
|
}
|
|
|
|
[HttpGet]
|
|
[AuthorizeToolBar(InitRights.CONST_产品活动管理, InitToolBar.CONST_Add)]
|
|
public ActionResult Add(int? Id)
|
|
{
|
|
ActivityEidtModel res = new ActivityEidtModel();
|
|
ViewBag.apiPath = cACHE_BL.GetValue_Parameter(Parameter.Core_ZxdService_WebApi) + "Api";
|
|
var allChannel = cACHE_BL.GetDeptDownList();
|
|
ViewBag.AllChannel = JsonHelper.ObjDivertToJson(allChannel);
|
|
ViewBag.eid = Eid;
|
|
ViewBag.Uname = UserName;
|
|
ViewBag.DataClientCode = Utility.GetSettingOrNullByKey("DataClientCode");
|
|
if (Id > 0)
|
|
{
|
|
var getUrl = ViewBag.apiPath + "/QwOnlinePay/GetEditActivityModel";
|
|
var postModel = $"Id={Id}";
|
|
var apiResult = Utility.GetData(getUrl, postModel, Encoding.UTF8);
|
|
ApiResult<ActivityEidtModel> reqInfo = JsonConvert.DeserializeObject<ApiResult<ActivityEidtModel>>(apiResult);
|
|
res = reqInfo.Data;
|
|
ViewBag.Id = Id;
|
|
}
|
|
return View(res);
|
|
}
|
|
|
|
[HttpGet]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_侧边栏活动产品管理)]
|
|
public ActionResult ProductIndex()
|
|
{
|
|
//ToolBar
|
|
ToolBar tool = new ToolBar();
|
|
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.侧边栏活动产品管理, userRightId);
|
|
tool.AllowButton(toolbtn);
|
|
ViewBag.ToolBar = tool;
|
|
Laypage pager = new Laypage
|
|
{
|
|
page = 1,
|
|
limit = 10000
|
|
};
|
|
ActivityQueryDto activityQueryDto = new ActivityQueryDto { Status = 1 };
|
|
var list = _actProduct.GetActivityModelList(ref pager, new QueryUserComboDto(), activityQueryDto, UserId);
|
|
List<SelectListItem> select = new List<SelectListItem>();
|
|
foreach (var item in list)
|
|
{
|
|
SelectListItem selectListItem = new SelectListItem
|
|
{
|
|
Text = item.Name,
|
|
Value = item.Id.ToString()
|
|
};
|
|
select.Add(selectListItem);
|
|
}
|
|
ViewBag.ActivityList = select;
|
|
ViewBag.apiPath = apiPath;
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_侧边栏活动产品管理)]
|
|
public JsonResult GetActProductList(string columns, Laypage pager, QueryUserComboDto usercomboDto, ActProductQueryDto dto)
|
|
{
|
|
var layUidata = new LayuiData<ActProductModel>();
|
|
var list = _actProduct.GetActProductList(ref pager, usercomboDto, dto, UserId);
|
|
layUidata.msg = "数据加载成功";
|
|
layUidata.code = 0;
|
|
layUidata.data = list;
|
|
layUidata.count = pager.count;
|
|
return Json(layUidata);
|
|
}
|
|
|
|
[HttpGet]
|
|
[AuthorizeToolBar(InitRights.CONST_侧边栏活动产品管理, InitToolBar.CONST_Add)]
|
|
public ActionResult AddProduct(int? Id)
|
|
{
|
|
ProductEditModel res = new ProductEditModel();
|
|
|
|
ViewBag.apiPath = apiPath; ;
|
|
var allChannel = cACHE_BL.GetDeptDownList();
|
|
ViewBag.AllChannel = JsonHelper.ObjDivertToJson(allChannel);
|
|
ViewBag.eid = Eid;
|
|
ViewBag.Uname = UserName;
|
|
ViewBag.Id = Id;
|
|
|
|
ViewBag.companycode = Utility.GetSettingOrNullByKey("DataClientCode");
|
|
|
|
return View();
|
|
}
|
|
}
|
|
} |