From be1ea41e79216a26f9fe37a6d34ea7fad2699b7e Mon Sep 17 00:00:00 2001
From: zhangli <1109134334@qq.com>
Date: Sat, 18 Feb 2023 10:41:18 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=9A=E6=97=B6=E8=AE=BF?=
=?UTF-8?q?=E9=97=AEapi=E7=9A=84=E6=9C=8D=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../VisitService/App.config | 10 ++
.../VisitService/Program.cs | 27 ++++
.../VisitService/ProjectInstaller.Designer.cs | 60 ++++++++
.../VisitService/ProjectInstaller.cs | 19 +++
.../VisitService/ProjectInstaller.resx | 129 ++++++++++++++++++
.../VisitService/Properties/AssemblyInfo.cs | 36 +++++
...uanjiang.DigitalScholl.VisitService.csproj | 74 ++++++++++
.../VisitService/Service1.Designer.cs | 37 +++++
.../VisitService/Service1.cs | 76 +++++++++++
.../西昌单校区版V3.0.sln | 40 +++++-
10 files changed, 507 insertions(+), 1 deletion(-)
create mode 100644 Learun.Framework.Ultimate V7/VisitService/App.config
create mode 100644 Learun.Framework.Ultimate V7/VisitService/Program.cs
create mode 100644 Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.Designer.cs
create mode 100644 Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.cs
create mode 100644 Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.resx
create mode 100644 Learun.Framework.Ultimate V7/VisitService/Properties/AssemblyInfo.cs
create mode 100644 Learun.Framework.Ultimate V7/VisitService/Quanjiang.DigitalScholl.VisitService.csproj
create mode 100644 Learun.Framework.Ultimate V7/VisitService/Service1.Designer.cs
create mode 100644 Learun.Framework.Ultimate V7/VisitService/Service1.cs
diff --git a/Learun.Framework.Ultimate V7/VisitService/App.config b/Learun.Framework.Ultimate V7/VisitService/App.config
new file mode 100644
index 000000000..54ca83f10
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/App.config
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Learun.Framework.Ultimate V7/VisitService/Program.cs b/Learun.Framework.Ultimate V7/VisitService/Program.cs
new file mode 100644
index 000000000..602b5cf38
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/Program.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.ServiceProcess;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace VisitService
+{
+ static class Program
+ {
+ ///
+ /// 应用程序的主入口点。
+ ///
+ static void Main()
+ {
+ ServiceBase[] ServicesToRun;
+ ServicesToRun = new ServiceBase[]
+ {
+ new QuanjiangDigitalSchollVisitService()
+ };
+ ServiceBase.Run(ServicesToRun);
+ }
+
+ }
+}
diff --git a/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.Designer.cs b/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.Designer.cs
new file mode 100644
index 000000000..25508f290
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.Designer.cs
@@ -0,0 +1,60 @@
+namespace VisitService
+{
+ partial class ProjectInstaller
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
+ this.QuanjiangDigitalSchollVisitService = new System.ServiceProcess.ServiceInstaller();
+ //
+ // serviceProcessInstaller1
+ //
+ this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
+ this.serviceProcessInstaller1.Password = null;
+ this.serviceProcessInstaller1.Username = null;
+ //
+ // QuanjiangDigitalSchollVisitService
+ //
+ this.QuanjiangDigitalSchollVisitService.Description = "定时访问api";
+ this.QuanjiangDigitalSchollVisitService.DisplayName = "QuanjiangDigitalSchollVisitService";
+ this.QuanjiangDigitalSchollVisitService.ServiceName = "QuanjiangDigitalSchollVisitService";
+ this.QuanjiangDigitalSchollVisitService.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
+ //
+ // ProjectInstaller
+ //
+ this.Installers.AddRange(new System.Configuration.Install.Installer[] {
+ this.serviceProcessInstaller1,
+ this.QuanjiangDigitalSchollVisitService});
+
+ }
+
+ #endregion
+
+ private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
+ private System.ServiceProcess.ServiceInstaller QuanjiangDigitalSchollVisitService;
+ }
+}
\ No newline at end of file
diff --git a/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.cs b/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.cs
new file mode 100644
index 000000000..5646f79a4
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration.Install;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VisitService
+{
+ [RunInstaller(true)]
+ public partial class ProjectInstaller : System.Configuration.Install.Installer
+ {
+ public ProjectInstaller()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.resx b/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.resx
new file mode 100644
index 000000000..0ca207778
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/ProjectInstaller.resx
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 55
+
+
+ 208, 17
+
+
+ False
+
+
\ No newline at end of file
diff --git a/Learun.Framework.Ultimate V7/VisitService/Properties/AssemblyInfo.cs b/Learun.Framework.Ultimate V7/VisitService/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..1f9b4efc5
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("VisitService")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HP Inc.")]
+[assembly: AssemblyProduct("VisitService")]
+[assembly: AssemblyCopyright("Copyright © HP Inc. 2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("1d482884-8749-41e7-b1e3-362612799615")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Learun.Framework.Ultimate V7/VisitService/Quanjiang.DigitalScholl.VisitService.csproj b/Learun.Framework.Ultimate V7/VisitService/Quanjiang.DigitalScholl.VisitService.csproj
new file mode 100644
index 000000000..0de2af6e7
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/Quanjiang.DigitalScholl.VisitService.csproj
@@ -0,0 +1,74 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {1D482884-8749-41E7-B1E3-362612799615}
+ WinExe
+ Quanjiang.DigitalScholl.VisitService
+ Quanjiang.DigitalScholl.VisitService
+ v4.5.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+ ProjectInstaller.cs
+
+
+ Component
+
+
+ Service1.cs
+
+
+
+
+
+
+
+
+
+ ProjectInstaller.cs
+
+
+
+
\ No newline at end of file
diff --git a/Learun.Framework.Ultimate V7/VisitService/Service1.Designer.cs b/Learun.Framework.Ultimate V7/VisitService/Service1.Designer.cs
new file mode 100644
index 000000000..31f81b5a1
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/Service1.Designer.cs
@@ -0,0 +1,37 @@
+namespace VisitService
+{
+ partial class QuanjiangDigitalSchollVisitService
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region 组件设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ this.ServiceName = "QuanjiangDigitalSchollVisitService";
+ }
+
+ #endregion
+ }
+}
diff --git a/Learun.Framework.Ultimate V7/VisitService/Service1.cs b/Learun.Framework.Ultimate V7/VisitService/Service1.cs
new file mode 100644
index 000000000..6e2dd3ce2
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/VisitService/Service1.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.ServiceProcess;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VisitService
+{
+ public partial class QuanjiangDigitalSchollVisitService : ServiceBase
+ {
+ public QuanjiangDigitalSchollVisitService()
+ {
+ InitializeComponent();
+ }
+
+ private System.Timers.Timer timer1 = new System.Timers.Timer(60000);
+ private static string pathbase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
+ //private static string logPath = pathbase + @"\" + DateTime.Now.ToString("yyyyMMdd") + @"\log_start.txt";
+ protected override void OnStart(string[] args)
+ {
+ timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Elapsed);
+ timer1.AutoReset = true;
+ timer1.Enabled = true;
+ timer1.Start();
+ }
+
+ protected override void OnStop()
+ {
+ this.timer1.Enabled = false;
+ }
+
+ private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ var logPath_timer = pathbase + @"\" + DateTime.Now.ToString("yyyyMMdd") + @"\log.txt";
+ try
+ {
+ //记录日志
+ if (!Directory.Exists(pathbase + @"\" + DateTime.Now.ToString("yyyyMMdd")))
+ {
+ //不存在文件夹则创建
+ DirectoryInfo directoryInfo = new DirectoryInfo(pathbase + @"\" + DateTime.Now.ToString("yyyyMMdd"));
+ directoryInfo.Create();
+ }
+ if (!File.Exists(logPath_timer))
+ {
+ FileStream fs = File.Create(logPath_timer);//创建文件
+ fs.Close();
+ }
+
+ System.GC.Collect();
+ var url = System.Configuration.ConfigurationManager.AppSettings["cyapi"].ToString();
+ HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
+ myRequest.KeepAlive = false;
+ myRequest.Method = "HEAD"; //设置提交方式可以为"get","head"等
+ myRequest.Timeout = 30000; //设置网页响应时间长度
+ myRequest.AllowAutoRedirect = false; //是否允许自动重定向
+ HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
+ // return (myResponse.StatusCode == HttpStatusCode.OK);//返回响应的状态
+
+ System.IO.File.AppendAllText(logPath_timer,
+ "\r\n" + DateTime.Now + "\r\n访问结果:" + myResponse.StatusCode);
+ }
+ catch (Exception ex)
+ {
+ System.IO.File.AppendAllText(logPath_timer,
+ "\r\n" + DateTime.Now + "\r\n访问结果异常,异常信息:" + ex.Message);
+ }
+ }
+ }
+}
diff --git a/Learun.Framework.Ultimate V7/西昌单校区版V3.0.sln b/Learun.Framework.Ultimate V7/西昌单校区版V3.0.sln
index 926013aee..7d51a2054 100644
--- a/Learun.Framework.Ultimate V7/西昌单校区版V3.0.sln
+++ b/Learun.Framework.Ultimate V7/西昌单校区版V3.0.sln
@@ -128,6 +128,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quanjiang.DigitalSchool.Asp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quanjiang.DigitalScholl.SendSms", "Quanjiang.DigitalScholl.SendSms\Quanjiang.DigitalScholl.SendSms.csproj", "{65CC5CDC-9638-4DD0-B2D6-3182CC16D2DA}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quanjiang.DigitalScholl.VisitService", "VisitService\Quanjiang.DigitalScholl.VisitService.csproj", "{1D482884-8749-41E7-B1E3-362612799615}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Android = Debug|Android
@@ -1662,6 +1664,42 @@ Global
{65CC5CDC-9638-4DD0-B2D6-3182CC16D2DA}.Release|Windows-x64.Build.0 = Release|Any CPU
{65CC5CDC-9638-4DD0-B2D6-3182CC16D2DA}.Release|Windows-x86.ActiveCfg = Release|Any CPU
{65CC5CDC-9638-4DD0-B2D6-3182CC16D2DA}.Release|Windows-x86.Build.0 = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Android.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Android.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|iOS.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|iOS.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Windows-ARM.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Windows-ARM.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Windows-x64.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Windows-x64.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Windows-x86.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Debug|Windows-x86.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Android.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Android.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Any CPU.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Any CPU.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|iOS.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|iOS.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Windows-ARM.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Windows-ARM.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Windows-x64.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Windows-x64.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Windows-x86.ActiveCfg = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Development|Windows-x86.Build.0 = Debug|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Android.ActiveCfg = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Android.Build.0 = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|iOS.ActiveCfg = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|iOS.Build.0 = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Windows-ARM.ActiveCfg = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Windows-ARM.Build.0 = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Windows-x64.ActiveCfg = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Windows-x64.Build.0 = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Windows-x86.ActiveCfg = Release|Any CPU
+ {1D482884-8749-41E7-B1E3-362612799615}.Release|Windows-x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1713,7 +1751,7 @@ Global
{E05A2B9A-A939-450F-9A44-A8B3201D055A} = {ED258CD0-0A0C-490B-9D8F-B4CEC4467251}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
SolutionGuid = {968C278F-4142-4DFF-96B0-B3D70A649451}
+ EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
EndGlobalSection
EndGlobal