Commit 2a22df08 authored by 黄奎's avatar 黄奎

新增实体类

parent 4eabd141
......@@ -95,5 +95,10 @@ namespace Edu.Model.Entity.User
/// 法定代表人
/// </summary>
public string LegalPerson { get; set; }
/// <summary>
/// 官网地址
/// </summary>
public string WebSiteDomain { get; set; }
}
}
\ No newline at end of file
......@@ -27,6 +27,22 @@ namespace Edu.Module.User
return groupRepository.GetGroupListRepository(query);
}
/// <summary>
/// 根据前端域名获取集团编号
/// </summary>
/// <param name="domain"></param>
/// <returns></returns>
public int GetGroupIdByDomainModule(string domain)
{
var groupList = GetGroupListModule(new Model.ViewModel.User.RB_Group_ViewModel() { WebSiteDomain = domain });
int groupId = 0;
if (groupList != null && groupList.Count > 0)
{
groupId = groupList?.FirstOrDefault()?.GId ?? 0;
}
return groupId;
}
/// <summary>
/// 获取集团分页列表
/// </summary>
......@@ -72,6 +88,7 @@ namespace Edu.Module.User
{nameof(RB_Group_ViewModel.Logo),model.Logo },
{nameof(RB_Group_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Group_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Group_ViewModel.WebSiteDomain),model.WebSiteDomain },
};
flag = groupRepository.Update(fileds, new WhereHelper(nameof(RB_Group_ViewModel.GId), model.GId));
}
......
using Edu.Model.ViewModel.Web;
using Edu.Repository.Web;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Module.Web
......@@ -40,6 +39,50 @@ namespace Edu.Module.Web
return web_MenuRepository.GetWebMenuListRepository(query);
}
/// <summary>
/// 获取树形结构菜单
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public object GetMenuTreeModule(RB_Web_Menu_ViewModel query)
{
List<object> result = new List<object>();
var list = GetWebMenuListModule(query);
if (list != null && list.Count > 0)
{
var firstList = list.Where(qitem => qitem.MenuLevel == 1).OrderBy(qitem => qitem.SortNum);
if (firstList != null && firstList.Count() > 0)
{
foreach (var rootItem in firstList)
{
var subList = list.Where(qitem => qitem.MenuLevel == 2 && qitem.ParentId == rootItem.Id).OrderBy(qitem => qitem.SortNum);
List<object> secondList = new List<object>();
foreach (var subItem in subList)
{
var childList = list.Where(qitem => qitem.MenuLevel == 3 && qitem.ParentId == subItem.Id).OrderBy(qitem => qitem.SortNum);
secondList.Add(new
{
subItem.Name,
subItem.MenuUrl,
subItem.Icon,
subItem.ClassName,
ChildList = childList?.Select(qitem => new { qitem.Name, qitem.MenuUrl, qitem.Icon, qitem.ClassName })
});
}
result.Add(new
{
rootItem.Name,
rootItem.MenuUrl,
rootItem.Icon,
rootItem.ClassName,
ChildList = secondList
});
}
}
}
return result;
}
/// <summary>
/// 新增修改网站前台菜单
/// </summary>
......
......@@ -58,6 +58,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Group_ViewModel.GId),query.GId);
}
if (!string.IsNullOrEmpty(query.WebSiteDomain))
{
builder.AppendFormat(" AND {0}='{1}' ", nameof(RB_Group_ViewModel.WebSiteDomain), query.WebSiteDomain);
}
}
return Get<RB_Group_ViewModel>(builder.ToString(),parameters).ToList();
}
......
using Edu.Common.API;
using Edu.AOP;
using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.Web;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Web;
using Edu.Module.Course;
using Edu.Module.User;
using Edu.Module.Web;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
......@@ -28,6 +33,50 @@ namespace Edu.WebApi.Controllers.Web
/// </summary>
private readonly WebNavModule navModule = new WebNavModule();
/// <summary>
/// 集团处理类对象
/// </summary>
private readonly GroupModule groupModule = AOPHelper.CreateAOPObject<GroupModule>();
/// <summary>
/// 网站菜单管理处理类对象
/// </summary>
private readonly WebMenuModule menuModule = new WebMenuModule();
/// <summary>
/// 网站新闻管理处理类对象
/// </summary>
private readonly WebNewsModule newsModule = new WebNewsModule();
/// <summary>
/// 课程系列处理类
/// </summary>
private readonly CourseCategoryModule categoryModule = new CourseCategoryModule();
/// <summary>
/// 课程处理类对象
/// </summary>
private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>();
/// <summary>
/// 获取网站配置
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetWebSiteConfig()
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
var menuList = menuModule.GetMenuTreeModule(new RB_Web_Menu_ViewModel() { Group_Id = groupId });
var obj = new
{
groupId,
menuList
};
return ApiResult.Success(data: obj);
}
/// <summary>
/// 获取网站导航列表
/// </summary>
......@@ -43,8 +92,118 @@ namespace Edu.WebApi.Controllers.Web
NavType = (NavTypeEnum)base.ParmJObj.GetInt("NavType"),
Group_Id = base.ParmJObj.GetInt("Group_Id"),
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = navModule.GetWebNavListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取网站新闻类型列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetWebNewsTypeList()
{
var query = new RB_Web_NewsType_ViewModel()
{
TypeName = base.ParmJObj.GetStringValue("TypeName"),
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = newsModule.GetWebNewsTypeListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取新闻分页
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetWebNewsPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Web_News_ViewModel()
{
Title = base.ParmJObj.GetStringValue("Title"),
TypeId = base.ParmJObj.GetInt("TypeId"),
Status = DateStateEnum.Normal,
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = newsModule.GetWebNewsPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取课程分类列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetCourseCategoryList()
{
var query = new RB_Course_Category_ViewModel()
{
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = categoryModule.GetCourseCategoryListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取课程分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCoursePageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Course_ViewModel()
{
CourseName = base.ParmJObj.GetStringValue("CourseName"),
QCateIds = base.ParmJObj.GetStringValue("QCateIds"),
Status = (DateStateEnum)base.ParmJObj.GetInt("Status"),
IsQPrice = base.ParmJObj.GetInt("IsQPrice"),
IsQTeacher = base.ParmJObj.GetInt("IsQTeacher"),
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = courseModule.GetCoursePageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment