old_flsystem/应用/CouponsSend/Config.cs

289 lines
10 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Api.Framework;
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;
using UI.Framework.Entitys;
using static Api.Framework.ApiClient;
using static CouponsSend.Entitys.Enum;
namespace CouponsSend
{
[Config(Name = "插件-群发优惠券-配置")]
public class Config
{
/// <summary>
/// 采集开关
/// </summary>
[
Category("1、自动采集"), DisplayName("01.采集开关"), DefaultValue(SwitchType.开启)
]
public SwitchType Switch { get; set; } = SwitchType.;
/// <summary>
/// 采集数据触发数量
/// </summary>
[
Category("1、自动采集"), DisplayName("02.采集触发量"), DefaultValue(10),
Description(@"当采集开关为开启时,该值为一个采集点,当采集剩余的商品数量少于等于采集触发量,将自动进行采集操作")
]
public int GatherTouchNum { get; set; } = 10;
/// <summary>
/// 采集类型
/// </summary>
public GatherType GatherType { get; set; } = GatherType.;
/// <summary>
/// 采集条件
/// </summary>
public int ConditionType { get; set; }
[
Category("2、群发设置"), DisplayName("01.不限发送时间"), DefaultValue(SwitchType.关闭),
Description(@"开启发送时间将不受控制,一直发送")
]
public SwitchType NotCheckTime { get; set; }
private string[] _sendTaskTimes;
/// <summary>
/// 发送任务时间段
/// </summary>
public string[] SendTaskTimes
{
get { return _sendTaskTimes; }
set
{
var sendTaskTimes = value as string[];
if (sendTaskTimes != null && sendTaskTimes.Length != 0)
{
for (int i = 0; i < sendTaskTimes.Length; i++)
{
var times = sendTaskTimes[i].Trim().Split('-');
if (times.Length == 2)
{
var begin = DateTime.Parse(times[0]);
var end = DateTime.Parse(times[1]);
if (begin >= end)
throw new Exception($"开始时间必须小于结束时间:[{sendTaskTimes[i]}]");
}
}
}
_sendTaskTimes = value;
}
}
// /// <summary>
// /// 优惠券最低价
// /// </summary>
// // [
// // Category("1、群发设置"), DisplayName("03.优惠券最低价"), DefaultValue(0),
// // Description(@"优惠券最低价")
// //]
// // public double Coupon { get; set; }
// /// <summary>
// /// 券后最低价
// /// </summary>
// [
// Category("2、群发设置"), DisplayName("04.券后最低价"), DefaultValue(3),
// Description(@"券后最低价")
//]
// public double Price_Lowest { get; set; }
// /// <summary>
// /// 券后最高价
// /// </summary>
// [
// Category("2、群发设置"), DisplayName("05.券后最高价"), DefaultValue(99999),
// Description(@"券后最高价")
//]
// public double Price_Tallest { get; set; }
// /// <summary>
// /// 商品销量最低
// /// </summary>
// [
// Category("2、群发设置"), DisplayName("06.商品销量最低"), DefaultValue(500),
// Description(@"商品销量最低")
// ]
// public int Sales { get; set; }
/// <summary>
/// 群发送间隔
/// </summary>
[
Category("2、群发设置"), DisplayName("09.群发送间隔"), DefaultValue(10),
Description(@"每个群发送的间隔,单位/秒")
]
public int IntervalTime_Group { get; set; }
/// <summary>
/// 券发送间隔
/// </summary>
[
Category("2、群发设置"), DisplayName("10.券发送间隔"), DefaultValue(300),
Description(@"券发送间隔,单位/秒")
]
public int IntervalTime_Coupon { get; set; }
/// <summary>
/// 优惠券模板
/// </summary>
[
Category("2、群发设置"), DisplayName("11.优惠券模板"), DefaultValue(QrImageType.模板C),
Description(@"生成二维码图片的模板")]
public QrImageType qrImageType { get; set; }
/// <summary>
/// 黑名单关键词
/// </summary>
[
Category("2、群发设置"), DisplayName("12.黑名单关键词"), DefaultValue(""),
Description(@"黑名单关键词,包含设置的关键词将不发送,多个关键词用逗号"",""隔开")
]
public string BlackContent { get; set; }
/// <summary>
/// 白名单关键词
/// </summary>
[
Category("2、群发设置"), DisplayName("13.白名单关键词"), DefaultValue(""),
Description(@"白名单关键词,包含设置的关键词才发送,多个关键词用逗号"",""隔开")
]
public string WhiteContent { get; set; }
/// <summary>
/// QQ图文格式
/// </summary>
[
Category("2、群发设置"), DisplayName("14.QQ图文格式"), DefaultValue(@"[商品图片]
--------------------
[商品标题]
[]
[]
[]
[][]
--------------------
[]
[]
[]"),
Description(@"支持变量:[机器人账号]、[机器人昵称]、[商品标题]、[商品原价]、[优惠券金额]、[券后价]、[商品主图]、[积分名称]、[月销量]、[返利积分]、[购买地址]、[购买中间页地址]、[购买淘口令]、[共节省]、[商品图片]、[文案]"),
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
]
public string QQMsg { get; set; }
/// <summary>
/// 微信图文格式
/// </summary>
[
Category("2、群发设置"), DisplayName("15.微信图文格式"), DefaultValue(@"[商品图片]
--------------------
[商品标题]
[]
[]
[]
[][]
--------------------
[]
[]
[]"),
Description(@"支持变量:[机器人账号]、[机器人昵称]、[商品标题]、[商品原价]、[商品主图]、[积分名称]、[月销量]、[返利积分]、[购买地址]、[购买中间页地址]、[购买淘口令]、[共节省]、[商品图片]、[文案] XML[图片地址]"),
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
]
public string WXMsg { get; set; }
///// <summary>
///// 采集的群
///// </summary>
//[Browsable(false)]
//public List<string> CloudGroups { get; set; }
/// <summary>
/// 短网址
/// </summary>
[
Category("2、群发设置"), DisplayName("16.短网址"), DefaultValue(DwzType.快站短网址),
Description("缩短购买中间页地址")
]
public DwzType SearchDwzType { get; set; }
/// <summary>
/// 自动清理
/// </summary>
[
Category("3、定时清理"), DisplayName("01.定时清理"), DefaultValue(SwitchType.开启),
Description(@"功能开启时,将在设置的时间进行采集数据的清空操作")
]
public SwitchType Auto_IsClear { get; set; } = SwitchType.;
private string _AutoClearTaskTimes;
[
Category("3、定时清理"), DisplayName("02.定时清理时间"), DefaultValue("23:59"),
Description(@"定时清理时间
格式HH:mm
23:59
时间为24小时制")
]
public string AutoClearTaskTimes
{
get { return _AutoClearTaskTimes; }
set
{
try
{
var time = value as string;
var _time = DateTime.Parse(time);
}
catch (Exception)
{
throw new Exception($"时间格式不正确");
}
_AutoClearTaskTimes = value;
}
}
public Config()
{
this.qrImageType = QrImageType.C;
this.NotCheckTime = SwitchType.;
this._sendTaskTimes = new string[] { "09:00-22:00" };
this.IntervalTime_Group = 10;
this.IntervalTime_Coupon = 300;
this.BlackContent = string.Empty;
this.WhiteContent = string.Empty;
//this.CloudGroups = new List<string>();
this.SearchDwzType = DwzType.;
this._AutoClearTaskTimes = "23:59";
this.QQMsg = @"[商品图片]
限时抢购!!!!
--------------------
[商品标题]
宝贝原价:[商品原价] 元
内部优惠:[优惠券金额] 元
券后价格:[券后价] 元
返利积分:[返利积分][积分名称]
--------------------
下单地址:[购买中间页地址]
购买口令:[购买淘口令]
推荐理由:[文案]";
this.WXMsg = @"[商品图片]
限时抢购!!!!
--------------------
[商品标题]
宝贝原价:[商品原价] 元
内部优惠:[优惠券金额] 元
券后价格:[券后价] 元
返利积分:[返利积分][积分名称]
--------------------
下单地址:[购买中间页地址]
购买口令:[购买淘口令]
推荐理由:[文案]";
}
}
}