diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/MemberController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/MemberController.cs index 1b9d632..a98e09c 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/MemberController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/MemberController.cs @@ -584,5 +584,430 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers return Json(tip); } #endregion + + #region 用户组管理 + [MyAuthorize( "viewlist", "memberrole")] + public IActionResult MemberRole() + { + IList list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0); + Core.Admin.WriteLogActions("查看用户组列表;"); + return View(list); + } + + //添加管理组 + [MyAuthorize("add", "memberrole")] + public IActionResult AddMemberRole() + { + //获取所有的菜单列表 + IList list = AdminMenu.GetListTree(0, -1, false, false); + ViewBag.MenuList = list; + Core.Admin.WriteLogActions("查看添加用户组;"); + return View(); + } + //执行添加用户组 + [HttpPost] + [MyAuthorize("add", "memberrole", "JSON")] + public IActionResult AddMemberRole(FormCollection fc) + { + string RoleName = fc["RoleName"]; + string RoleDescription = fc["RoleDescription"]; + string NotAllowDel = fc["NotAllowDel"]; + string Rank = fc["Rank"]; + string CashBack = fc["CashBack"]; + string ParentCashBack = fc["ParentCashBack"]; + string GrandfatherCashBack = fc["GrandfatherCashBack"]; + string IsHalved = fc["IsHalved"]; + string YearsPerformance = fc["YearsPerformance"]; + string JoinPrice = fc["JoinPrice"]; + + if (string.IsNullOrEmpty(RoleName)) + { + tip.Message = "用户组名称不能为空!"; + return Json(tip); + } + if (!Utils.IsInt(Rank)) + { + tip.Message = "排序只能是数字!"; + return Json(tip); + } + if (!Utils.IsDecimal(CashBack)) + { + tip.Message = "返现金额格式错误!"; + return Json(tip); + } + if (!Utils.IsDecimal(ParentCashBack)) + { + tip.Message = "父级返现金额格式错误!"; + return Json(tip); + } + if (!Utils.IsDecimal(ParentCashBack)) + { + tip.Message = "爷级返现金额格式错误!"; + return Json(tip); + } + if (!Utils.IsDecimal(YearsPerformance)) + { + tip.Message = "年销售额格式错误!"; + return Json(tip); + } + if (!Utils.IsDecimal(JoinPrice)) + { + tip.Message = "入驻费用格式错误!"; + return Json(tip); + } + MemberRoles entity = new MemberRoles(); + entity.RoleName = RoleName; + entity.RoleDescription = RoleDescription; + entity.NotAllowDel = !string.IsNullOrEmpty(NotAllowDel) && NotAllowDel == "1" ? 1 : 0; + entity.IsHalved = !string.IsNullOrEmpty(IsHalved) && IsHalved == "1" ? 1 : 0; + entity.Rank = int.Parse(Rank); + entity.CashBack = decimal.Parse(CashBack); + entity.ParentCashBack = decimal.Parse(ParentCashBack); + entity.GrandfatherCashBack = decimal.Parse(GrandfatherCashBack); + entity.YearsPerformance = decimal.Parse(YearsPerformance); + entity.JoinPrice = decimal.Parse(JoinPrice); + entity.Insert(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "添加用户组成功"; + tip.ReturnUrl = "close"; + Core.Admin.WriteLogActions($"添加新用户组({entity.Id});"); + return Json(tip); + } + //编辑用户组 + [MyAuthorize("edit", "memberrole")] + public IActionResult EditMemberRole(int id) + { + MemberRoles entity = MemberRoles.Find(MemberRoles._.Id == id); + if (entity == null) + { + return EchoTipPage("系统找不到本记录!", 0, true, ""); + } + Core.Admin.WriteLogActions($"查看/编辑用户组({id})详情;"); + return View(entity); + } + [HttpPost] + [MyAuthorize("edit", "memberrole", "JSON")] + public IActionResult EditMemberRole(MemberRoles model) + { + if (model.Id <=0) + { + tip.Message = "错误参数传递!"; + return Json(tip); + } + + if (string.IsNullOrEmpty(model.RoleName)) + { + tip.Message = "用户组名称不能为空!"; + return Json(tip); + } + + if (model.CashBack <0) + { + tip.Message = "返现金额格式错误!"; + return Json(tip); + } + if (model.ParentCashBack <0) + { + tip.Message = "父级返现金额格式错误!"; + return Json(tip); + } + if (model.GrandfatherCashBack<0) + { + tip.Message = "爷级返现金额格式错误!"; + return Json(tip); + } + if (model.YearsPerformance <0) + { + tip.Message = "年销售额格式错误!"; + return Json(tip); + } + if (model.JoinPrice <0) + { + tip.Message = "入驻费用格式错误!"; + return Json(tip); + } + + MemberRoles entity = MemberRoles.Find(MemberRoles._.Id == model.Id); + if (entity == null) + { + tip.Message = "系统找不到本记录!"; + return Json(tip); + } + entity.RoleName = model.RoleName; + entity.RoleDescription = model.RoleDescription; + entity.NotAllowDel = model.NotAllowDel; + entity.IsHalved = model.IsHalved; + entity.Rank = model.Rank; + entity.CashBack = model.CashBack; + entity.ParentCashBack = model.ParentCashBack; + entity.GrandfatherCashBack = model.GrandfatherCashBack; + entity.YearsPerformance = model.YearsPerformance; + entity.JoinPrice = model.JoinPrice; + entity.Update(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "编辑用户组成功"; + tip.ReturnUrl = "close"; + Core.Admin.WriteLogActions($"编辑用户组({entity.Id});"); + return Json(tip); + } + + //删除用户组 + [HttpPost] + [MyAuthorize("del", "memberrole", "JSON")] + public IActionResult DelMemberRole(int id) + { + MemberRoles entity = MemberRoles.Find(MemberRoles._.Id == id); + if (entity == null) + { + tip.Message = "系统找不到本用户组详情!"; + return Json(tip); + } + if (entity.NotAllowDel == 1) + { + tip.Message = "本管理组设定不允许删除,如果需要删除,请先解除限制!"; + return Json(tip); + } + + //删除管理组,并删除旗下所有管理员 + Core.Admin.WriteLogActions($"执行删除用户组({entity.Id}:{entity.RoleName})详情;"); + entity.Delete(); + + tip.Status = JsonTip.SUCCESS; + tip.Message = "删除用户组成功"; + return Json(tip); + } + + #endregion + + #region 用户管理 + [MyAuthorize("viewlist", "members")] + public IActionResult Members() + { + //加载用户组 + IList list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0); + ViewBag.RoleList = list; + Core.Admin.WriteLogActions("查看用户列表;"); + return View(); + } + [MyAuthorize("viewlist", "members", "JSON")] + public IActionResult GetMembers(string keyword, int page = 1, int limit = 20, int roleid = 0, int groupid = 0) + { + int numPerPage, currentPage, startRowIndex; + long totalCount = 0; + + numPerPage = limit; + currentPage = page; + startRowIndex = (currentPage - 1) * numPerPage; + Expression ex = Member._.Id > 0; + + if (roleid > 0) + ex &= Member._.RoleId == roleid; + + if (!string.IsNullOrWhiteSpace(keyword)) + ex &= (Member._.RealName.Contains(keyword) | Member._.Tel.Contains(keyword)); + + IList list = Member.FindAll(ex, null, null, startRowIndex, numPerPage); + totalCount = Member.FindCount(ex, null, null, startRowIndex, numPerPage); + return Content(JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain"); + } + //查看,编辑用户信息 + [MyAuthorize("add", "members")] + public IActionResult AddMember() + { + IList list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0); + ViewBag.RoleList = list; + ViewBag.allmember = Member.FindAll(Member._.Id > 0 & Member._.IsLock != 1, null, null, 0, 0); + + Core.Admin.WriteLogActions($"查看添加用户页面;"); + Member model = new Member(); + return View(model); + } + [HttpPost] + [MyAuthorize("add", "members", "JSON")] + public IActionResult AddMember(Member model) + { + if (string.IsNullOrEmpty(model.UserName)) + { + tip.Message = "用户名必须是一个手机号码!"; + return Json(tip); + } + //判断用户是否存在 + if (Member.FindCount(Member._.UserName == model.UserName, null, null, 0, 0) > 0) + { + tip.Message = "用户名已经存在!"; + return Json(tip); + } + + if (string.IsNullOrEmpty(model.PassWord) || model.PassWord.Length < 6) + { + tip.Message = "密码必须不小于6个字符"; + return Json(tip); + } + string PassWord2 = Request.Form["PassWord2"]; + if (model.PassWord != PassWord2) + { + tip.Message = "两次输入密码不一致,请重新输入!"; + return Json(tip); + } + if (!string.IsNullOrEmpty(model.Email) && !Utils.IsValidEmail(model.Email)) + { + tip.Message = "邮箱格式错误!"; + return Json(tip); + } + if (model.RoleId <= 0) + { + tip.Message = "请选择一个用户组!"; + return Json(tip); + } + if (model.Parent == 0 && model.Grandfather != 0) + model.Grandfather = 0; + //执行添加 + Member entity = new Member(); + entity.UserName = model.UserName; + entity.Salt = Utils.GetRandomChar(20); + entity.PassWord = Utils.MD5(entity.Salt + model.PassWord); + entity.Email = model.Email; + entity.Tel = model.Tel; + entity.Parent = model.Parent; + entity.Grandfather = model.Grandfather; + entity.IsLock = 0; + entity.RoleId = model.RoleId; + entity.RealName = model.RealName; + entity.RegIP = "127.0.0.1"; + entity.RegTime = DateTime.Now; + entity.Balance = 0; + entity.GiftBalance = 0; + entity.ExtCredits1 = 0; + entity.ExtCredits2 = 0; + entity.ExtCredits3 = 0; + entity.ExtCredits4 = 0; + entity.ExtCredits5 = 0; + entity.TotalCredits = 0; + entity.YearsPerformance = 0; + entity.Insert(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "添加用户成功"; + tip.ReturnUrl = "close"; + Core.Admin.WriteLogActions($"添加用户({entity.Id}/{entity.UserName});"); + return Json(tip); + } + + + //查看,编辑用户信息 + [MyAuthorize("edit", "members")] + public IActionResult EditMember(int id) + { + IList list = MemberRoles.FindAll(MemberRoles._.Id > 0, MemberRoles._.Rank.Asc(), null, 0, 0); + ViewBag.RoleList = list; + + Member entity = Member.Find(Core.Member._.Id == id); + if (entity == null) + { + return EchoTipPage("系统找不到本记录!"); + } + ViewBag.allmember = Member.FindAll(Member._.Id > 0 & Member._.IsLock != 1 & Member._.Id != entity.Id, null, null, 0, 0); + //获取用户余额变化记录 + IList listbalancelogs = BalanceChangeLog.FindAll(BalanceChangeLog._.UId == entity.Id, null, null, 0, 0); + ViewBag.listbalancelogs = listbalancelogs; + + IList listrechargebalancelogs = RebateChangeLog.FindAll(RebateChangeLog._.UId == entity.Id, null, null, 0, 0); + ViewBag.listrechargebalancelogs = listrechargebalancelogs; + + + + Core.Admin.WriteLogActions($"查看/编辑用户({entity.UserName});"); + return View(entity); + } + [HttpPost] + [MyAuthorize("edit", "members", "JSON")] + public IActionResult EditMember(Member model) + { + if (model.Id <= 0) + { + tip.Message = "错误请求"; + return Json(tip); + } + Member entity = Member.FindById(model.Id); + if (entity == null) + { + tip.Message = "系统找不到本记录"; + return Json(tip); + } + if (!string.IsNullOrEmpty(model.PassWord)) + { + if (string.IsNullOrEmpty(model.PassWord) || model.PassWord.Length < 6) + { + tip.Message = "密码必须不小于6个字符"; + return Json(tip); + } + string PassWord2 = Request.Form["PassWord2"]; + if (model.PassWord != PassWord2) + { + tip.Message = "两次输入密码不一致,请重新输入!"; + return Json(tip); + } + entity.PassWord = Utils.MD5(entity.Salt + model.PassWord); + } + if (string.IsNullOrEmpty(model.UserName)) + { + tip.Message = "用户名必须是一个手机号码!"; + return Json(tip); + } + //判断用户是否存在 + if (Member.FindCount(Member._.UserName == model.UserName & Member._.Id != entity.Id, null, null, 0, 0) > 0) + { + tip.Message = "用户名已经存在,请重新填写一个!"; + return Json(tip); + } + string IsVerifySellers = Request.Form["IsVerifySellers"]; + entity.UserName = model.UserName; + entity.Email = model.Email; + entity.Tel = model.UserName; + entity.Parent = model.Parent; + entity.Grandfather = model.Grandfather; + entity.RoleId = model.RoleId; + entity.RealName = model.RealName; + entity.Phone = model.Phone; + entity.Alipay = model.Alipay; + entity.Bank = model.Bank; + entity.BankCardNO = model.BankCardNO; + entity.Skype = model.Skype; + if (IsVerifySellers == "") + { + entity.IsVerifySellers = 1; + } + else + entity.IsVerifySellers = 0; + + entity.Update(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "编辑用户成功"; + tip.ReturnUrl = "close"; + Core.Admin.WriteLogActions($"编辑用户({entity.Id}/{entity.UserName});"); + return Json(tip); + } + + /// + /// 删除用户 + /// + /// + /// + [HttpPost] + [MyAuthorize("del", "members", "JSON")] + public IActionResult DelMember(int id) + { + Member he = Member.Find(Member._.Id == id); + if (he == null) + { + tip.Message = "系统找不到本用户!"; + return Json(tip); + } + he.Delete(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "删除用户成功!"; + Core.Admin.WriteLogActions($"删除用户({he.Id}|{he.UserName});"); + return Json(tip); + } + #endregion } } \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/ProductController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/ProductController.cs new file mode 100644 index 0000000..b8c7a85 --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Controllers/ProductController.cs @@ -0,0 +1,439 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using COMCMS.Common; +using COMCMS.Core; +using XCode; +using Newtonsoft.Json; +using COMCMS.Web.Common; +using Microsoft.AspNetCore.Http; + +namespace COMCMS.Web.Areas.AdminCP.Controllers +{ + public class ProductController : AdminBaseController + { + #region 商品栏目 + /// + /// 商品栏目列表 + /// + /// + [MyAuthorize("viewlist", "category")] + public IActionResult CategoryList() + { + IList list = Category.GetListTree(0, -1, false, true); + Core.Admin.WriteLogActions("查看商品栏目列表页面;"); + return View(list); + } + + [MyAuthorize("add", "category")] + public IActionResult AddCategory() + { + //获取上级栏目 + IList list = Category.GetListTree(0, -1, true, false); + ViewBag.ListTree = list; + //获取模板 + //List listtpl = COMCMS.Common.IOHelper.GetDirFiles(new DirectoryInfo(Server.MapPath("~/Views/article"))); + //ViewBag.ListTpl = listtpl; + Core.Admin.WriteLogActions("查看添加商品栏目页面;"); + return View(); + } + + [HttpPost] + [MyAuthorize("add", "category", "JSON")] + public IActionResult AddCategory(Category model) + { + //获取上级栏目 + if (string.IsNullOrWhiteSpace(model.KindName)) + { + tip.Message = "商品栏目标题不能为空!"; + return Json(tip); + } + model.Insert(); + Core.Admin.WriteLogActions("添加商品栏目(id:" + model.Id + ");"); + tip.Status = JsonTip.SUCCESS; + tip.Message = "添加商品栏目成功"; + tip.ReturnUrl = "close"; + + return Json(tip); + } + + //编辑栏目 + [MyAuthorize("edit", "category")] + public IActionResult EditCategory(int id) + { + Category entity = Category.Find(Category._.Id == id); + if (entity == null) + { + return EchoTipPage("系统找不到本记录!"); + } + //获取上级栏目 + IList list = Category.GetListTree(0, -1, true, false); + ViewBag.ListTree = list; + //获取模板 + //List listtpl = COMCMS.Common.IOHelper.GetDirFiles(new DirectoryInfo(Server.MapPath("~/Views/article"))); + //ViewBag.ListTpl = listtpl; + Core.Admin.WriteLogActions("查看/编辑商品栏目(id:" + id + ")页面;"); + return View(entity); + } + + [HttpPost] + [MyAuthorize("edit", "category", "JSON")] + public IActionResult EditCategory(Category model) + { + if (model.Id <= 0) + { + tip.Message = "错误参数传递!"; + Json(tip); + } + if (string.IsNullOrWhiteSpace(model.KindName)) + { + tip.Message = "商品栏目标题不能为空!"; + return Json(tip); + } + + Category entity = Category.Find(Category._.Id == model.Id); + if (entity == null) + { + tip.Message = "系统找不到本记录!"; + Json(tip); + } + + if (entity.PId != model.PId) + { + if (entity.Id == model.PId) + { + tip.Message = "上级栏目不能选择本身!"; + return Json(tip); + } + entity.PId = model.PId; + entity.Location = Category.GetNewLocation(model.PId); + entity.Level = Category.GetNewLevel(model.PId); + //修改商品的location + IList alist = Product.FindAll(Product._.KId == model.Id, null, null, 0, 0); + if (alist != null && alist.Count > 0) + { + foreach (var a in alist) + { + a.Location = entity.Location + "," + entity.Id; + //a.FilePath = entity.FilePath; + } + alist.Save(); + } + } + //赋值 + entity.PId = model.PId; + entity.KindName = model.KindName; + entity.SubTitle = model.SubTitle; + entity.KindTitle = model.KindTitle; + entity.Keyword = model.Keyword; + entity.Description = model.Description; + entity.LinkURL = model.LinkURL; + entity.TitleColor = model.TitleColor; + entity.TemplateFile = model.TemplateFile; + entity.DetailTemplateFile = model.DetailTemplateFile; + entity.IsList = model.IsList; + entity.PageSize = model.PageSize <= 0 ? 15 : model.PageSize; + entity.IsLock = model.IsLock; + entity.IsHide = model.IsHide; + entity.IsShowSubDetail = model.IsShowSubDetail; + entity.BannerImg = model.BannerImg; + entity.Pic = model.Pic; + entity.KindInfo = model.KindInfo; + entity.KindDomain = model.KindDomain; + entity.Rank = model.Rank; + entity.Pic = model.Pic; + + + entity.Save(); + Core.Admin.WriteLogActions("修改商品栏目(id:" + entity.Id + ");"); + tip.Status = JsonTip.SUCCESS; + tip.Message = "修改商品栏目成功"; + tip.ReturnUrl = "close"; + + return Json(tip); + } + + //删除栏目 + [HttpPost] + [MyAuthorize("del", "category", "JSON")] + public JsonResult DelCategory(int id) + { + Category entity = Category.Find(Category._.Id == id); + if (entity == null) + { + tip.Message = "系统找不到本商品栏目!"; + return Json(tip); + } + if (Category.FindCount(Category._.PId == entity.Id, null, null, 0, 0) > 0) + { + tip.Message = "本栏目有下级栏目,不允许删除!"; + return Json(tip); + } + //删除商品 + IList list = Product.FindAll(Product._.KId == entity.Id, null, null, 0, 0); + if (list != null && list.Count > 0) + { + list.Delete(); + } + Core.Admin.WriteLogActions("删除商品栏目(id:" + entity.Id + ");"); + entity.Delete(); + tip.Status = JsonTip.SUCCESS; + tip.Message = "删除商品栏目成功"; + return Json(tip); + } + #endregion + + #region 商品列表 + [MyAuthorize("viewlist", "product")] + public IActionResult ProductList() + { + //获取上级栏目 + IList list = Category.GetListTree(0, -1, true, false); + ViewBag.ListKinds = list; + Core.Admin.WriteLogActions("查看商品列表;"); + return View(); + } + + [MyAuthorize("viewlist", "product", "JSON")] + public IActionResult GetProductList(string keyword, int page = 1, int limit = 20) + { + int numPerPage, currentPage, startRowIndex; + + numPerPage = limit; + currentPage = page; + startRowIndex = (currentPage - 1) * numPerPage; + Expression ex = Product._.Id > 0; + + if (!string.IsNullOrWhiteSpace(keyword)) + { + if (Utils.IsInt(keyword)) + { + ex &= (Product._.Id == int.Parse(keyword) | Product._.Title.Contains(keyword)); + } + else + { + ex &= Product._.Title.Contains(keyword); + } + } + string kid = Request.Query["kid"]; + string isshowsub = Request.Query["isshowsub"]; + if (Utils.IsInt(kid) && int.Parse(kid) > 0) + { + //获取栏目 + if (isshowsub == "1") + { + List kids = new List(); + kids.Add(int.Parse(kid)); + IList subkinds = Category.FindByParentID(int.Parse(kid)); + if (subkinds != null && subkinds.Count > 0) + { + foreach (var item in subkinds) + { + kids.Add(item.Id); + } + ex &= Product._.KId.In(kids); + } + } + else + { + ex &= Product._.KId == int.Parse(kid); + } + } + + IList list = Product.FindAll(ex, Product._.Sequence.Asc().And(Product._.Id.Desc()), null, startRowIndex, numPerPage); + long totalCount = Product.FindCount(ex, Product._.Sequence.Asc().And(Product._.Id.Desc()), null, startRowIndex, numPerPage); + return Content(Newtonsoft.Json.JsonConvert.SerializeObject(new { total = totalCount, rows = list }), "text/plain"); + //return Json(new { total = totalCount, rows = list }, JsonRequestBehavior.AllowGet); + } + #endregion + + #region 添加商品 + [HttpGet] + [MyAuthorize("add", "product")] + public IActionResult AddProduct() + { + IList list = Category.GetListTree(0, -1, true, false); + ViewBag.ListKinds = list; + Core.Admin.WriteLogActions("查看添加商品页面;"); + Product entity = new Product(); + entity.AddTime = DateTime.Now; + entity.Sequence = 999; + return View(entity); + } + + //执行添加商品 + [HttpPost] + [MyAuthorize("edit", "product", "JSON")] + public IActionResult AddProduct(Product model) + { + if (model.KId <= 0) + { + tip.Message = "请选择一个商品分类"; + return Json(tip); + } + if (string.IsNullOrWhiteSpace(model.Title)) + { + tip.Message = "请填写商品标题"; + return Json(tip); + } + if (string.IsNullOrWhiteSpace(model.Content)) + { + tip.Message = "请填写商品介绍"; + return Json(tip); + } + if (!string.IsNullOrEmpty(model.Pic) && !Utils.IsImgFilename(model.Pic)) + { + tip.Message = "商品图片填写的不是图片格式!"; + return Json(tip); + } + //处理商品更多图片 + string[] moreImgSrc = Request.Form["nImgUrl"]; + string morIMG = string.Empty;//更多图片的时候用到 + if (moreImgSrc != null && moreImgSrc.Length > 0) + { + foreach (string s in moreImgSrc) + { + if (Utils.IsImgFilename(s)) + { + morIMG += s + "|||";//使用“|||”分隔图片 + } + } + } + model.ItemImg = morIMG; + model.AuthorId = Core.Admin.GetMyInfo().Id; + model.Insert(); + Category.UpdateDetailCount(model.KId); + //添加TAG + //Tag.InsertTags(model.Tags, RTType.RatuoModule.Product, model.Id, model.Title); + Core.Admin.WriteLogActions("添加商品(id:" + model.Id + ");"); + tip.Status = JsonTip.SUCCESS; + tip.Message = "添加商品成功"; + tip.ReturnUrl = "close"; + return Json(tip); + } + #endregion + + #region 修改商品详情 + //编辑文章 + [HttpGet] + [MyAuthorize("edit", "product")] + public IActionResult EditProduct(int id) + { + IList list = Category.GetListTree(0, -1, true, false); + ViewBag.ListKinds = list; + + Product entity = Product.Find(Product._.Id == id); + if (entity == null) + { + return EchoTipPage("系统找不到本记录!"); + } + + Core.Admin.WriteLogActions("查看/编辑商品详情(" + id + ");"); + + return View(entity); + } + + //执行添加商品 + [HttpPost] + [MyAuthorize("add", "product", "JSON")] + public IActionResult EditProduct(Product model) + { + if (model.Id <= 0) + { + tip.Message = "错误参数传递!"; + Json(tip); + } + Product entity = Product.Find(Product._.Id == model.Id); + if (entity == null) + { + tip.Message = "系统找不到本记录!"; + return Json(tip); + } + if (model.KId <= 0) + { + tip.Message = "请选择一个商品分类"; + return Json(tip); + } + if (string.IsNullOrWhiteSpace(model.Title)) + { + tip.Message = "请填写商品标题"; + return Json(tip); + } + if (string.IsNullOrWhiteSpace(model.Content)) + { + tip.Message = "请填写商品介绍"; + return Json(tip); + } + if (!string.IsNullOrEmpty(model.Pic) && !Utils.IsImgFilename(model.Pic)) + { + tip.Message = "商品图片填写的不是图片格式!"; + return Json(tip); + } + //处理商品更多图片 + string[] moreImgSrc = Request.Form["nImgUrl"]; + string morIMG = string.Empty;//更多图片的时候用到 + if (moreImgSrc != null && moreImgSrc.Length > 0) + { + foreach (string s in moreImgSrc) + { + if (Utils.IsImgFilename(s)) + { + morIMG += s + "|||";//使用“|||”分隔图片 + } + } + } + //处理三个勾选属性的 + string isnew = Request.Form["IsNew"]; + model.IsNew = isnew == "1" ? 1 : 0; + + + string IsRecommend = Request.Form["IsRecommend"]; + model.IsRecommend = IsRecommend == "1" ? 1 : 0; + + string IsHide = Request.Form["IsHide"]; + model.IsHide = IsHide == "1" ? 1 : 0; + model.IsHotSales = Request.Form["IsHotSales"] == "1" ? 1 : 0; + model.Hits = entity.Hits; + model.UpdateTime = DateTime.Now; + + model.ItemImg = morIMG; + //model.AuthorId = Core.Admin.GetMyInfo().Id; + model.Save(); + //添加TAG + //Tag.InsertTags(model.Tags, RTType.RatuoModule.Product, model.Id, model.Title); + Core.Admin.WriteLogActions("编辑商品(id:" + model.Id + ");"); + tip.Status = JsonTip.SUCCESS; + tip.Message = "编辑商品成功"; + tip.ReturnUrl = "close"; + return Json(tip); + } + #endregion + + #region 删除商品 + //删除文章 + [HttpPost] + [MyAuthorize("del", "product", "JSON")] + public JsonResult DelProduct(int id) + { + Product entity = Product.Find(Product._.Id == id); + if (entity == null) + { + tip.Message = "系统找不到本商品!"; + return Json(tip); + } + int kid = entity.KId; + //删除TAG + //Tag.DeleteTag(RTType.RatuoModule.Article, entity.Id); + Core.Admin.WriteLogActions("删除商品(id:" + entity.Id + ");"); + entity.Delete(); + //更新栏目商品数量 + Category.UpdateDetailCount(kid); + tip.Status = JsonTip.SUCCESS; + tip.Message = "删除商品成功"; + return Json(tip); + } + #endregion + } +} \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml index 42acb42..1cc6cf0 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Article/EditArticle.cshtml @@ -137,9 +137,7 @@
- -
diff --git a/COMCMS.Web/Areas/AdminCP/Views/Member/AddMember.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Member/AddMember.cshtml new file mode 100644 index 0000000..7dbc5ed --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Member/AddMember.cshtml @@ -0,0 +1,176 @@ +@model COMCMS.Core.Member +@{ + ViewBag.title = "添加用户"; +} +
+
+
+
@ViewBag.Title
+
+
+
+
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addMemberForm", @class = "form-horizontal m-t" })) + { +
+ +
+
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ @*
+ +
+ +
+
*@ +
+
+ +
+
+
+ 温馨提示:此部分信息只读。 +
+
+ +
+
+
+ +
+
+
+
+ + +
+
+
+ } +
+
+ + +
+ \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Member/AddMemberRole.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Member/AddMemberRole.cshtml new file mode 100644 index 0000000..8e02328 --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Member/AddMemberRole.cshtml @@ -0,0 +1,100 @@ + +@{ + ViewBag.title = "添加新用户组"; +} +
+
+
+
@ViewBag.Title
+
+
+
+
+
+ 说明:“父级返现百分比”和“爷级返现百分比”为本代理级别的下级业绩的抽点。比如说,下级消费1000,那如果“父级返现百分比”为10%。则他有团队业绩提成100。0则没有任何提成。 +
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addmemberroleForm", @class = "form-horizontal m-t" })) + { +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ + +
+
+ + } +
+
+ + +
+ \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Member/EditMember.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Member/EditMember.cshtml new file mode 100644 index 0000000..a763e15 --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Member/EditMember.cshtml @@ -0,0 +1,396 @@ +@model COMCMS.Core.Member +@{ + ViewBag.title = "查看/编辑用户详情"; +} +
+
+
+
@ViewBag.title
+
+
+
+
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editMemberForm", @class = "form-horizontal m-t" })) + { +
+ +
+
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+
+ + + +
+
+
+
+
+ +
+
+
+ 温馨提示:此部分信息只读。 +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + + + + + + + + + + + + @foreach (COMCMS.Core.BalanceChangeLog b in ViewBag.listbalancelogs) + { + + + + + + + + + } +
类型变化值变化前变化后时间理由
@COMCMS.Core.Member.GetBalanceTypeName(b.TypeId)@b.Reward.ToString("N2")@b.BeforChange.ToString("N2")@b.AfterChange.ToString("N2")@b.AddTime.ToString("yyyy-MM-dd HH:mm")@b.Actions
+
+
+
+
+ + + + + + + + + + + + + @foreach (COMCMS.Core.RebateChangeLog b in ViewBag.listrechargebalancelogs) + { + + + + + + + + + } +
类型变化值变化前变化后时间理由
@COMCMS.Core.Member.GetBalanceTypeName(b.TypeId)@b.Reward.ToString("N2")@b.BeforChange.ToString("N2")@b.AfterChange.ToString("N2")@b.AddTime.ToString("yyyy-MM-dd HH:mm")@b.Actions
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ 说明:充值后,无法撤回,请确认金额 +
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ 说明:扣除后,无法撤销 +
+
+
+
+
+
+ } +
+
+ + +
+ \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Member/EditMemberRole.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Member/EditMemberRole.cshtml new file mode 100644 index 0000000..465436b --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Member/EditMemberRole.cshtml @@ -0,0 +1,100 @@ +@model COMCMS.Core.MemberRoles +@{ + ViewBag.title = "查看/编辑用户组详情"; +} +
+
+
+
@ViewBag.Title
+
+
+
+
+
+ 说明:“父级返现百分比”和“爷级返现百分比”为本代理级别的下级业绩的抽点。比如说,下级消费1000,那如果“父级返现百分比”为10%。则他有团队业绩提成100。0则没有任何提成。 +
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editmemberroleForm", @class = "form-horizontal m-t" })) + { +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ + + +
+
+ + } +
+
+ +
+ diff --git a/COMCMS.Web/Areas/AdminCP/Views/Member/MemberRole.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Member/MemberRole.cshtml new file mode 100644 index 0000000..6bfbf2a --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Member/MemberRole.cshtml @@ -0,0 +1,66 @@ +@model IList +@{ + ViewBag.title = "用户组管理"; +} +
+
+
+
@ViewBag.Title
+
+
+ @*
+ +
*@ + +
+ +
+ + + + + + + + + + + + + @if (Model.Count == 0) + { + + } + @foreach (var m in Model) + { + + + + + + + + + + } +
ID用户组名称是否不许删除排序我的提成用户组介绍操作
暂无记录...
@m.Id + @m.RoleName + + @if (m.NotAllowDel == 1) + { + + } + @m.Rank@m.CashBack.ToString("N2")%@m.RoleDescription + 编辑 + @* 删除*@ +
+
+
+ + +
+ diff --git a/COMCMS.Web/Areas/AdminCP/Views/Member/Members.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Member/Members.cshtml new file mode 100644 index 0000000..93124b3 --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Member/Members.cshtml @@ -0,0 +1,196 @@ + +@{ + ViewBag.title = "用户管理"; +} +
+
+
+
@ViewBag.Title
+
+
+
+
+
+
筛选条件
+
+
+
+ + + + + + +
+
+
+
+ @*
+ +
*@ +
+ + +
+
+ + +
\ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Product/AddCategory.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Product/AddCategory.cshtml new file mode 100644 index 0000000..f630365 --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Product/AddCategory.cshtml @@ -0,0 +1,148 @@ + +@{ + ViewBag.title = "添加商品栏目"; +} +
+
+
+
@ViewBag.title
+
+
+
+
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addArticleKindForm", @class = "form-horizontal m-t" })) + { +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + + + +
+
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+ + @*
+ +
+ +
+
+
+ +
+ +
+
*@ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ + +
+
+ } +
+
+ + +
+ + diff --git a/COMCMS.Web/Areas/AdminCP/Views/Product/AddProduct.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Product/AddProduct.cshtml new file mode 100644 index 0000000..54b5c6c --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Product/AddProduct.cshtml @@ -0,0 +1,222 @@ +@model COMCMS.Core.Product +@{ + ViewBag.title = "添加商品详情"; +} +
+
+
+
@ViewBag.title
+
+
+
+
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addProductForm", @class = "form-horizontal m-t" })) + { +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ @*
+ +
+ +
+
*@ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ @*
+ +
+ +
+
*@ +
+ +
+ +
+
+ @*
+ +
+ +
+
*@ + +
+ +
+ + + + +
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+ @if (!string.IsNullOrEmpty(Model.ItemImg)) + { + string[] arrimg = Model.ItemImg.Split(new string[] { "|||" }, StringSplitOptions.None); + int i = 1; + foreach (string s in arrimg) + { + if (!string.IsNullOrEmpty(s) && COMCMS.Common.Utils.IsImgFilename(s)) + { + + +
+ +
+
+ + +
+
+
+ i++; + } + } + } +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+ + +
+
+ } +
+
+ + +
+ + \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Product/CategoryList.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Product/CategoryList.cshtml new file mode 100644 index 0000000..ca5f6d6 --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Product/CategoryList.cshtml @@ -0,0 +1,68 @@ +@model IList +@{ + ViewBag.title = "商品栏目管理"; +} +
+
+
+
@ViewBag.title
+
+
+
+ +
+ +
+ +
+ + + + + + + + + + + + @if (Model.Count == 0) + { + + } + @foreach (var m in Model) + { + + + + + + + + + } +
栏目名称ID排序商品数量隐藏操作
暂无记录...
@m.KindName + @m.Id + @m.Rank@m.Counts + @if (m.IsHide == 1) + { + + } + + 编辑 + 删除 +
+ +
+
+ + +
\ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Product/EditCategory.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Product/EditCategory.cshtml new file mode 100644 index 0000000..96bc197 --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Product/EditCategory.cshtml @@ -0,0 +1,157 @@ +@model COMCMS.Core.Category +@{ + + ViewBag.title = "编辑商品栏目"; +} +
+
+
+
@ViewBag.title
+
+
+
+
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editCategoryForm", @class = "form-horizontal m-t" })) + { +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + + + +
+
+
+
+ +
+ +
+
+ @*
+ +
+ +
+
*@ + +
+ +
+ +
+
+
+ +
+ +
+
+ + @*
+ +
+ +
+
+
+ +
+ +
+
*@ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ + + +
+
+ } +
+
+ + +
+ \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Product/EditProduct.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Product/EditProduct.cshtml new file mode 100644 index 0000000..544258f --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Product/EditProduct.cshtml @@ -0,0 +1,219 @@ +@model COMCMS.Core.Product +@{ + ViewBag.title = "编辑商品详情"; +} +
+
+
+
@ViewBag.title
+
+
+
+
+ @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editProductForm", @class = "form-horizontal m-t" })) + { +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ @*
+ +
+ +
+
*@ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ @*
+ +
+ +
+
*@ +
+ +
+ +
+
+ @*
+ +
+ +
+
*@ + +
+ +
+ + + + +
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+
+ @if (!string.IsNullOrEmpty(Model.ItemImg)) + { + string[] arrimg = Model.ItemImg.Split(new string[] { "|||" }, StringSplitOptions.None); + int i = 1; + foreach (string s in arrimg) + { + if (!string.IsNullOrEmpty(s) && COMCMS.Common.Utils.IsImgFilename(s)) + { + + +
+ +
+
+ + +
+
+
+ i++; + } + } + } +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+ + + +
+
+ } +
+
+ + +
+ \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Product/ProductList.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Product/ProductList.cshtml new file mode 100644 index 0000000..8bd432e --- /dev/null +++ b/COMCMS.Web/Areas/AdminCP/Views/Product/ProductList.cshtml @@ -0,0 +1,214 @@ + +@{ + ViewBag.title = "商品管理"; +} +
+
+
+
@ViewBag.title
+
+
+
+
+
+
筛选条件
+
+
+
+ + + + + + + +
+
+
+
+
+ + @* + *@ +
+
+ + +
+
+ + +
diff --git a/COMCMS.Web/wwwroot/userfiles/images/2018/9cd54b0e02109b9.png b/COMCMS.Web/wwwroot/userfiles/images/2018/9cd54b0e02109b9.png new file mode 100644 index 0000000..ae5a21d Binary files /dev/null and b/COMCMS.Web/wwwroot/userfiles/images/2018/9cd54b0e02109b9.png differ