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

页面修改

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