master
xiaochanghai 6 months ago
parent b8ea65888e
commit 8f75bf331d
  1. 11
      Tiobon.Core.Services/CommonServices.cs
  2. 27
      Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Mysqlx.Expr;
using System.Text.RegularExpressions;
namespace Tiobon.Core.Services;
@ -8,10 +9,12 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
{
IHttpContextAccessor _httpContextAccessor;
ILogger<PayServices> _logger;
public CommonServices(ILogger<PayServices> logger, IHttpContextAccessor httpContextAccessor)
public ICaching _caching;
public CommonServices(ILogger<PayServices> logger, IHttpContextAccessor httpContextAccessor, ICaching caching = null)
{
_logger = logger;
_httpContextAccessor = httpContextAccessor;
_caching = caching;
}
#region 获取菜单
@ -1953,6 +1956,8 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
#endregion
result.DT_PageMutiMsg = await _caching.GetAsync<List<DT_PageMutiMsg>>(param.menuName + "_DT_PageMutiMsg");
#region 多语返回处理
if (param.menuName == "F_ResumeMaintenance_All" ||
param.menuName == "F_ResumeMaintenance_Process" ||
@ -1986,7 +1991,11 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
}
#endregion
if (result.DT_PageMutiMsg is null)
{
result.DT_PageMutiMsg = Db.Ado.SqlQuery<DT_PageMutiMsg>(sqlLang);
await _caching.SetAsync(param.menuName + "_DT_PageMutiMsg", result.DT_PageMutiMsg, TimeSpan.FromMinutes(5));
}
return new ServiceResult<ModuleReturn>() { Success = true, Message = "查询成功", Data = result, };
}

@ -908,7 +908,24 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
if (string.IsNullOrEmpty(questionContent))
comments.Add("题目内容为必填项!");
var question = await base.Query(x => x.QuestionContent == questionContent && x.QuestionType == questionType);
if (courseName.IsNullOrEmpty())
{
comments.Add("课程为必填项!");
continue;
}
Ghre_CourseDto course = null;
if (!string.IsNullOrEmpty(courseName))
{
course = await _ghre_CourseServices.QuerySingleDto(x => x.CourseName == courseName);
if (course is null)
{
comments.Add("课程不存在,请修正!");
continue;
}
}
var question = await base.Query(x => x.QuestionContent == questionContent && x.QuestionType == questionType && x.CourseId == course.Id);
if (!question.Any())
{
@ -921,14 +938,6 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
if (string.IsNullOrWhiteSpace(questionAnalysis))
comments.Add("题目解析必填!");
Ghre_CourseDto course = null;
if (!string.IsNullOrEmpty(courseName))
{
course = await _ghre_CourseServices.QuerySingleDto(x => x.CourseName == courseName);
if (course is null)
comments.Add("课程不存在,请修正!");
}
var insert = new InsertGhre_QuestionInput()
{
CourseId = course?.Id,

Loading…
Cancel
Save