Commit 73ad67db authored by 吴春's avatar 吴春

提交代码

parent ab4cf9c4
......@@ -2,12 +2,15 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Exam;
using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.LearningGarden;
using Edu.Model.ViewModel.User;
using Edu.Module.Course;
using Edu.Module.EduTask;
......@@ -55,6 +58,12 @@ namespace Edu.WebApi.Controllers.Applet
/// </summary>
private readonly Module.Exam.PaperModule paperModule = AOP.AOPHelper.CreateAOPObject<Module.Exam.PaperModule>();
/// <summary>
/// 学习园地处理类对象
/// </summary>
private readonly LearningGardenModule learningGardenModule = AOP.AOPHelper.CreateAOPObject<LearningGardenModule>();
#region 小程序首页
/// <summary>
/// 小程序首页
......@@ -649,5 +658,84 @@ namespace Edu.WebApi.Controllers.Applet
}
#endregion
#region 学习园地
/// <summary>
/// 获取学习园地分页
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GeLearningGardenPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_LearningGarden_ViewModel()
{
Title = base.ParmJObj.GetStringValue("Title"),
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
query.Status = DateStateEnum.Normal;
query.Group_Id = base.AppletUserInfo.Group_Id;
var list = learningGardenModule.GetLearningGardenPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
List<object> resultList = new List<object>();
foreach (var item in list)
{
string CreateByName = "甲鹤教育";
if (item.CreateBy > 0)
{
CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
resultList.Add(new
{
item.Id,
item.Title,
item.Content,
item.Img,
item.Digest,
item.LinkUrl,
CreateByName,
CreateTime = Common.Plugin.StringHelper.DateFormatToString(item.CreateDate)
});
}
pageModel.Count = rowsCount;
pageModel.PageData = resultList;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取学习园地详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetLearningGarden()
{
var Id = base.ParmJObj.GetInt("Id", 0);
var extModel = learningGardenModule.GetLearningGardenModule(Id);
object obj = new object();
if (extModel != null && extModel.Id > 0)
{
string CreateByName = "甲鹤教育";
if (extModel.CreateBy > 0)
{
CreateByName = UserReidsCache.GetUserLoginInfo(extModel.CreateBy)?.AccountName ?? "";
}
obj = new
{
extModel.Id,
extModel.Title,
extModel.Img,
extModel.Content,
extModel.Digest,
extModel.LinkUrl,
CreateByName,
CreateTime = Common.Plugin.StringHelper.DateFormatToString(extModel.CreateDate)
};
}
return ApiResult.Success(data: obj);
}
#endregion
}
}
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