using Api.Framework.Enums;
using Api.Framework.SDK;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Weixin.AccurateCircle
{
[Config(Name = "插件-精准朋友圈-配置")]
public class Config
{
#region 发单功能
#region 采集
///
/// 采集开关
///
[
Category("1)、自动采集"), DisplayName("01.采集开关"), DefaultValue(SwitchType.开启)
]
public SwitchType Switch { get; set; }
private int _downInterval;
///
/// 采集间隔
///
[
Category("1)、自动采集"), DisplayName("02.采集间隔"), DefaultValue(5),
Description(@"定时采集间隔时间(单位/分)")
]
public int DownInterval
{
get { return _downInterval; }
set
{
try
{
if (value < 5) throw new Exception("");
else _downInterval = value;
}
catch (Exception)
{
_downInterval = 5;
throw new Exception($"采集间隔不能小于5分钟");
}
_downInterval = value;
}
}
///
/// 采集开关
///
[
Category("1)、自动采集"), DisplayName("03.采集地址"), DefaultValue("")
]
public string DownUrl { get; set; }
#endregion
///
/// 记录采集的任务ID
///
[Browsable(false)]
public long DownID { get; set; }
///
/// 记录上一次的时间
///
[Browsable(false)]
public DateTime DownTime { get; set; }
///
/// 自动清理
///
[
Category("2)、定时清理"), DisplayName("01.定时清理"), DefaultValue(SwitchType.开启),
Description(@"功能开启时,将在设置的时间进行采集数据的清空操作")
]
public SwitchType Auto_IsClear { get; set; }
private string _autoClearTaskTimes;
///
/// 定时清理
///
[
Category("2)、定时清理"), DisplayName("02.定时清理时间"),
Description(@"定时清理时间
格式:HH:mm
例:23:59
注:时间为24小时制")
]
public string AutoClearTaskTimes //{ get; set; }
{
get { return _autoClearTaskTimes; }
set
{
try
{
var time = value as string;
var _time = DateTime.Parse(time);
}
catch (Exception)
{
throw new Exception($"时间格式不正确");
}
_autoClearTaskTimes = value;
}
}
#endregion
public Config()
{
this.Auto_IsClear = SwitchType.开启;
this.Switch = SwitchType.开启;
this._downInterval = 5;
this._autoClearTaskTimes = "23:59";
this.DownTime = DateTime.MinValue;
this.DownID = 0;
this.DownUrl = string.Empty;
}
}
}