Commit 433b8f5c authored by 黄奎's avatar 黄奎

页面修改

parent 75be3f9e
......@@ -23,7 +23,6 @@ namespace EduSpider.Repository
/// <returns></returns>
public bool BatchSetStuCommentDetails(List<RB_Stu_CommentDetails> list)
{
bool flag = false;
foreach (var item in list)
{
var defaultModel = GetStuCommentDetailsListRepository(new RB_Stu_CommentDetails_Extend()
......@@ -61,7 +60,7 @@ namespace EduSpider.Repository
}
// flag = base.Insert(item) > 0;
}
flag = base.BatchInsert(list);
bool flag = BatchInsert(list);
return flag;
}
......@@ -72,7 +71,7 @@ namespace EduSpider.Repository
/// <returns></returns>
public List<RB_Stu_CommentDetails_Extend> GetStuCommentDetailsListRepository(RB_Stu_CommentDetails_Extend query)
{
StringBuilder builder = new StringBuilder();
StringBuilder builder = new();
builder.AppendFormat(@"
SELECT A.*,s.StudentName as StuName
FROM RB_Stu_CommentDetails AS A LEFT JOIN rb_student s on A.StuUid = s.StudentUid
......@@ -117,7 +116,7 @@ WHERE 1=1
public bool SetStuCommentDetailsInfoRepository(string Ids,string Info)
{
string sql = string.Format("UPDATE RB_Stu_CommentDetails SET Info=@Info WHERE Id IN({0}) ", Ids);
DynamicParameters parameters = new DynamicParameters();
DynamicParameters parameters = new();
parameters.Add("Info", Info);
return base.Execute(sql,parameters) > 0;
}
......
......@@ -24,17 +24,17 @@ namespace EduSpider.Repository
/// <returns></returns>
public bool SetStuCommentRepository(RB_Stu_Comment_Extend model,bool IsAdd=false)
{
bool flag = false;
if (!IsAdd)
{
var oldModel = GetCourseCommentTimesListRepository(new CourseQuery() { CourseId = model.CourseId, CreateCommentType = model.CreateType, CommentTimes = model.Times }).FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
}
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
Dictionary<string, object> fileds = new()
{
{nameof(RB_Stu_Comment_Extend.CreateBy),model.CreateBy }
{ nameof(RB_Stu_Comment_Extend.CreateBy), model.CreateBy }
};
flag = base.UpdateOne(fileds, new WhereHelper(nameof(RB_Stu_Comment_Extend.Id), model.Id));
}
......@@ -94,7 +94,7 @@ WHERE 1=1
/// <returns></returns>
public bool BatchSetStuCommentRepository(RB_Stu_Comment_Extend model, StuCommentType commentType)
{
bool flag = false;
bool flag;
// 以前批量添加接口
if (commentType != null)
{
......@@ -172,7 +172,6 @@ WHERE 1=1
}
}
item.Info = info;
}
}
}
......
......@@ -485,7 +485,7 @@ WHERE 1=1
/// <param name="courseCommentModel">课程评价配置</param>
/// <param name="Score">平均分数</param>
/// <returns></returns>
private string GetCommentInfo(List<RB_Course_Comment_Extend> courseCommentList,string keyWords,int Times, decimal Score)
private static string GetCommentInfo(List<RB_Course_Comment_Extend> courseCommentList,string keyWords,int Times, decimal Score)
{
string info = "";
......
......@@ -152,7 +152,7 @@ namespace EduSpider.WebApi.Controllers
CommentTimes=base.ReqParameters.GetInt("Times"),
};
var courseRule = CourseService.GetCourseCommentList(query).FirstOrDefault();
object result=new object();
object result=new();
if (courseRule != null)
{
result = new
......@@ -207,7 +207,7 @@ namespace EduSpider.WebApi.Controllers
CourseName = base.ReqParameters.GetString("CourseName"),
};
var courseRuleList = CourseService.GetCourseCommentList(query).OrderBy(qitem=>qitem.Times).ToList();
List<object> result = new List<object>();
List<object> result = new();
if (courseRuleList != null && courseRuleList.Count > 0)
{
foreach (var item in courseRuleList)
......@@ -354,7 +354,7 @@ namespace EduSpider.WebApi.Controllers
ShowType = 3,
Details = new List<RB_Stu_CommentDetails>()
};
StuCommentType commentType = new StuCommentType()
StuCommentType commentType = new()
{
CommentId = base.ReqParameters.GetInt("CommentId"),
CommentType = base.ReqParameters.GetInt("CommentType"),
......@@ -367,7 +367,7 @@ namespace EduSpider.WebApi.Controllers
if (jArray != null && jArray.Count > 0)
{
var homeworkIds= base.ReqParameters.GetString("HomeWorkIds");
List<int> homeIds = new List<int>();
List<int> homeIds = new();
if (!string.IsNullOrWhiteSpace(homeworkIds))
{
homeIds = VTX.FW.Helper.JsonHelper.Deserialize<List<int>>(homeworkIds);
......
using EduSpider.IServices;
using EduSpider.Services;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
......@@ -18,8 +19,7 @@ namespace EduSpider.WebApi.Timers
/// <summary>
/// 课程仓储接口
/// </summary>
[Autowired]
public ICourseService CourseService { get; set; }
public ICourseService CourseService = new CourseService();
//定义一个定时器
private Timer _timer;
......@@ -32,7 +32,7 @@ namespace EduSpider.WebApi.Timers
{
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync","定时任务被启动");
int Interval = 0;
Interval = 10000;
Interval = 1;
//Interval = 1;
//绑定定时任务
//设置延迟时间
......@@ -55,15 +55,15 @@ namespace EduSpider.WebApi.Timers
/// <returns></returns>
private void DoWork(object state)
{
VTX.FW.Helper.LogHelper.WriteInfo("DoWork","定时任务被触发");
try
{
if (Interlocked.Exchange(ref create_Comment, 1) == 0)
{
VTX.FW.Helper.LogHelper.WriteInfo("DoWork", "DealMarketConsultantData========Start");
VTX.FW.Helper.LogHelper.WriteInfo("DoWork", "CreateHomeWorkComment========Start");
Thread.Sleep(1000 * 60 * 1);
var today = DateTime.Now;
CourseService.CreateHomeWorkComment(0);
VTX.FW.Helper.LogHelper.WriteInfo("DoWork", "DealMarketConsultantData========End");
VTX.FW.Helper.LogHelper.WriteInfo("DoWork", "CreateHomeWorkComment==========End");
Interlocked.Exchange(ref create_Comment, 0);
}
}
......
......@@ -23,8 +23,10 @@ namespace EduSpider
protected override void OnStart(string[] args)
{
VTX.FW.Helper.LogHelper.WriteInfo("OnStart", "开始服务");
timer1 = new System.Timers.Timer();
timer1.Interval = 1000 * 60 * 1; //60分钟
timer1 = new System.Timers.Timer
{
Interval = 1000 * 60 * 1 //60分钟
};
timer1.Elapsed += new System.Timers.ElapsedEventHandler(RunClassInData);
timer1.Enabled = true;
}
......
......@@ -46,7 +46,7 @@ namespace EduSpider.Spiders.SchoolHouseKeeper
string result;
result = Utility.SchoolHttpHelper.HttpPost(url, VTX.FW.Helper.JsonHelper.Serialize(pageModel), "application/json", cookie); ;
List<SchoolCourseItem> list = new List<SchoolCourseItem>();
List<SchoolCourseItem> list = new();
if (!string.IsNullOrEmpty(result))
{
JObject jobj = JObject.Parse(result);
......@@ -56,7 +56,7 @@ namespace EduSpider.Spiders.SchoolHouseKeeper
Console.WriteLine(string.Format("已完成 第 {0} 页/共 {1} 页,已完成 {2} 条/总共 {3} 条", pageModel.PageIndex, pageCount, pageModel.PageSize * pageModel.PageIndex, totalCount));
if (pageCount > pageModel.PageIndex)
{
Random random = new Random();
Random random = new();
for (var i = 2; i <= pageCount; i++)
{
var num = random.Next(1, 10);
......@@ -83,7 +83,7 @@ namespace EduSpider.Spiders.SchoolHouseKeeper
/// <returns></returns>
public static List<SchoolCourseItem> ParseJson(string data)
{
List<SchoolCourseItem> list = new List<SchoolCourseItem>();
List<SchoolCourseItem> list = new();
if (!string.IsNullOrEmpty(data))
{
JArray courseArray = JArray.Parse(data);
......
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