Commit 5b43e96f authored by 黄奎's avatar 黄奎

页面修改

parent 62a17476
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.5",
"commands": [
"dotnet-ef"
]
}
}
}
\ No newline at end of file
......@@ -25,6 +25,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EduSpider", "EduSpider\EduS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EduSpider.Cache", "EduSpider.Cache\EduSpider.Cache.csproj", "{6D059BFB-A071-4856-A35D-38EB893FED74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EduSpiderWorkerService", "EduSpiderWorkerService\EduSpiderWorkerService.csproj", "{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -67,6 +69,10 @@ Global
{6D059BFB-A071-4856-A35D-38EB893FED74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D059BFB-A071-4856-A35D-38EB893FED74}.Release|Any CPU.Build.0 = Release|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73CA1E67-5CD7-4177-ABFC-51FF2785BF35}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -5,6 +5,11 @@
<TargetFramework>net5.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<StartupObject>EduSpider.Program</StartupObject>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
......@@ -49,6 +54,7 @@
<PackageReference Include="SqlSugarCore" Version="5.0.8.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0" />
<PackageReference Include="VTX.FW" Version="1.1.0" />
</ItemGroup>
......

namespace EduSpider
{
partial class MindService
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "MindService";
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TicketSpider.Spiders.ClassInRule;
namespace EduSpider
{
partial class MindService : ServiceBase
{
System.Timers.Timer timer1; //计时器
public MindService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
VTX.FW.Helper.LogHelper.WriteInfo("OnStart", "开始服务");
timer1 = new System.Timers.Timer();
timer1.Interval = 1000 * 60 * 1; //60分钟
timer1.Elapsed += new System.Timers.ElapsedEventHandler(RunClassInData);
timer1.Enabled = true;
}
private static int inTimer = 0;
/// <summary>
/// 收入单子服务开始执行方法
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RunClassInData(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref inTimer, 1) == 0)
{
VTX.FW.Helper.LogHelper.WriteInfo("RunClassInData", "开始ClassIn数据");
//ClassInFlow.StartAsync();
Interlocked.Exchange(ref inTimer, 0);
VTX.FW.Helper.LogHelper.WriteInfo("RunClassInData", "结束ClassIn数据");
}
}
protected override void OnStop()
{
this.timer1.Enabled = false;
}
}
}
using EduSpider.Spiders.SchoolHouseKeeper;
using System;
using System.ServiceProcess;
using TicketSpider.Spiders.ClassInRule;
namespace EduSpider
......@@ -12,12 +13,15 @@ namespace EduSpider
//ClassIn数据
//ClassInFlow.StartAsync();
//校管家数据
SchoolTaskHelper.RunTask();
Console.ReadLine();
////校管家数据
//SchoolTaskHelper.RunTask();
Environment.Exit(0);
//Console.ReadLine();
//Environment.Exit(0);
ServiceBase[] services = new ServiceBase[] { new MindService() };
ServiceBase.Run(services);
}
}
}
\ No newline at end of file
......@@ -46,6 +46,7 @@ namespace TicketSpider.Spiders.ClassInRule
else
{
Console.WriteLine("开始重新尝试登录");
VTX.FW.Helper.LogHelper.WriteInfo("GetInstance", "开始重新尝试登录");
Thread.Sleep(2000);
}
}
......@@ -97,16 +98,19 @@ namespace TicketSpider.Spiders.ClassInRule
{
loginCount++;
Console.WriteLine($"正在进行第{loginCount}次模拟登录...");
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"正在进行第{loginCount}次模拟登录...");
var login = BeginSliderLoginHandler(ref driver);
if (login.IsCompleted)
{
driver.SwitchTo().DefaultContent();
Console.WriteLine($"操作完成,正在等待结果");
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"操作完成,正在等待结果");
//睡眠1秒,等待跳转
Thread.Sleep(5 * 1000);
if (driver.Url.Contains("www.eeo.cn/cn/login"))
{
Console.WriteLine($"模拟登录失败,准备重新执行...");
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"模拟登录失败,准备重新执行...");
IWebElement silderBoxEle = null;
try
{
......@@ -120,6 +124,7 @@ namespace TicketSpider.Spiders.ClassInRule
if (loginCount == 4)
{
Console.WriteLine("连续4次失败,请检查账号密码是否正确,系统执行完毕");
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"连续4次失败,请检查账号密码是否正确,系统执行完毕");
break;
}
}
......@@ -139,6 +144,7 @@ namespace TicketSpider.Spiders.ClassInRule
else
{
Console.WriteLine("未知异常,程序退出");
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"未知异常,程序退出");
break;
}
}
......@@ -146,10 +152,12 @@ namespace TicketSpider.Spiders.ClassInRule
}
catch (Exception ex)
{
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"获取cooki失败,{ex.Message}");
Console.WriteLine($"获取cooki失败,{ex.Message}");
}
driver.Quit();
Console.WriteLine("完成登录...");
VTX.FW.Helper.LogHelper.WriteInfo("RunAsync", $"完成登录...");
return flag;
}
......@@ -178,6 +186,7 @@ namespace TicketSpider.Spiders.ClassInRule
var bgX = GetBoundary(fileBgPath,fileBlockPath);
Console.WriteLine($"读取背景缺口边界X坐标: {bgX}");
VTX.FW.Helper.LogHelper.WriteInfo("BeginSliderLoginHandler", $"读取背景缺口边界X坐标: {bgX}");
Actions action = new(driver);
var sliderButton = driver.FindElement(By.Id("tcaptcha_drag_button"));
......
......@@ -11,28 +11,38 @@ namespace TicketSpider.Spiders.ClassInRule
public static void StartAsync()
{
Console.WriteLine("开始模拟登录信息.......");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "开始模拟登录信息.......");
string loginCookies;
//自定获取Cookie
loginCookies= ClassInAccountManager.GetInstance();
//loginCookies = "_eeos_uid=12780052; _eeos_useraccount=18140082327; _eeos_userlogo=%2Fupload%2Fimages%2F20200126%2F709df9532bee722f2268_70.jpg; _eeos_domain=.eeo.cn; _eeos_remember=1; _eeos_sid=12780052; _eeos_nsid=kspGu2gfMu%2BU2EFgLpSGyg%3D%3D; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2212780052%22%2C%22first_id%22%3A%22180f59907abbed-081e4952c5b26f-12333272-2073600-180f59907acbc8%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%22180f59907abbed-081e4952c5b26f-12333272-2073600-180f59907acbc8%22%7D; _eeos_traffic=EqlIOFq4S2hz5FTTtHzNUViBYcWCixrJYMCF6Y5yJuD8eq8ZwPvVSHMvUkLFA5lzNoaTrDBpGhFOuRmo3R6CQ5GeSsJx1IEakyt2K%2B3ifco%3D; PHPSESSID=3etqs18ka2s425omq6uqsus8s2; __tk_id=7a20b97a04709afc3137ec211e756d5f";
Console.WriteLine("cookies:" + loginCookies);
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "cookies:"+ loginCookies);
Console.WriteLine("开始获取老师信息");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "开始获取老师信息");
TeacherManager.RunTeacher(loginCookies);
Console.WriteLine("老师信息更新结束");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "老师信息更新结束");
Console.WriteLine("开始获取学生信息");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "开始获取学生信息");
StudentManager.RunAsync(loginCookies);
Console.WriteLine("学生信息更新结束");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "学生信息更新结束");
Console.WriteLine("开始获取课程信息");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "开始获取课程信息");
CourseManager.RunCourse(loginCookies);
Console.WriteLine("课程信息更新结束");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "课程信息更新结束");
Console.WriteLine("开始获取作业信息");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "开始获取作业信息");
HomeWorkManager.RunHomeWork(loginCookies);
Console.WriteLine("作业信息更新结束");
VTX.FW.Helper.LogHelper.WriteInfo("StartAsync", "作业信息更新结束");
}
}
}
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