Commit d0caed85 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents afed56be c984b64b
......@@ -63,5 +63,10 @@ namespace Edu.Cache
/// </summary>
public static string QYWECHAT_GLOBAL_CONFIG_KEY = "QYWECHAT_GLOBAL_CONFIG";
/// <summary>
/// 微信公众号token
/// </summary>
public static readonly string DATA_WeChatAccountToken = "DATA_WeChatAccountToken_";
}
}
......@@ -845,5 +845,28 @@ namespace Edu.Common
return ReadConfigKey("TempToken");
}
}
/// <summary>
/// 公众号的AppId
/// </summary>
public static string WeChatAccountAppId
{
get
{
return ReadConfigKey("WeChatAccountAppId");
}
}
/// <summary>
/// 公众号的AppSecret
/// </summary>
public static string WeChatAccountAppSecret
{
get
{
return ReadConfigKey("WeChatAccountAppSecret");
}
}
}
}
\ No newline at end of file
......@@ -61,5 +61,10 @@ namespace Edu.Common.Enum.Course
[EnumField("阅读选择")]
ReadingChoose = 8,
/// <summary>
/// 听力
/// </summary>
[EnumField("听力")]
Listening = 9,
}
}
\ No newline at end of file
using Edu.Common.Plugin;
namespace Edu.Common.Enum.Exam
{
/// <summary>
/// 试卷组卷类型
/// </summary>
public enum ExamGroupTypeEnum
{
/// <summary>
/// 题目类型(单选题、多选题等)
/// </summary>
[EnumField("题目类型")]
QuestionType = 1,
/// <summary>
/// 题目类型(读音题、语法题等)
/// </summary>
[EnumField("题目分类")]
QuestionClassify = 2,
}
}
......@@ -127,5 +127,10 @@ namespace Edu.Model.Entity.Exam
/// 题目分数
/// </summary>
public decimal Score { get; set; }
/// <summary>
/// 分组编号
/// </summary>
public int GId { get; set; }
}
}
using System;
using Edu.Common.Enum.Course;
using Edu.Common.Enum.Exam;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
......@@ -28,12 +30,12 @@ namespace Edu.Model.Entity.Exam
public string GroupName { get; set; }
/// <summary>
/// 问题类型编号
/// 问题类型编号【GroupType=1时使用】
/// </summary>
public int QuestionTypeId { get; set; }
/// <summary>
/// 问题类型Key
/// 问题类型Key【GroupType=1时使用】
/// </summary>
public string QuestionTypeKey { get; set; }
......@@ -46,5 +48,15 @@ namespace Edu.Model.Entity.Exam
/// 分数
/// </summary>
public decimal GScore { get; set; }
/// <summary>
/// 组卷类型
/// </summary>
public ExamGroupTypeEnum GroupType { get; set; }
/// <summary>
/// 题目分类编号【GroupType=2时使用】
/// </summary>
public QuestionCategoryEnum CategoryId { get; set; }
}
}
using Edu.Common.Enum.Question;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -102,5 +103,15 @@ namespace Edu.Model.Entity.Exam
/// 审核和备注
/// </summary>
public string ExamineRemark { get; set; }
/// <summary>
/// 组卷类型
/// </summary>
public ExamGroupTypeEnum GroupType { get; set; }
/// <summary>
/// 试卷总分数
/// </summary>
public decimal PaperScore { get; set; }
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using System;
using System.Collections.Generic;
......@@ -73,5 +74,10 @@ namespace Edu.Model.Entity.Exam
/// 模板题库编号
/// </summary>
public string TemplateBankIds { get; set; }
/// <summary>
/// 组卷类型
/// </summary>
public ExamGroupTypeEnum GroupType { get; set; }
}
}
\ No newline at end of file
using Edu.Common.Enum;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Grade
{
/// <summary>
/// 班级学员上课反馈实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Class_FeedBack
{
/// <summary>
/// 主键编号
/// </summary>
public int FeedBackId { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 所属校区
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 教师编号
/// </summary>
public int TeacherId { get; set; }
/// <summary>
/// 学员id
/// </summary>
public int OrderGuestId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 上课计划时间id
/// </summary>
public int ClassTimeId { get; set; }
/// <summary>
/// 上课计划id
/// </summary>
public int ClassPlanId { get; set; }
/// <summary>
/// 评分
/// </summary>
public int Score { get; set; }
/// <summary>
/// 评语
/// </summary>
public string Comment { get; set; }
/// <summary>
/// 照片/视频
/// </summary>
public string Photo { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using VT.FW.DB;
namespace Edu.Model.Entity.LearningGarden
{
/// <summary>
/// 学习园地管理实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_LearningGarden
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 封面图片
/// </summary>
public string Img { get; set; }
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 摘要
/// </summary>
public string Digest { get; set; }
/// <summary>
/// 对应公众号文章的url
/// </summary>
public string LinkUrl { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 类型图片(image)、视频(video)、语音 (voice)、图文(news)
/// </summary>
public string TypeId { get; set; }
/// <summary>
/// 微信公众号对应的文章id(media_id)
/// </summary>
public string WeChatAccountId { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人编号
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 作者
/// </summary>
public string Author { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using Edu.Common.Enum.Course;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Exam
{
......@@ -11,13 +10,14 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
public class ExamTemplate
{
/// <summary>
/// 问题类型编号
/// 问题类型编号【GroupType=1时使用】
/// </summary>
public int QuestionTypeId { get; set; }
/// <summary>
/// 问题类型Key
/// 问题类型Key【GroupType=1时使用】
/// </summary>
public string QuestionTypeKey { get; set; }
......@@ -51,10 +51,6 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
public List<DifficultyTypeItem> ChooseList { get; set; }
/// <summary>
/// 题目分类列表
/// </summary>
public List<CategoryItem> CategoryList { get; set; }
}
/// <summary>
......@@ -72,26 +68,4 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
public int ChooseNum { get; set; }
}
/// <summary>
/// 题型分类
/// </summary>
public class CategoryItem
{
/// <summary>
/// 题型分类
/// </summary>
public QuestionCategoryEnum Category { get; set; }
/// <summary>
/// 选择题目数
/// </summary>
public int ChooseNum { get; set; }
/// <summary>
/// 难易程度选题【ChooseType=2时使用】
/// </summary>
public List<DifficultyTypeItem> ChooseList { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Grade;
namespace Edu.Model.ViewModel.Grade
{
public class RB_Class_FeedBack_ViewModel: RB_Class_FeedBack
{
/// <summary>
/// ids
/// </summary>
public string Q_ClassTimeIds { get; set; }
/// <summary>
/// ids
/// </summary>
public string Q_ClassIds { get; set; }
/// <summary>
/// 老师名称
/// </summary>
public string TeacherName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.LearningGarden;
namespace Edu.Model.ViewModel.LearningGarden
{
public class RB_LearningGarden_ViewModel : RB_LearningGarden
{
}
/// <summary>
/// 公众号文章对应的实体
/// </summary>
public class WeChatLearningGarden
{
public WeChatLearningGardenItem item { get; set; }
/// <summary>
/// 该类型的素材的总数
/// </summary>
public int total_count { get; set; }
/// <summary>
/// 本次调用获取的素材的数量
/// </summary>
public int item_count { get; set; }
}
public class WeChatLearningGardenItem
{
/// <summary>
///
/// </summary>
public string media_id { get; set; }
public WeChatLearningGardenContent content { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public string update_time { get; set; }
}
public class WeChatLearningGardenContent
{
public List<WeChatLearningGardenNewsItem> news_item { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public long create_time { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public long update_time { get; set; }
}
public class WeChatLearningGardenNewsItem
{
/// <summary>
/// 图文消息的标题
/// </summary>
public string title { get; set; }
/// <summary>
/// 作者
/// </summary>
public string author { get; set; }
/// <summary>
/// 文消息的摘要,仅有单图文消息才有摘要,多图文此处为空
/// </summary>
public string digest { get; set; }
/// <summary>
/// 文消息的具体内容,支持HTML标签,必须少于2万字符,小于1M,且此处会去除JS
/// </summary>
public string content { get; set; }
/// <summary>
/// 是否显示封面,0为false,即不显示,1为true,即显示
/// </summary>
public int show_cover_pic { get; set; }
/// <summary>
/// 链接地址
/// </summary>
public string url { get; set; }
/// <summary>
/// 封面图片地址
/// </summary>
public string thumb_url { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.ViewModel.LearningGarden;
using Edu.Repository.LearningGarden;
using VT.FW.DB;
namespace Edu.Module.Course
{
public class LearningGardenModule
{
/// <summary>
/// 订单
/// </summary>
private readonly RB_LearningGardenRepository learningGardenRepository = new RB_LearningGardenRepository();
#region 学习园地
/// <summary>
/// 获取学习园地分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_LearningGarden_ViewModel> GetLearningGardenPageModule(int pageIndex, int pageSize, out long rowsCount, RB_LearningGarden_ViewModel query)
{
return learningGardenRepository.GetLearningGardenPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取学习园地列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_LearningGarden_ViewModel> GetLearningGardenListModule(RB_LearningGarden_ViewModel query)
{
return learningGardenRepository.GetLearningGardenListRepository(query);
}
/// <summary>
/// 新增修改新闻
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetLearningGardenModule(RB_LearningGarden_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_LearningGarden_ViewModel.Title),model.Title },
{nameof(RB_LearningGarden_ViewModel.Img),model.Img },
{nameof(RB_LearningGarden_ViewModel.Content),model.Content },
{nameof(RB_LearningGarden_ViewModel.TypeId),model.TypeId },
{nameof(RB_LearningGarden_ViewModel.Digest),model.Digest },
{nameof(RB_LearningGarden_ViewModel.LinkUrl),model.LinkUrl }
};
flag = learningGardenRepository.Update(fileds, new WhereHelper(nameof(RB_LearningGarden_ViewModel.Id), model.Id));
}
else
{
var newId = learningGardenRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 批量新增修改学习园地
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetBatchWebNewsModule(List<RB_LearningGarden_ViewModel> list)
{
bool flag = false;
foreach (var model in list)
{
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_LearningGarden_ViewModel.Title),model.Title },
{nameof(RB_LearningGarden_ViewModel.Img),model.Img },
{nameof(RB_LearningGarden_ViewModel.Content),model.Content },
{nameof(RB_LearningGarden_ViewModel.TypeId),model.TypeId },
{nameof(RB_LearningGarden_ViewModel.Digest),model.Digest },
{nameof(RB_LearningGarden_ViewModel.LinkUrl),model.LinkUrl },
{nameof(RB_LearningGarden_ViewModel.UpdateTime),model.UpdateTime }
};
flag = learningGardenRepository.Update(fileds, new WhereHelper(nameof(RB_LearningGarden_ViewModel.Id), model.Id));
}
else
{
var newId = learningGardenRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
}
return flag;
}
/// <summary>
/// 根据编号获取学习园地详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_LearningGarden_ViewModel GetLearningGardenModule(object Id)
{
return learningGardenRepository.GetEntity<RB_LearningGarden_ViewModel>(Id);
}
/// <summary>
/// 修改学习园地状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status">0-正常,1-删除</param>
/// <returns></returns>
public bool RemoveLearningGardenStatusModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_LearningGarden_ViewModel.Status),Status },
};
var flag = learningGardenRepository.Update(fileds, new WhereHelper(nameof(RB_LearningGarden_ViewModel.Id), Id));
return flag;
}
#endregion
}
}
......@@ -18,6 +18,7 @@ using Edu.Model.ViewModel.EduTask;
using Edu.Common.Enum.Finance;
using Edu.Repository.EduTask;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Course;
namespace Edu.Module.Exam
{
......@@ -309,6 +310,8 @@ namespace Edu.Module.Exam
{nameof(RB_Examination_Group_ViewModel.QuestionTypeKey),gitem.QuestionTypeKey },
{nameof(RB_Examination_Group_ViewModel.GSortNum),gitem.GSortNum },
{nameof(RB_Examination_Group_ViewModel.GScore),gitem.GScore },
{nameof(RB_Examination_Group_ViewModel.GroupType),gitem.GroupType },
{nameof(RB_Examination_Group_ViewModel.CategoryId),gitem.CategoryId },
};
flag = examination_GroupRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Group_ViewModel.GId), gitem.GId));
}
......@@ -324,6 +327,7 @@ namespace Edu.Module.Exam
foreach (var dItem in gitem.DetailsList)
{
dItem.PaperId = model.PaperId;
dItem.GId = gitem.GId;
if (dItem.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......@@ -347,6 +351,7 @@ namespace Edu.Module.Exam
{nameof(RB_Examination_Details_ViewModel.Category),dItem.Category },
{nameof(RB_Examination_Details_ViewModel.LevelType),dItem.LevelType },
{nameof(RB_Examination_Details_ViewModel.Score),dItem.Score },
{nameof(RB_Examination_Details_ViewModel.GId),dItem.GId },
};
flag = examination_DetailsRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Details_ViewModel.Id), dItem.Id));
}
......@@ -383,6 +388,7 @@ namespace Edu.Module.Exam
{nameof(RB_Examination_Template_ViewModel.TemplateDifficultyType),model.TemplateDifficultyType },
{nameof(RB_Examination_Template_ViewModel.TemplateData),model.TemplateData },
{nameof(RB_Examination_Template_ViewModel.TemplateBankIds),model.TemplateBankIds },
{nameof(RB_Examination_Template_ViewModel.GroupType),model.GroupType },
};
flag = examination_TemplateRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Template_ViewModel.TemplateId), model.TemplateId));
}
......@@ -395,6 +401,7 @@ namespace Edu.Module.Exam
}
//获取问题列表
var questionList = new List<RB_Question_ViewModel>();
string Q_QuestionTypeIds = "";
if (model.TempDataList != null && model.TempDataList.Count > 0)
{
......@@ -403,32 +410,39 @@ namespace Edu.Module.Exam
questionList = questionRepository.GetQuestionListRepository(new RB_Question_ViewModel()
{
QBankIds = model.TemplateBankIds,
Q_QuestionTypeIds = Q_QuestionTypeIds
Q_QuestionTypeIds = model.GroupType == ExamGroupTypeEnum.QuestionType ? Q_QuestionTypeIds : "",
QCategoryId = model.GroupType == ExamGroupTypeEnum.QuestionClassify ? Q_QuestionTypeIds : "",
});
//文件夹
var paperModel = new RB_Examination_Paper_ViewModel()
var newPaperId = 0;
if (model.TemplateNum > 1)
{
PaperId = 0,
PaperName = model.TemplateName,
QuestionBandIds = model.TemplateBankIds,
DifficultyType = model.TemplateDifficultyType,
CreateTime = model.CreateTime,
CreateBy = model.CreateBy,
PublishCount = 0,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
GenerateType = 1,
CreateNum = model.TemplateNum,
PaperType = 1,
ParentId = model.ParentId,
IsOpen = model.IsOpen,
};
var newPaperId = examination_PaperRepository.Insert(paperModel);
paperModel.PaperId = newPaperId;
flag = newPaperId > 0;
if (paperModel.CreateNum > 0)
//文件夹
var paperModel = new RB_Examination_Paper_ViewModel()
{
PaperId = 0,
PaperName = model.TemplateName,
QuestionBandIds = model.TemplateBankIds,
DifficultyType = model.TemplateDifficultyType,
CreateTime = model.CreateTime,
CreateBy = model.CreateBy,
PublishCount = 0,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
GenerateType = 1,
CreateNum = model.TemplateNum,
PaperType = 1,
ParentId = model.ParentId,
IsOpen = model.IsOpen,
GroupType = model.GroupType,
};
newPaperId = examination_PaperRepository.Insert(paperModel);
paperModel.PaperId = newPaperId;
flag = newPaperId > 0;
}
if (model.TemplateNum > 0)
{
for (var i = 0; i < paperModel.CreateNum; i++)
for (var i = 0; i < model.TemplateNum; i++)
{
var subModel = new RB_Examination_Paper_ViewModel()
{
......@@ -446,8 +460,9 @@ namespace Edu.Module.Exam
PaperType = 2,
ParentId = newPaperId,
IsOpen = model.IsOpen,
GroupType = model.GroupType,
PaperScore = model.TemplateScore,
};
var newSubPaperId = examination_PaperRepository.Insert(subModel);
subModel.PaperId = newSubPaperId;
flag = newSubPaperId > 0;
......@@ -456,7 +471,15 @@ namespace Edu.Module.Exam
int G_Sort = 1;
foreach (var item in model.TempDataList)
{
var tempQuestioinList = questionList?.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)?.ToList();
var tempQuestioinList = new List<RB_Question_ViewModel>();
if (model.GroupType == ExamGroupTypeEnum.QuestionType)
{
tempQuestioinList = questionList?.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)?.ToList();
}
else if (model.GroupType == ExamGroupTypeEnum.QuestionClassify)
{
tempQuestioinList = questionList?.Where(qitem => qitem.Category.ToInt() == item.QuestionTypeId)?.ToList();
}
var subTempQuestionList = new List<RB_Question_ViewModel>();
//题库随机选题
if (item.ChooseType == 1)
......@@ -475,29 +498,26 @@ namespace Edu.Module.Exam
}
}
}
else if (item.ChooseType == 3)
{
if (item.CategoryList != null && item.CategoryList.Count > 0)
{
foreach (var subItem in item.CategoryList.Where(qitem => qitem.ChooseNum > 0))
{
var tempList = tempQuestioinList?.Where(qitem => qitem.Category == subItem.Category)?.OrderBy(qitem => Guid.NewGuid())?.Take(subItem.ChooseNum)?.ToList();
if (tempList != null && tempList.Count > 0)
{
subTempQuestionList.AddRange(tempList);
}
}
}
}
var groupModel = new RB_Examination_Group_ViewModel()
{
GId = 0,
PaperId = subModel.PaperId,
GroupName = !string.IsNullOrEmpty(item.QuestionDesc) ? item.QuestionDesc : item.QuestionTypeName,
GSortNum = G_Sort,
QuestionTypeId = item.QuestionTypeId,
GScore = item.QuestionScore,
QuestionTypeKey = item.QuestionTypeKey,
GroupType = model.GroupType,
};
if (model.GroupType == ExamGroupTypeEnum.QuestionType)
{
groupModel.QuestionTypeId = item.QuestionTypeId;
groupModel.CategoryId = 0;
}
else if (model.GroupType == ExamGroupTypeEnum.QuestionClassify)
{
groupModel.QuestionTypeId = 0;
groupModel.CategoryId = (QuestionCategoryEnum)item.QuestionTypeId;
}
G_Sort++;
var newGId = examination_GroupRepository.Insert(groupModel);
groupModel.GId = newGId;
......@@ -508,6 +528,7 @@ namespace Edu.Module.Exam
var detailsModel = new RB_Examination_Details_ViewModel()
{
Id = 0,
GId = groupModel.GId,
PaperId = subModel.PaperId,
BankId = qItem.BankId,
QuestionId = qItem.QuestionId,
......@@ -523,15 +544,65 @@ namespace Edu.Module.Exam
UpdateBy = model.CreateBy,
UpdateTime = model.CreateTime,
IsUpdateJobExam = qItem.IsUpdateJobExam,
Status = Common.Enum.DateStateEnum.Normal,
Status = DateStateEnum.Normal,
SortNum = Q_SortNum,
Answer = qItem.Answer,
IsMutex = qItem.IsMutex,
Category = qItem.Category,
LevelType = qItem.LevelType,
Score = item.QuestionScore / subTempQuestionList.Count()
};
string msg = analysisQuestion.CheckQuestion(detailsModel.QuestionTypeKey, detailsModel.QuestionContent, detailsModel.Answer, out string newAnswer);
detailsModel.Score = item.QuestionScore / subTempQuestionList.Count();
//听力题、完型填空、阅读理解
if (qItem.QuestionTypeKey == "cloze")
{
List<colzeItem> clozeList = JsonHelper.DeserializeObject<List<colzeItem>>(qItem.QuestionContent);
decimal tempCScore = 0;
int cIndex = 0;
var sScore = Math.Floor(detailsModel.Score / clozeList.Count * 100) / 100;
foreach (var cItem in clozeList)
{
if (cIndex != clozeList.Count - 1)
{
tempCScore += sScore;
cItem.SubScore = sScore;
}
else
{
cItem.SubScore = detailsModel.Score - tempCScore;
}
cIndex++;
}
detailsModel.QuestionContent = JsonHelper.Serialize(clozeList);
}
else if (qItem.QuestionTypeKey == "listening" || qItem.QuestionTypeKey == "reading-comprehensio")
{
try
{
List<readingComprehensioItem> readingList = JsonHelper.DeserializeObject<List<readingComprehensioItem>>(qItem.QuestionContent);
decimal tempRScore = 0;
int rIndex = 0;
var rScore = Math.Floor(detailsModel.Score / readingList.Count * 100) / 100;
foreach (var rItem in readingList)
{
if (rIndex != readingList.Count - 1)
{
tempRScore += rScore;
rItem.SubScore = rScore;
}
else
{
rItem.SubScore = detailsModel.Score - tempRScore;
}
rIndex++;
}
detailsModel.QuestionContent = JsonHelper.Serialize(readingList);
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "SetPaperTemplateModule_" + JsonHelper.Serialize(detailsModel));
}
}
string msg = analysisQuestion.CheckQuestion(detailsModel.QuestionTypeKey, detailsModel.QuestionContent, detailsModel.Answer, out string newAnswer, IsRequire: false);
if (!string.IsNullOrEmpty(newAnswer))
{
detailsModel.Answer = newAnswer;
......@@ -540,6 +611,7 @@ namespace Edu.Module.Exam
var newDetailsId = examination_DetailsRepository.Insert(detailsModel);
detailsModel.Id = newDetailsId;
flag = newDetailsId > 0;
}
}
}
......@@ -569,16 +641,18 @@ namespace Edu.Module.Exam
if (model.PaperId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Examination_Paper_ViewModel.PaperName),model.PaperName },
{nameof(RB_Examination_Paper_ViewModel.QuestionBandIds),model.QuestionBandIds },
{nameof(RB_Examination_Paper_ViewModel.DifficultyType),model.DifficultyType },
{nameof(RB_Examination_Paper_ViewModel.GenerateType),model.GenerateType },
{nameof(RB_Examination_Paper_ViewModel.CreateNum),model.CreateNum },
{nameof(RB_Examination_Paper_ViewModel.PaperType),model.PaperType },
{nameof(RB_Examination_Paper_ViewModel.ParentId),model.ParentId },
{nameof(RB_Examination_Paper_ViewModel.IsOpen),model.IsOpen }
};
{
{nameof(RB_Examination_Paper_ViewModel.PaperName),model.PaperName },
{nameof(RB_Examination_Paper_ViewModel.QuestionBandIds),model.QuestionBandIds },
{nameof(RB_Examination_Paper_ViewModel.DifficultyType),model.DifficultyType },
{nameof(RB_Examination_Paper_ViewModel.GenerateType),model.GenerateType },
{nameof(RB_Examination_Paper_ViewModel.CreateNum),model.CreateNum },
{nameof(RB_Examination_Paper_ViewModel.PaperType),model.PaperType },
{nameof(RB_Examination_Paper_ViewModel.ParentId),model.ParentId },
{nameof(RB_Examination_Paper_ViewModel.IsOpen),model.IsOpen },
{nameof(RB_Examination_Paper_ViewModel.GroupType),model.GroupType },
{nameof(RB_Examination_Paper_ViewModel.PaperScore),model.PaperScore },
};
flag = examination_PaperRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), model.PaperId));
}
else
......@@ -691,46 +765,67 @@ namespace Edu.Module.Exam
}
foreach (var gItem in extModel.GroupList)
{
gItem.DetailsList = detailsList?.Where(qitem => qitem.QuestionTypeId == gItem.QuestionTypeId)?.OrderBy(qitem => qitem.SortNum)?.ToList() ?? new List<RB_Examination_Details_ViewModel>();
gItem.DetailsList = detailsList?.Where(qitem => qitem.GId == gItem.GId)?.OrderBy(qitem => qitem.SortNum)?.ToList() ?? new List<RB_Examination_Details_ViewModel>();
if (gItem.DetailsList != null && gItem.DetailsList.Count > 0)
{
gItem.GScore = gItem?.DetailsList?.Sum(qitem => qitem.Score) ?? 0;
foreach (var sItem in gItem.DetailsList)
{
List<object> quesAnswerList = new List<object>();
//完型填空
if (sItem.QuestionTypeKey == "cloze")
{
if (!string.IsNullOrEmpty(sItem.Answer.ToString()))
if (sItem.Answer != null && !string.IsNullOrEmpty(sItem.Answer.ToString()))
{
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
try
{
foreach (var tItem in qAnsList)
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
{
quesAnswerList.Add(tItem);
foreach (var tItem in qAnsList)
{
quesAnswerList.Add(tItem);
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetExaminationPaperModule:" + string.Format("PaperId_{0}:DetailsId:{1}", PaperId, sItem.Id));
}
}
}
else if (sItem.QuestionTypeKey == "reading-comprehensio" || sItem.QuestionTypeKey == "listening")
{
if (!string.IsNullOrEmpty(sItem.Answer.ToString()))
if (sItem.Answer != null && !string.IsNullOrEmpty(sItem.Answer.ToString()))
{
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
try
{
foreach (var tItem in qAnsList)
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
{
quesAnswerList.Add(tItem);
foreach (var tItem in qAnsList)
{
quesAnswerList.Add(tItem);
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetExaminationPaperModule:" + string.Format("PaperId_{0}:DetailsId:{1}", PaperId, sItem.Id));
}
}
}
sItem.QuestionAnswerList = quesAnswerList;
sItem.QuestionPointList = pointList?.Where(qitem => sItem.Knowledge.Contains(qitem.PointId.ToString()))?.ToList() ?? new List<RB_Question_Point_ViewModel>();
sItem.QuestionContentObj = analysisQuestion.ParsingQuestion(sItem.QuestionTypeKey, sItem.QuestionContent);
try
{
sItem.QuestionContentObj = analysisQuestion.ParsingQuestion(sItem.QuestionTypeKey, sItem.QuestionContent);
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetExaminationPaperModule— " + Common.Plugin.JsonHelper.Serialize(sItem));
}
string newTitle = sItem.Title;
try
{
......@@ -1307,47 +1402,24 @@ namespace Edu.Module.Exam
foreach (var sItem in stuTempList)
{
var questionModel = gItem?.DetailsList.Where(qitem => qitem.Id == sItem.DetailsId)?.FirstOrDefault();
ExamScore += questionModel.Score;
var QuestionContentObj = new object();
if (isShowAnswer)
{
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, questionModel.QuestionContent, isEdit: true);
}
else
{
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, sItem.StudentContent, isEdit: true);
}
List<object> answerList = new List<object>();
List<object> quesAnswerList = new List<object>();
//填空题、分录题、资料题
if (questionModel.QuestionTypeKey == "fill-in" || questionModel.QuestionTypeKey == "entry-problem" || questionModel.QuestionTypeKey == "data-question")
if (questionModel != null)
{
var tempList = sItem.StundetAnswer.Split('★');
if (tempList != null && tempList.Count() > 0)
ExamScore += questionModel.Score;
var QuestionContentObj = new object();
if (isShowAnswer)
{
foreach (var tItem in tempList)
{
answerList.Add(tItem);
}
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, questionModel.QuestionContent, isEdit: true);
}
}
//完型填空
else if (questionModel.QuestionTypeKey == "cloze")
{
if (!string.IsNullOrEmpty(questionModel.Answer.ToString()))
else
{
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(questionModel.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
{
foreach (var tItem in qAnsList)
{
quesAnswerList.Add(tItem);
}
}
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, sItem.StudentContent, isEdit: true);
}
if (!string.IsNullOrEmpty(sItem.StundetAnswer.ToString()))
List<object> answerList = new List<object>();
List<object> quesAnswerList = new List<object>();
//填空题、分录题、资料题
if (questionModel.QuestionTypeKey == "fill-in" || questionModel.QuestionTypeKey == "entry-problem" || questionModel.QuestionTypeKey == "data-question")
{
var tempList = JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.StundetAnswer.ToString());
var tempList = sItem.StundetAnswer.Split('★');
if (tempList != null && tempList.Count() > 0)
{
foreach (var tItem in tempList)
......@@ -1356,50 +1428,76 @@ namespace Edu.Module.Exam
}
}
}
}
else if (questionModel.QuestionTypeKey == "reading-comprehensio" || questionModel.QuestionTypeKey == "listening")
{
if (!string.IsNullOrEmpty(questionModel.Answer.ToString()))
//完型填空
else if (questionModel.QuestionTypeKey == "cloze")
{
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(questionModel.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
if (!string.IsNullOrEmpty(questionModel.Answer.ToString()))
{
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(questionModel.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
{
foreach (var tItem in qAnsList)
{
quesAnswerList.Add(tItem);
}
}
}
if (!string.IsNullOrEmpty(sItem.StundetAnswer.ToString()))
{
foreach (var tItem in qAnsList)
var tempList = JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.StundetAnswer.ToString());
if (tempList != null && tempList.Count() > 0)
{
quesAnswerList.Add(tItem);
foreach (var tItem in tempList)
{
answerList.Add(tItem);
}
}
}
}
if (!string.IsNullOrEmpty(sItem.StundetAnswer.ToString()))
else if (questionModel.QuestionTypeKey == "reading-comprehensio" || questionModel.QuestionTypeKey == "listening")
{
var qList = JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.StundetAnswer.ToString());
foreach (var mItem in qList)
if (!string.IsNullOrEmpty(questionModel.Answer.ToString()))
{
answerList.Add(mItem);
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(questionModel.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
{
foreach (var tItem in qAnsList)
{
quesAnswerList.Add(tItem);
}
}
}
if (!string.IsNullOrEmpty(sItem.StundetAnswer.ToString()))
{
var qList = JsonHelper.DeserializeObject<List<SubAnswerItem>>(sItem.StundetAnswer.ToString());
foreach (var mItem in qList)
{
answerList.Add(mItem);
}
}
}
var qObj = new
{
PaperDetailsId = sItem.DetailsId,//试卷问题编号
StundetDetailsId = sItem.Id,//考生答题编号
sItem.PaperId,
questionModel.Title,
questionModel.ShowTitle,
QuestionContentObj,
questionModel.QuestionTypeId,
questionModel.QuestionTypeKey,
questionModel.DifficultyType,
questionModel.Score,
Answer = isShowAnswer ? questionModel.Answer : sItem.StundetAnswer,
sItem.StundetAnswer,
QuestionAnswerList = quesAnswerList,
AnswerList = isShowAnswer ? answerList : new List<object>(),
questionModel.AnswerParse,
sItem.StudentScore,
sItem.IsMarking
};
questionList.Add(qObj);
}
var qObj = new
{
PaperDetailsId = sItem.DetailsId,//试卷问题编号
StundetDetailsId = sItem.Id,//考生答题编号
sItem.PaperId,
questionModel.Title,
questionModel.ShowTitle,
QuestionContentObj,
questionModel.QuestionTypeId,
questionModel.QuestionTypeKey,
questionModel.DifficultyType,
questionModel.Score,
Answer = isShowAnswer ? questionModel.Answer : sItem.StundetAnswer,
sItem.StundetAnswer,
QuestionAnswerList = quesAnswerList,
AnswerList = isShowAnswer ? answerList : new List<object>(),
questionModel.AnswerParse,
sItem.StudentScore,
sItem.IsMarking
};
questionList.Add(qObj);
}
}
else
......
......@@ -185,54 +185,56 @@ namespace Edu.Module.Question
/// <param name="isOptionRandom"></param>
/// <param name="isNoAnswer"></param>
/// <returns></returns>
private object GetChooseOptionList(string data,int isOptionRandom,bool isNoAnswer,bool isSingleNum=false,bool isEdit=false)
private object GetChooseOptionList(string data, int isOptionRandom, bool isNoAnswer, bool isSingleNum = false, bool isEdit = false)
{
var obj = new object();
var singleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var newList = new List<optionItem>();
if (!isEdit)
{
singleList.ForEach(item =>
var singleList = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(data);
var newList = new List<optionItem>();
if (!isEdit)
{
item.ShowName = item.Name;
});
}
//选项随机
if (isOptionRandom == 1)
{
var tempList = singleList.OrderBy(qitem => Guid.NewGuid()).ToList();
for (var i = 0; i < tempList.Count; i++)
singleList.ForEach(item =>
{
item.ShowName = item.Name;
});
}
//选项随机
if (isOptionRandom == 1)
{
var item = new optionItem()
var tempList = singleList.OrderBy(qitem => Guid.NewGuid()).ToList();
for (var i = 0; i < tempList.Count; i++)
{
Name = tempList[i].Name,
Content = tempList[i].Content,
IsAnswer = tempList[i].IsAnswer
};
item.ShowName = isSingleNum? (i + 1).ToString() : LetterArray[i];
newList.Add(item);
var item = new optionItem()
{
Name = tempList[i].Name,
Content = tempList[i].Content,
IsAnswer = tempList[i].IsAnswer
};
item.ShowName = isSingleNum ? (i + 1).ToString() : LetterArray[i];
newList.Add(item);
}
}
}
//去掉答案
if (isNoAnswer)
{
singleList.ForEach(item =>
//去掉答案
if (isNoAnswer)
{
item.IsAnswer = false;
});
newList.ForEach(item =>
singleList.ForEach(item =>
{
item.IsAnswer = false;
});
newList.ForEach(item =>
{
item.IsAnswer = false;
});
}
if (isOptionRandom == 1)
{
item.IsAnswer = false;
});
}
if (isOptionRandom == 1)
{
obj = newList;
}
else
{
obj = singleList;
}
obj = newList;
}
else
{
obj = singleList;
}
return obj;
}
......@@ -410,20 +412,32 @@ namespace Edu.Module.Question
//单选、多选、单选(数字)题
if (QuestionTypeKey == "single" || QuestionTypeKey == "multiple" || QuestionTypeKey == "single-number")
{
var optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent);
message = CheckChoose(optionItems);
var tempList = optionItems.Where(qitem => qitem.IsAnswer == true);
if (tempList != null && tempList.Count() > 0)
{
AnalysisAnswer = string.Join(",", tempList.OrderBy(qitem => qitem.Name).Select(qitem => qitem.Name));
}
else
if (!string.IsNullOrEmpty(QuestionContent))
{
AnalysisAnswer = "";
}
if (!string.IsNullOrEmpty(message))
{
return message;
var optionItems = new List<optionItem>();
try
{
optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent);
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, " CheckQuestion:____" + QuestionContent);
}
message = CheckChoose(optionItems);
var tempList = optionItems.Where(qitem => qitem.IsAnswer == true);
if (tempList != null && tempList.Count() > 0)
{
AnalysisAnswer = string.Join(",", tempList.OrderBy(qitem => qitem.Name).Select(qitem => qitem.Name));
}
else
{
AnalysisAnswer = "";
}
if (!string.IsNullOrEmpty(message))
{
return message;
}
}
}
//判断题
......
......@@ -125,7 +125,19 @@ namespace Edu.Module.Question
/// <returns></returns>
public List<RB_Question_ViewModel> GetQuestionPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Question_ViewModel query)
{
return questionRepository.GetQuestionPageListRepository(pageIndex, pageSize, out rowsCount, query);
var list = questionRepository.GetQuestionPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
if (item.QuestionTypeKey == "reading-comprehensio" || item.QuestionTypeKey == "listening" || item.QuestionTypeKey == "cloze")
{
var obj = ParsingQuestionModule(item.QuestionTypeKey, item.QuestionContent);
item.QuestionContent = Common.Plugin.JsonHelper.Serialize(obj);
}
}
}
return list;
}
/// <summary>
......@@ -143,7 +155,7 @@ namespace Edu.Module.Question
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<object> GetQuestionCategoryListModule(RB_Question_ViewModel query)
public List<object> GetQuestionTypeStaticListModule(RB_Question_ViewModel query)
{
List<object> list = new List<object>();
var dataList = questionRepository.GetQuestionStaticsListRepository(query);
......@@ -158,11 +170,12 @@ namespace Edu.Module.Question
{
var qType = questionTypeList?.Where(qitem => qitem.QId == item.QuestionTypeId)?.FirstOrDefault();
var diffTypeList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)
.GroupBy(qitem =>new { qitem.DifficultyType })
.Select(qitem => new
{
qitem.DifficultyType,
DifficultyTypeName = qitem.DifficultyType.ToName(),
DifficultyTypeCount = qitem.QuestionCount,
qitem.Key.DifficultyType,
DifficultyTypeName = qitem.Key.DifficultyType.ToName(),
DifficultyTypeCount = qitem.Sum(sItem=>sItem.QuestionCount),
ChooseNum = 0
});
......@@ -190,22 +203,21 @@ namespace Edu.Module.Question
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<object> GetQuestionCategoryList_V2Module(RB_Question_ViewModel query)
public List<object> GetQuestionCategoryStaticListModule(RB_Question_ViewModel query)
{
List<object> list = new List<object>();
var dataList = questionRepository.GetQuestionStaticsListRepository(query);
if (dataList != null && dataList.Count > 0)
{
var questionTypeList = GetQuestionTypeListModule(new RB_Question_Type_ViewModel());
var groupList = dataList.GroupBy(qitem => new { qitem.QuestionTypeId, }).Select(qitem => new
var groupList = dataList.GroupBy(qitem => new { qitem.Category, }).Select(qitem => new
{
qitem.Key.QuestionTypeId
qitem.Key.Category
});
foreach (var item in groupList)
{
var qType = questionTypeList?.Where(qitem => qitem.QId == item.QuestionTypeId)?.FirstOrDefault();
var diffTypeList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)
.GroupBy(qitem => new { qitem.QuestionTypeId,qitem.DifficultyType})
var diffTypeList = dataList.Where(qitem => qitem.Category == item.Category)
.GroupBy(qitem => new {qitem.DifficultyType})
.Select(qitem => new
{
qitem.Key.DifficultyType,
......@@ -213,41 +225,17 @@ namespace Edu.Module.Question
DifficultyTypeCount = qitem.Sum(c=>c.QuestionCount),
ChooseNum = 0
});
var categoryList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId).GroupBy(qitem => new { qitem.Category }).Select(qitem => new { qitem.Key.Category });
List<object> resultCategoryList = new List<object>();
foreach (var subItem in categoryList)
{
var tempCategoryList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId && qitem.Category == subItem.Category)?.ToList();
if (tempCategoryList != null && tempCategoryList.Count > 0)
{
var cObj = new
{
subItem.Category,
CategoryName = subItem.Category.ToName(),
QuestionTypeNum = tempCategoryList.Sum(qitem=>qitem.QuestionCount),
ChooseNum = 0,
ChooseList= tempCategoryList?.Select(qitem => new
{
qitem.DifficultyType,
DifficultyTypeName = qitem.DifficultyType.ToName(),
DifficultyTypeCount = qitem.QuestionCount,
ChooseNum = 0
})
};
resultCategoryList.Add(cObj);
}
}
var obj = new
{
item.QuestionTypeId,
QuestionTypeKey = qType?.Key,
QuestionTypeName = qType?.Name,
QuestionTypeId=item.Category,
QuestionTypeKey = "",
QuestionTypeName =item.Category.ToName(),
QuestionScore = 0,
QuestionDesc = "",
ChooseType = 1,
ChooseNum = 0,
QuestionTypeNum = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId).Sum(qitem => qitem.QuestionCount),
CategoryList= resultCategoryList,
QuestionTypeNum = dataList.Where(qitem => qitem.Category == item.Category).Sum(qitem => qitem.QuestionCount),
ChooseList = diffTypeList,
};
list.Add(obj);
......
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Grade;
namespace Edu.Repository.Grade
{
public class RB_Class_FeedBackRepository:BaseRepository<RB_Class_FeedBack>
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Common.Enum;
using Edu.Model.Entity.LearningGarden;
using Edu.Model.ViewModel.LearningGarden;
using VT.FW.DB.Dapper;
namespace Edu.Repository.LearningGarden
{
public class RB_LearningGardenRepository:BaseRepository<RB_LearningGarden>
{
/// <summary>
/// 获取学习园地分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_LearningGarden_ViewModel> GetLearningGardenPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_LearningGarden_ViewModel query)
{
rowsCount = 0;
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_LearningGarden AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_LearningGarden_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_LearningGarden_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_LearningGarden_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Title))
{
builder.AppendFormat(" AND A.{0} LIKE @Title ", nameof(RB_LearningGarden_ViewModel.Title));
parameters.Add("Title", "%" + query.Title.Trim() + "%");
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_LearningGarden_ViewModel.Id));
return GetPage<RB_LearningGarden_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取学习园地列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_LearningGarden_ViewModel> GetLearningGardenListRepository(RB_LearningGarden_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_LearningGarden AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_LearningGarden_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_LearningGarden_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_LearningGarden_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Title))
{
builder.AppendFormat(" AND A.{0} LIKE @Title ", nameof(RB_LearningGarden_ViewModel.Title));
parameters.Add("Title", "%" + query.Title.Trim() + "%");
}
}
return Get<RB_LearningGarden_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -22,10 +22,11 @@ namespace Edu.Repository.Question
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Question
WHERE 1=1
SELECT A.*
FROM RB_Question AS A INNER JOIN rb_question_bank AS B ON A.BankId=B.BankId
WHERE 1=1 AND B.Status=0
");
if (query == null)
{
return new List<RB_Question_ViewModel>();
......@@ -34,15 +35,19 @@ WHERE 1=1
{
if (!string.IsNullOrEmpty(query.QBankIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.BankId), query.QBankIds);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.BankId), query.QBankIds);
}
if (query.CourseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Question_ViewModel.CourseId), query.CourseId);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Question_ViewModel.CourseId), query.CourseId);
}
if (!string.IsNullOrEmpty(query.Q_QuestionTypeIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.QuestionTypeId), query.Q_QuestionTypeIds);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.QuestionTypeId), query.Q_QuestionTypeIds);
}
if (!string.IsNullOrEmpty(query.QCategoryId))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.Category), query.QCategoryId);
}
return Get<RB_Question_ViewModel>(builder.ToString()).ToList();
}
......@@ -57,9 +62,9 @@ WHERE 1=1
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT QuestionTypeId,DifficultyType,Category,Count(QuestionId) AS QuestionCount
FROM RB_Question
WHERE 1=1 AND `Status`=0
SELECT A.QuestionTypeId, A.DifficultyType,A.Category,Count(A.QuestionId) AS QuestionCount
FROM RB_Question AS A INNER JOIN rb_question_bank AS B ON A.BankId=B.BankId
WHERE 1=1 AND B.Status=0 AND A.Status=0
");
if (query == null)
{
......@@ -69,21 +74,22 @@ WHERE 1=1 AND `Status`=0
{
if (!string.IsNullOrEmpty(query.QBankIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.BankId), query.QBankIds);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.BankId), query.QBankIds);
}
if (query.CourseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Question_ViewModel.CourseId), query.CourseId);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Question_ViewModel.CourseId), query.CourseId);
}
if (!string.IsNullOrEmpty(query.Q_QuestionTypeIds))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.QuestionTypeId), query.Q_QuestionTypeIds);
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Question_ViewModel.QuestionTypeId), query.Q_QuestionTypeIds);
}
builder.AppendFormat(" GROUP BY QuestionTypeId,DifficultyType,Category ");
builder.AppendFormat(" GROUP BY A.QuestionTypeId,A.DifficultyType,A.Category ");
return Get<RB_Question_ViewModel>(builder.ToString()).ToList();
}
}
/// <summary>
/// 获取问题分页列表
/// </summary>
......@@ -100,7 +106,9 @@ WHERE 1=1 AND `Status`=0
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.`Name` ,'') AS QuestionTypeName
FROM RB_Question AS A LEFT JOIN RB_Question_Type B ON A.QuestionTypeId=B.QId
WHERE 1=1 ");
INNER JOIN rb_question_bank AS C ON A.BankId=C.BankId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Question_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
......
......@@ -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
}
}
......@@ -241,13 +241,31 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 根据题库编号获取题库题型列表【试卷组卷使用】
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetQuestionTypeStaticList()
{
var query = new RB_Question_ViewModel()
{
CourseId = base.ParmJObj.GetInt("CourseId"),
Title = base.ParmJObj.GetStringValue("Title"),
PointName = base.ParmJObj.GetStringValue("PointName"),
BankId = base.ParmJObj.GetInt("BankId"),
QBankIds = base.ParmJObj.GetStringValue("QBankIds"),
};
var data = questionModule.GetQuestionTypeStaticListModule(query);
return ApiResult.Success(data: data);
}
/// <summary>
/// 根据题库编号获取题库题型分类列表【试卷组卷使用】
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetQuestionCategoryList()
public ApiResult GetQuestionCategoryStaticList()
{
var query = new RB_Question_ViewModel()
{
......@@ -257,11 +275,10 @@ namespace Edu.WebApi.Controllers.Course
BankId = base.ParmJObj.GetInt("BankId"),
QBankIds = base.ParmJObj.GetStringValue("QBankIds"),
};
var data = questionModule.GetQuestionCategoryList_V2Module(query);
var data = questionModule.GetQuestionCategoryStaticListModule(query);
return ApiResult.Success(data: data);
}
/// <summary>
/// 获取问题难易列表
/// </summary>
......
......@@ -179,7 +179,7 @@ namespace Edu.WebApi.Controllers.Course
Group_Id = base.UserInfo.Group_Id,
School_Id = -1,
ClassId = base.ParmJObj.GetInt("ClassId"),
OrderBy= base.ParmJObj.GetInt("OrderBy",0),
OrderBy = base.ParmJObj.GetInt("OrderBy", 0),
ClassType = base.ParmJObj.GetInt("ClassType")// //课程类型(0-全部,1-正常,2-试听课)
};
var result = classModule.GetTeacherPlan(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
......@@ -272,7 +272,7 @@ namespace Edu.WebApi.Controllers.Course
}
/// <summary>
/// 获取学员列表
......@@ -322,5 +322,10 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Success(data: result);
}
#endregion
#region 上课反馈
#endregion
}
}
......@@ -136,6 +136,8 @@ namespace Edu.WebApi.Controllers.Exam
PaperType = base.ParmJObj.GetInt("PaperType"),
ParentId = base.ParmJObj.GetInt("ParentId"),
IsOpen = base.ParmJObj.GetInt("IsOpen"),
GroupType=(ExamGroupTypeEnum)base.ParmJObj.GetInt("GroupType"),
PaperScore=base.ParmJObj.GetDecimal("PaperScore"),
};
if (string.IsNullOrEmpty(extModel.PaperName))
{
......@@ -157,12 +159,23 @@ namespace Edu.WebApi.Controllers.Exam
GId = jobj.GetInt("GId"),
PaperId = jobj.GetInt("PaperId"),
GroupName = jobj.GetStringValue("GroupName"),
QuestionTypeId = jobj.GetInt("QuestionTypeId"),
QuestionTypeKey = jobj.GetStringValue("QuestionTypeKey"),
GSortNum = gSortNum,
GScore = jobj.GetDecimal("GScore"),
DetailsList = new List<RB_Examination_Details_ViewModel>(),
GroupType=extModel.GroupType,
};
if (extModel.GroupType == ExamGroupTypeEnum.QuestionType)
{
gModel.QuestionTypeId = jobj.GetInt("QuestionTypeId");
gModel.QuestionTypeKey = jobj.GetStringValue("QuestionTypeKey");
gModel.CategoryId = 0;
}
else if (extModel.GroupType == ExamGroupTypeEnum.QuestionClassify)
{
gModel.QuestionTypeId = 0;
gModel.QuestionTypeKey = "";
gModel.CategoryId = (QuestionCategoryEnum)jobj.GetInt("QuestionTypeId");
}
gSortNum++;
string details = jobj.GetStringValue("DetailsList");
if (!string.IsNullOrEmpty(details))
......@@ -202,7 +215,7 @@ namespace Edu.WebApi.Controllers.Exam
string msg = analysisQuestion.CheckQuestion(detailModel.QuestionTypeKey, detailModel.QuestionContent, detailModel.Answer, out string newAnswer);
if (!string.IsNullOrEmpty(msg))
{
return ApiResult.Failed(message: msg);
return ApiResult.Failed(message: "【" + gModel.GroupName + "," + (dSortNum) + "题】" + msg);
}
else
{
......@@ -245,6 +258,7 @@ namespace Edu.WebApi.Controllers.Exam
IsSaveTemplate = base.ParmJObj.GetBoolValue("IsSaveTemplate"),
ParentId = base.ParmJObj.GetInt("ParentId"),
IsOpen = base.ParmJObj.GetInt("IsOpen"),
GroupType=(ExamGroupTypeEnum)base.ParmJObj.GetInt("GroupType"),
};
string TemplateData = base.ParmJObj.GetStringValue("TemplateData");
if (!string.IsNullOrEmpty(TemplateData))
......@@ -314,7 +328,9 @@ namespace Edu.WebApi.Controllers.Exam
TemplateDifficultyTypeName = item.TemplateDifficultyType.ToName(),
TemplateData = templist,
item.TemplateBankIds,
QuestionStructure = QuestionStructure.TrimStart(';')
QuestionStructure = QuestionStructure.TrimStart(';'),
item.GroupType,
GroupTypeName=item.GroupType.ToName(),
});
}
pageModel.Count = rowsCount;
......
using System;
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.Plugin;
using Edu.Model.ViewModel.LearningGarden;
using Edu.Module.Course;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
namespace Edu.WebApi.Controllers.LearningGarden
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class SchoolGardenController : BaseController
{
/// <summary>
/// 学习园地处理类对象
/// </summary>
private readonly LearningGardenModule learningGardenModule = AOP.AOPHelper.CreateAOPObject<LearningGardenModule>();
#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.UserInfo.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]
[AllowAnonymous]
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);
}
/// <summary>
/// 新增修改网站学习园地
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetLearningGarden()
{
var extModel = new RB_LearningGarden_ViewModel()
{
Id = base.ParmJObj.GetInt("Id"),
Title = base.ParmJObj.GetStringValue("Title"),
Img = base.ParmJObj.GetStringValue("Img"),
Content = base.ParmJObj.GetStringValue("Content"),
Digest = base.ParmJObj.GetStringValue("Digest"),
LinkUrl = base.ParmJObj.GetStringValue("LinkUrl"),
};
extModel.School_Id = base.UserInfo.School_Id;
extModel.Group_Id = base.UserInfo.Group_Id;
extModel.CreateBy = base.UserInfo.Id;
extModel.CreateDate = DateTime.Now;
extModel.UpdateTime = DateTime.Now;
extModel.Status = DateStateEnum.Normal;
bool flag = learningGardenModule.SetLearningGardenModule(extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
/// <summary>
/// 修改网站学习园地状态
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveLearningGardenStatus()
{
var Id = base.ParmJObj.GetInt("Id", 0);
var Status = base.ParmJObj.GetInt("Status", 0);
var flag = learningGardenModule.RemoveLearningGardenStatusModule(Id, Status);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 同步公众号的文章
/// <summary>
/// 获取数据
/// </summary>
/// <param name="cookie"></param>
[HttpPost]
public ApiResult GetGoodsData()
{
int pageIndex = 1;
int pageSize = 20;
int pageCount = 0;
//获取token
string tokenKey = Cache.CacheKey.DATA_WeChatAccountToken + Common.Config.WeChatAccountAppId;
string token = Cache.WeChat.WeChatReidsCache2.GetToken(tokenKey);
if (Common.Config.IsLocal == 1)
{
token = "49_j9OOoNVD3jcqJPXX3nb6jalJ9L4AlsltW60JCULR0PikrvW-CYzoFJXK9iS7sK3ygztuf0q5DRGmdJwU7MTqH8tNDtqsMthLHbuiHVVlWIAcycqq24kLKS9K4-FxFMoR-tzLdQOpkYZvDWrEXOFaABAMDU";
}
if (string.IsNullOrEmpty(token))
{
token = Common.Plugin.WeChatHelper.GetAccessToken(Common.Config.WeChatAccountAppId, Common.Config.WeChatAccountAppSecret);
Cache.WeChat.WeChatReidsCache2.Set(tokenKey, token);
}
var resultTotalCount = HttpHelper.HttpGet("https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=" + token);
JObject parm = JObject.Parse(resultTotalCount);
List<WeChatLearningGardenItem> allList = new List<WeChatLearningGardenItem>();
pageCount = parm.GetInt("news_count");//图文总数
while (((pageIndex - 1) * pageSize) <= pageCount)
{
string dt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var tempImgList = GetGoodsList(pageIndex, pageSize);
if (tempImgList != null && tempImgList.Any())
{
allList.AddRange(tempImgList);
}
pageIndex++;
}
List<RB_LearningGarden_ViewModel> learningGardenList = new List<RB_LearningGarden_ViewModel>();
//查询数据库信息
List<RB_LearningGarden_ViewModel> oldLearningGardenList = new List<RB_LearningGarden_ViewModel>();
oldLearningGardenList = learningGardenModule.GetLearningGardenListModule(new RB_LearningGarden_ViewModel { Group_Id = base.UserInfo.Group_Id });
if (allList != null && allList.Any())
{
foreach (var item in allList)
{
foreach (var itemNews in item.content.news_item)
{
RB_LearningGarden_ViewModel extModel = new RB_LearningGarden_ViewModel()
{
Id = 0,
WeChatAccountId = item.media_id,
Title = itemNews.title,
Img = itemNews.thumb_url,
Content = itemNews.content,
Digest = itemNews.digest,
LinkUrl = itemNews.url,
CreateDate = Convert.ToDateTime(GetTime(item.content.create_time)),
UpdateTime = Convert.ToDateTime(GetTime(item.content.update_time)),
Author = itemNews.author,
CreateBy = 0
};
//判断当前文章数据库离是否已存在
var nowLearningGardenModel = oldLearningGardenList.Where(x => x.WeChatAccountId == item.media_id).FirstOrDefault();
if (nowLearningGardenModel != null && nowLearningGardenModel.Id > 0)
{
extModel.Id = nowLearningGardenModel.Id;
}
extModel.School_Id = base.UserInfo.School_Id;
extModel.TypeId = "news";
extModel.Group_Id = base.UserInfo.Group_Id;
extModel.Status = DateStateEnum.Normal;
learningGardenList.Add(extModel);
}
}
}
learningGardenModule.SetBatchWebNewsModule(learningGardenList);
return ApiResult.Success("");
}
/// <summary>
/// 时间戳转为C#格式时间
/// </summary>
/// <param name="timeStamp">Unix时间戳格式</param>
/// <returns>C#格式时间</returns>
public static string GetTime(long timeStamp)
{
try
{
long begtime = timeStamp * 10000000;
DateTime dt_1970 = new DateTime(1970, 1, 1, 0, 0, 0);
long tricks_1970 = dt_1970.Ticks;//1970年1月1日刻度
long time_tricks = tricks_1970 + begtime;//日志日期刻度
DateTime dt = new DateTime(time_tricks);//转化为DateTime
return dt.ToString("yyyy-MM-dd HH:mm:ss");
}
catch (Exception ex)
{
return "";
}
}
static List<WeChatLearningGardenItem> GetGoodsList(int pageIndex, int pageSize)
{
string tokenKey = Cache.CacheKey.DATA_WeChatAccountToken + Common.Config.WeChatAccountAppId;
string token = Cache.WeChat.WeChatReidsCache2.GetToken(tokenKey);
if (Common.Config.IsLocal == 1)
{
token = "49_j9OOoNVD3jcqJPXX3nb6jalJ9L4AlsltW60JCULR0PikrvW-CYzoFJXK9iS7sK3ygztuf0q5DRGmdJwU7MTqH8tNDtqsMthLHbuiHVVlWIAcycqq24kLKS9K4-FxFMoR-tzLdQOpkYZvDWrEXOFaABAMDU";
}
if (string.IsNullOrEmpty(token))
{
token = Common.Plugin.WeChatHelper.GetAccessToken(Common.Config.WeChatAccountAppId, Common.Config.WeChatAccountAppSecret);
Cache.WeChat.WeChatReidsCache2.Set(tokenKey, token);
}
WeChatLearningGarden model = new WeChatLearningGarden();
string newImaApi = "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=" + token;
List<WeChatLearningGardenItem> list = new List<WeChatLearningGardenItem>();
var resultInfo = new
{
type = "news",
offset = (pageIndex - 1) * pageSize,
count = pageSize
};
string jsonData = HttpHelper.HttpPost(newImaApi, JsonHelper.Serialize(resultInfo), "");
if (jsonData != null && !string.IsNullOrEmpty(jsonData))
{
JObject jObj = JObject.Parse(jsonData);
var item = jObj.GetStringValue("item");
list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WeChatLearningGardenItem>>(item);
//if (model != null && model.item != null)
//{
// list.Add(model.item);
//}
}
return list;
}
#endregion
}
}
......@@ -43,6 +43,8 @@
"JHTenantId": "15",
"JHMallBaseId": "5",
"JHMallUserOpenId": "oshxs5I-6uR1J91Rs3QVyi2rJIm4",
"WeChatAccountAppId": "wx7c2cedaebbfca211",
"WeChatAccountAppSecret": "6fd676c7f599bc2783fab6ae6c7a12d4",
"Notice_BaseKey": "Notice_BaseKey",
"EducationContractSchool": "EducationContractSchool",
"EducationContractAdmin": "EducationContractAdmin",
......
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