Commit 89710e80 authored by wuliangshun's avatar wuliangshun

添加多任务

parent 84fa22f7
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Enums
{
public enum TaskTypeEnum
{
[Description("签到")]
SignIn = 0,
[Description("查询观影豆")]
MovieBean = 1,
[Description("查询优惠券")]
Coupon = 2
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Extension
{
public static class EnumExtension
{
/// <summary>
/// 扩展方法,获得枚举的Description
/// </summary>
/// <param name="value">枚举值</param>
/// <param name="nameInstead">当枚举值没有定义DescriptionAttribute,是否使用枚举名代替,默认是使用</param>
/// <returns>枚举的Description</returns>
public static string GetDescription(this Enum value, Boolean nameInstead = true)
{
Type type = value.GetType();
string name = Enum.GetName(type, value);
if (name == null)
{
return null;
}
FieldInfo field = type.GetField(name);
DescriptionAttribute attribute = System.Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
if (attribute == null && nameInstead == true)
{
return name;
}
return attribute?.Description;
}
}
}
...@@ -53,15 +53,15 @@ ...@@ -53,15 +53,15 @@
this.txtLog = new System.Windows.Forms.RichTextBox(); this.txtLog = new System.Windows.Forms.RichTextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.rb_signIn = new System.Windows.Forms.RadioButton();
this.rb_movieBean = new System.Windows.Forms.RadioButton();
this.rb_coupon = new System.Windows.Forms.RadioButton();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.btn_start = new System.Windows.Forms.Button(); this.btn_start = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.btn_set_interval = new System.Windows.Forms.Button();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tssl_timer_status = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel7 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.tssl_select_num = new System.Windows.Forms.ToolStripStatusLabel(); this.tssl_select_num = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
this.tssl_error_num = new System.Windows.Forms.ToolStripStatusLabel(); this.tssl_error_num = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel();
this.tssl_wait_num = new System.Windows.Forms.ToolStripStatusLabel(); this.tssl_wait_num = new System.Windows.Forms.ToolStripStatusLabel();
this.btn_set_interval = new System.Windows.Forms.Button(); this.cb_signIn = new System.Windows.Forms.CheckBox();
this.tssl_timer_status = new System.Windows.Forms.ToolStripStatusLabel(); this.cb_movieBean = new System.Windows.Forms.CheckBox();
this.toolStripStatusLabel7 = new System.Windows.Forms.ToolStripStatusLabel(); this.cb_coupon = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv_user)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgv_user)).BeginInit();
...@@ -306,9 +306,9 @@ ...@@ -306,9 +306,9 @@
// //
this.tableLayoutPanel3.ColumnCount = 1; this.tableLayoutPanel3.ColumnCount = 1;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Controls.Add(this.rb_signIn, 0, 0); this.tableLayoutPanel3.Controls.Add(this.cb_coupon, 0, 2);
this.tableLayoutPanel3.Controls.Add(this.rb_movieBean, 0, 1); this.tableLayoutPanel3.Controls.Add(this.cb_movieBean, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.rb_coupon, 0, 2); this.tableLayoutPanel3.Controls.Add(this.cb_signIn, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 17); this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 17);
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Name = "tableLayoutPanel3";
...@@ -320,45 +320,6 @@ ...@@ -320,45 +320,6 @@
this.tableLayoutPanel3.Size = new System.Drawing.Size(228, 194); this.tableLayoutPanel3.Size = new System.Drawing.Size(228, 194);
this.tableLayoutPanel3.TabIndex = 0; this.tableLayoutPanel3.TabIndex = 0;
// //
// rb_signIn
//
this.rb_signIn.AutoSize = true;
this.rb_signIn.Checked = true;
this.rb_signIn.Dock = System.Windows.Forms.DockStyle.Left;
this.rb_signIn.Location = new System.Drawing.Point(13, 3);
this.rb_signIn.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.rb_signIn.Name = "rb_signIn";
this.rb_signIn.Size = new System.Drawing.Size(47, 26);
this.rb_signIn.TabIndex = 0;
this.rb_signIn.TabStop = true;
this.rb_signIn.Text = "签到";
this.rb_signIn.UseVisualStyleBackColor = true;
//
// rb_movieBean
//
this.rb_movieBean.AutoSize = true;
this.rb_movieBean.Dock = System.Windows.Forms.DockStyle.Left;
this.rb_movieBean.Location = new System.Drawing.Point(13, 35);
this.rb_movieBean.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.rb_movieBean.Name = "rb_movieBean";
this.rb_movieBean.Size = new System.Drawing.Size(83, 26);
this.rb_movieBean.TabIndex = 1;
this.rb_movieBean.Text = "查询观影豆";
this.rb_movieBean.UseVisualStyleBackColor = true;
//
// rb_coupon
//
this.rb_coupon.AutoSize = true;
this.rb_coupon.Dock = System.Windows.Forms.DockStyle.Left;
this.rb_coupon.Location = new System.Drawing.Point(13, 67);
this.rb_coupon.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.rb_coupon.Name = "rb_coupon";
this.rb_coupon.Size = new System.Drawing.Size(83, 26);
this.rb_coupon.TabIndex = 2;
this.rb_coupon.TabStop = true;
this.rb_coupon.Text = "查询优惠券";
this.rb_coupon.UseVisualStyleBackColor = true;
//
// groupBox4 // groupBox4
// //
this.groupBox4.Controls.Add(this.tableLayoutPanel2); this.groupBox4.Controls.Add(this.tableLayoutPanel2);
...@@ -422,6 +383,17 @@ ...@@ -422,6 +383,17 @@
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.Button2_Click); this.button2.Click += new System.EventHandler(this.Button2_Click);
// //
// btn_set_interval
//
this.btn_set_interval.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_set_interval.Location = new System.Drawing.Point(117, 43);
this.btn_set_interval.Name = "btn_set_interval";
this.btn_set_interval.Size = new System.Drawing.Size(108, 34);
this.btn_set_interval.TabIndex = 3;
this.btn_set_interval.Text = "设置定时任务";
this.btn_set_interval.UseVisualStyleBackColor = true;
this.btn_set_interval.Click += new System.EventHandler(this.Btn_set_interval_Click);
//
// statusStrip1 // statusStrip1
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
...@@ -443,6 +415,20 @@ ...@@ -443,6 +415,20 @@
this.statusStrip1.TabIndex = 2; this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
// tssl_timer_status
//
this.tssl_timer_status.BackColor = System.Drawing.Color.LightCoral;
this.tssl_timer_status.ForeColor = System.Drawing.Color.Black;
this.tssl_timer_status.Name = "tssl_timer_status";
this.tssl_timer_status.Size = new System.Drawing.Size(80, 17);
this.tssl_timer_status.Text = "定时任务状态";
//
// toolStripStatusLabel7
//
this.toolStripStatusLabel7.Name = "toolStripStatusLabel7";
this.toolStripStatusLabel7.Size = new System.Drawing.Size(11, 17);
this.toolStripStatusLabel7.Text = "|";
//
// toolStripStatusLabel1 // toolStripStatusLabel1
// //
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
...@@ -503,30 +489,41 @@ ...@@ -503,30 +489,41 @@
this.tssl_wait_num.Size = new System.Drawing.Size(15, 17); this.tssl_wait_num.Size = new System.Drawing.Size(15, 17);
this.tssl_wait_num.Text = "0"; this.tssl_wait_num.Text = "0";
// //
// btn_set_interval // cb_signIn
// //
this.btn_set_interval.Dock = System.Windows.Forms.DockStyle.Fill; this.cb_signIn.AutoSize = true;
this.btn_set_interval.Location = new System.Drawing.Point(117, 43); this.cb_signIn.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_set_interval.Name = "btn_set_interval"; this.cb_signIn.Location = new System.Drawing.Point(13, 3);
this.btn_set_interval.Size = new System.Drawing.Size(108, 34); this.cb_signIn.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.btn_set_interval.TabIndex = 3; this.cb_signIn.Name = "cb_signIn";
this.btn_set_interval.Text = "设置定时任务"; this.cb_signIn.Size = new System.Drawing.Size(212, 26);
this.btn_set_interval.UseVisualStyleBackColor = true; this.cb_signIn.TabIndex = 3;
this.btn_set_interval.Click += new System.EventHandler(this.Btn_set_interval_Click); this.cb_signIn.Text = "签到";
// this.cb_signIn.UseVisualStyleBackColor = true;
// tssl_timer_status //
// // cb_movieBean
this.tssl_timer_status.BackColor = System.Drawing.Color.LightCoral; //
this.tssl_timer_status.ForeColor = System.Drawing.Color.Black; this.cb_movieBean.AutoSize = true;
this.tssl_timer_status.Name = "tssl_timer_status"; this.cb_movieBean.Dock = System.Windows.Forms.DockStyle.Fill;
this.tssl_timer_status.Size = new System.Drawing.Size(80, 17); this.cb_movieBean.Location = new System.Drawing.Point(13, 35);
this.tssl_timer_status.Text = "定时任务状态"; this.cb_movieBean.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
// this.cb_movieBean.Name = "cb_movieBean";
// toolStripStatusLabel7 this.cb_movieBean.Size = new System.Drawing.Size(212, 26);
// this.cb_movieBean.TabIndex = 5;
this.toolStripStatusLabel7.Name = "toolStripStatusLabel7"; this.cb_movieBean.Text = "查询观影豆";
this.toolStripStatusLabel7.Size = new System.Drawing.Size(11, 17); this.cb_movieBean.UseVisualStyleBackColor = true;
this.toolStripStatusLabel7.Text = "|"; //
// cb_coupon
//
this.cb_coupon.AutoSize = true;
this.cb_coupon.Dock = System.Windows.Forms.DockStyle.Fill;
this.cb_coupon.Location = new System.Drawing.Point(13, 67);
this.cb_coupon.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.cb_coupon.Name = "cb_coupon";
this.cb_coupon.Size = new System.Drawing.Size(212, 26);
this.cb_coupon.TabIndex = 6;
this.cb_coupon.Text = "查询观影券";
this.cb_coupon.UseVisualStyleBackColor = true;
// //
// Main // Main
// //
...@@ -591,9 +588,6 @@ ...@@ -591,9 +588,6 @@
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5;
private System.Windows.Forms.ToolStripStatusLabel tssl_wait_num; private System.Windows.Forms.ToolStripStatusLabel tssl_wait_num;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.RadioButton rb_signIn;
private System.Windows.Forms.RadioButton rb_movieBean;
private System.Windows.Forms.RadioButton rb_coupon;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.ToolStripMenuItem 清空账号ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 清空账号ToolStripMenuItem;
...@@ -603,6 +597,9 @@ ...@@ -603,6 +597,9 @@
private System.Windows.Forms.Button btn_set_interval; private System.Windows.Forms.Button btn_set_interval;
private System.Windows.Forms.ToolStripStatusLabel tssl_timer_status; private System.Windows.Forms.ToolStripStatusLabel tssl_timer_status;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel7; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel7;
private System.Windows.Forms.CheckBox cb_coupon;
private System.Windows.Forms.CheckBox cb_movieBean;
private System.Windows.Forms.CheckBox cb_signIn;
} }
} }
...@@ -16,6 +16,8 @@ using System.Threading; ...@@ -16,6 +16,8 @@ using System.Threading;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using DingDingSdk; using DingDingSdk;
using iqiyiWin.Enums;
using iqiyiWin.Extension;
namespace iqiyiWin namespace iqiyiWin
{ {
...@@ -85,6 +87,14 @@ namespace iqiyiWin ...@@ -85,6 +87,14 @@ namespace iqiyiWin
/// 默认定时任务的时间 /// 默认定时任务的时间
/// </summary> /// </summary>
public int IntervalTime = 12 * 60 * 60 ; public int IntervalTime = 12 * 60 * 60 ;
/// <summary>
/// 等待执行的任务列表
/// </summary>
public List<TaskTypeEnum> TaskList = new List<TaskTypeEnum>();
/// <summary>
/// 当前执行的任务下标
/// </summary>
public int TaskIndex = -1;
public Main() public Main()
...@@ -212,11 +222,35 @@ namespace iqiyiWin ...@@ -212,11 +222,35 @@ namespace iqiyiWin
var hour = Convert.ToInt32((EndTime - StartTime) / (1000 * 60 * 60)); var hour = Convert.ToInt32((EndTime - StartTime) / (1000 * 60 * 60));
var mominute = Convert.ToInt32(((EndTime - StartTime) % (1000 * 60 * 60)) / (1000 * 60)); var mominute = Convert.ToInt32(((EndTime - StartTime) % (1000 * 60 * 60)) / (1000 * 60));
var msecond = ((EndTime - StartTime) % (1000 * 60) / 1000); var msecond = ((EndTime - StartTime) % (1000 * 60) / 1000);
var logText = $"本次共计执行{SelectNum}个账号,成功{SuccessNum}个账号,失败{ErrorNum}个账号,所用时长{hour}小时{mominute}分钟{msecond}秒钟。";
UILogUtils.Info(logText); var logText = $"爱奇艺票务 本次{EnumExtension.GetDescription(TaskList[TaskIndex])}任务,共计执行{SelectNum}个账号,成功{SuccessNum}个账号,失败{ErrorNum}个账号,所用时长{hour}小时{mominute}分钟{msecond}秒钟。";
if (TimerTiming.Enabled)
{
SendDingdingMessagesAsync($"{logText}", "18057708086");
}
else
{
UILogUtils.Info($"{logText}");
}
if(TaskIndex < TaskList.Count - 1 && TaskIndex != -1)
{
Interlocked.Increment(ref TaskIndex);
runTask();
}
else
{
TaskIndex = -1;
if (TimerTiming.Enabled) if (TimerTiming.Enabled)
{ {
SendDingdingMessagesAsync($"爱奇艺票务 每日任务执行完毕,{logText}", "18057708086"); var taskNameList = new List<string>();
foreach(var item in TaskList)
{
taskNameList.Add(EnumExtension.GetDescription(item));
}
SendDingdingMessagesAsync($"爱奇艺票务 每日任务[{string.Join(" , ", taskNameList.ToArray())}]执行完毕。", "18057708086");
}
} }
} }
...@@ -351,6 +385,12 @@ namespace iqiyiWin ...@@ -351,6 +385,12 @@ namespace iqiyiWin
IsLoading = true; IsLoading = true;
TaskList = new List<TaskTypeEnum>{
TaskTypeEnum.SignIn
};
TaskIndex = 0;
AccountSignIn(iqiyiAccounts); AccountSignIn(iqiyiAccounts);
} }
...@@ -445,6 +485,12 @@ namespace iqiyiWin ...@@ -445,6 +485,12 @@ namespace iqiyiWin
IsLoading = true; IsLoading = true;
TaskList = new List<TaskTypeEnum>{
TaskTypeEnum.MovieBean
};
TaskIndex = 0;
queryMovieBean(iqiyiAccounts); queryMovieBean(iqiyiAccounts);
} }
catch (Exception ex) catch (Exception ex)
...@@ -539,6 +585,12 @@ namespace iqiyiWin ...@@ -539,6 +585,12 @@ namespace iqiyiWin
IsLoading = true; IsLoading = true;
TaskList = new List<TaskTypeEnum>{
TaskTypeEnum.Coupon
};
TaskIndex = 0;
queryCouponNum(iqiyiAccounts); queryCouponNum(iqiyiAccounts);
} }
catch (Exception ex) catch (Exception ex)
...@@ -631,22 +683,70 @@ namespace iqiyiWin ...@@ -631,22 +683,70 @@ namespace iqiyiWin
return; return;
} }
IsLoading = true; TaskList = new List<TaskTypeEnum>();
var taskNameList = new List<string>();
// 执行签到 // 执行签到
if (rb_signIn.Checked) if (cb_signIn.Checked)
{ {
AccountSignIn(IqiyiAccounts); TaskList.Add(TaskTypeEnum.SignIn);
taskNameList.Add($"{EnumExtension.GetDescription(TaskTypeEnum.SignIn)}");
} }
// 执行查询观影豆 // 执行查询观影豆
else if (rb_movieBean.Checked) if (cb_movieBean.Checked)
{ {
queryMovieBean(IqiyiAccounts); TaskList.Add(TaskTypeEnum.MovieBean);
taskNameList.Add($"{EnumExtension.GetDescription(TaskTypeEnum.MovieBean)}");
} }
// 执行查询优惠券 // 执行查询优惠券
else if (rb_coupon.Checked) if (cb_coupon.Checked)
{
TaskList.Add(TaskTypeEnum.Coupon);
taskNameList.Add($"{EnumExtension.GetDescription(TaskTypeEnum.Coupon)}");
}
if (TaskList.Count != 0)
{
UILogUtils.Info(TimerTiming.Enabled.ToString());
if (TimerTiming.Enabled)
{
SendDingdingMessagesAsync($"爱奇艺票务 即将开始执行{TaskList.Count}个任务 [{string.Join(" , ", taskNameList.ToArray())}]", "18057708086");
}
IsLoading = true;
TaskIndex = 0;
runTask();
}
else
{ {
IsLoading = false;
}
}
public void runTask(){
if(TaskIndex == -1)
{
return;
}
var currentTask = TaskList[TaskIndex];
if (TimerTiming.Enabled)
{
SendDingdingMessagesAsync($"爱奇艺票务 开始执行{EnumExtension.GetDescription(currentTask)}任务", "18057708086");
}
switch (currentTask)
{
case TaskTypeEnum.SignIn:
AccountSignIn(IqiyiAccounts);
break;
case TaskTypeEnum.MovieBean:
queryMovieBean(IqiyiAccounts);
break;
case TaskTypeEnum.Coupon:
queryCouponNum(IqiyiAccounts); queryCouponNum(IqiyiAccounts);
break;
default:
UILogUtils.Error($"未知任务类型");
break;
} }
} }
...@@ -724,6 +824,7 @@ namespace iqiyiWin ...@@ -724,6 +824,7 @@ namespace iqiyiWin
private void 清空账号ToolStripMenuItem_Click(object sender, EventArgs e) private void 清空账号ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
dgv_user.DataSource = null; dgv_user.DataSource = null;
IqiyiAccounts = new List<IqiyiAccount>();
} }
private void 删除ToolStripMenuItem_Click(object sender, EventArgs e) private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
...@@ -757,15 +858,15 @@ namespace iqiyiWin ...@@ -757,15 +858,15 @@ namespace iqiyiWin
try try
{ {
String fileDirectory = ""; String fileDirectory = "";
if (rb_signIn.Checked) if (cb_signIn.Checked)
{ {
fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志", "签到", DateTime.Now.ToString("yyyyMMdd")); fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志", "签到", DateTime.Now.ToString("yyyyMMdd"));
} }
else if (rb_movieBean.Checked) else if (cb_movieBean.Checked)
{ {
fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志", "查询观影豆", DateTime.Now.ToString("yyyyMMdd")); fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志", "查询观影豆", DateTime.Now.ToString("yyyyMMdd"));
} }
else if (rb_coupon.Checked) else if (cb_coupon.Checked)
{ {
fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志","查询优惠券", DateTime.Now.ToString("yyyyMMdd")); fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志","查询优惠券", DateTime.Now.ToString("yyyyMMdd"));
} }
...@@ -834,7 +935,6 @@ namespace iqiyiWin ...@@ -834,7 +935,6 @@ namespace iqiyiWin
UILogUtils.Info(logText); UILogUtils.Info(logText);
TimerSetOnTime.Interval = 1000 * (timeDifference); TimerSetOnTime.Interval = 1000 * (timeDifference);
TimerSetOnTime.Tick += new EventHandler((s, e) => TimerSetOnTime.Tick += new EventHandler((s, e) =>
...@@ -849,21 +949,23 @@ namespace iqiyiWin ...@@ -849,21 +949,23 @@ namespace iqiyiWin
} }
public void setTiming() public void setTiming()
{ {
SendDingdingMessagesAsync("爱奇艺票务 开始执行每日任务", "18057708086"); // TODO 缩短执行时间
Btn_start_Click(new object(), new EventArgs());
TimerTiming.Interval = 1000 * 60 * 60 * 24; TimerTiming.Interval = 1000 * 60 * 60 * 24;
// TimerTiming.Interval = 1000 * 10;
TimerTiming.Tick += new EventHandler((s, e) => TimerTiming.Tick += new EventHandler((s, e) =>
{ {
SendDingdingMessagesAsync("爱奇艺票务 开始执行每日任务","18057708086");
Btn_start_Click(new object(), new EventArgs()); Btn_start_Click(new object(), new EventArgs());
}); });
TimerTiming.Start(); TimerTiming.Start();
Btn_start_Click(new object(), new EventArgs());
} }
private static void SendDingdingMessagesAsync(string message, string mobile) private static void SendDingdingMessagesAsync(string message, string mobile)
{ {
UILogUtils.Info($"发送钉钉消息:{message}{mobile}");
if (message != null) if (message != null)
{ {
message = "[千猪]" + message; message = "[千猪]" + message;
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
<Compile Include="Constant\ApiConstant.cs" /> <Compile Include="Constant\ApiConstant.cs" />
<Compile Include="Constant\DingDingConstant.cs" /> <Compile Include="Constant\DingDingConstant.cs" />
<Compile Include="Constant\IqiyiVersion.cs" /> <Compile Include="Constant\IqiyiVersion.cs" />
<Compile Include="Enums\TaskEnums.cs" />
<Compile Include="Extension\EnumExtension.cs" />
<Compile Include="Main.cs"> <Compile Include="Main.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
......
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