Commit 47041ac9 authored by 黄奎's avatar 黄奎

页面修改

parent 9f4200ee
......@@ -34,7 +34,9 @@ namespace EduSpider.Repository
/// <returns></returns>
public bool BatchDeleteCourseStudentRepository(List<RB_Course_Student> courses)
{
string sql = string.Format("DELETE FROM RB_Course_Student WHERE courseId IN({0}) ", string.Join(",", courses.Select(qitem => qitem.courseId)));
string courseId = string.Join(",", courses.Select(qitem => qitem.courseId));
string uid= string.Join(",", courses.Select(qitem => qitem.uid));
string sql = string.Format(" DELETE FROM RB_Course_Student WHERE courseId IN({0}) AND uid IN({1}) ", courseId, uid);
return base.Execute(sql) > 0;
}
......
......@@ -41,9 +41,13 @@ namespace TicketSpider.Spiders.ClassInRule
_loginCookies = string.Empty;
var cnt = 0;
Random r = new Random();
while (cnt < 4)
{
cnt++;
int num = r.Next(1, 10);
Thread.Sleep(1000 * num);
var result = RunAsync();
if (result && !_openHeartTimer)
{
......@@ -122,14 +126,19 @@ namespace TicketSpider.Spiders.ClassInRule
{
inputEle.SendKeys("18140082327");
pwdEle.SendKeys("ls123456");
var buttonEle = driver.FindElement(By.CssSelector(".submit-btn"));
Thread.Sleep(1000);
//开始登录
buttonEle.Click();
//开始模拟登录
for (var loginCount = 0; loginCount <= 3; loginCount++)
Random r = new Random();
for (var loginCount = 1; loginCount <= 3; loginCount++)
{
if (loginCount > 1)
{
int num = r.Next(1, 10);
Thread.Sleep(1000 * num);
}
InfoHelper.WriteLine($"正在进行第{loginCount}次模拟登录...");
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"正在进行第{loginCount}次模拟登录...");
var login = FireFoxBeginSliderLoginHandler(driver);
......
......@@ -174,6 +174,7 @@ namespace EduSpider.Spiders.ClassInRule
var response = await request.PostAsync(url, content);
var sutResult = response.Content.ReadAsStringAsync().Result;
List<RB_Course_Student> list = new();
List<RB_Course_Student> deleteList = new List<RB_Course_Student>();
if (!string.IsNullOrWhiteSpace(sutResult))
{
JObject stuRootObj = JObject.Parse(sutResult);
......@@ -198,15 +199,31 @@ namespace EduSpider.Spiders.ClassInRule
courseId = courseId
});
}
else
{
deleteList.Add(new RB_Course_Student()
{
id = courseStuObj.GetInt("id"),
uid = courseStuObj.GetInt("uid"),
name = courseStuObj.GetString("name"),
account = courseStuObj.GetString("account"),
logo = courseStuObj.GetString("logo"),
courseId = courseId
});
}
}
}
}
}
if (list != null && list.Count > 0)
{
courseStudentRepository.BatchDeleteCourseStudentRepository(list);
courseStudentRepository.BatchSetCourseStudentRepository(list);
}
if (deleteList != null && deleteList.Count > 0)
{
courseStudentRepository.BatchDeleteCourseStudentRepository(deleteList);
}
}
/// <summary>
......
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