260 lines
9.0 KiB
C#
260 lines
9.0 KiB
C#
|
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 Weixin.SNCirclePromotion.Controls;
|
|||
|
using static Api.Framework.ApiClient;
|
|||
|
|
|||
|
namespace Weixin.SNCirclePromotion
|
|||
|
{
|
|||
|
[Config(Name = "插件-苏宁易购发单-配置")]
|
|||
|
public class Config
|
|||
|
{
|
|||
|
|
|||
|
#region 发单功能
|
|||
|
|
|||
|
#region 采集
|
|||
|
/// <summary>
|
|||
|
/// 发单条件 - 商品最低售价
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("1)、自动采集"), DisplayName("01.采集开关"), DefaultValue(SwitchType.开启)
|
|||
|
]
|
|||
|
public SwitchType Switch { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 采集数据触发数量
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("1)、自动采集"), DisplayName("02.采集触发量"), DefaultValue(10),
|
|||
|
Description(@"当采集开关为开启时,该值为一个采集点,当采集剩余的商品数量少于等于采集触发量,将自动进行采集操作")
|
|||
|
]
|
|||
|
public int GatherTouchNum { get; set; }
|
|||
|
|
|||
|
///// <summary>
|
|||
|
///// 发单条件 - 商品最低售价
|
|||
|
///// </summary>
|
|||
|
//[
|
|||
|
// Category("1)、自动采集"), DisplayName("03.商品最低售价"), DefaultValue(null),
|
|||
|
// Description(@"采集的产品最低价格,不填写表示不限制最低价!")
|
|||
|
//]
|
|||
|
//public double? FloorPrice { get; set; }
|
|||
|
|
|||
|
///// <summary>
|
|||
|
///// 发单条件 - 商品最高售价
|
|||
|
///// </summary>
|
|||
|
//[
|
|||
|
// Category("1)、自动采集"), DisplayName("04.商品最高售价"), DefaultValue(null),
|
|||
|
// Description(@"采集的产品最高价格,不填写表示不限制最高价!")
|
|||
|
//]
|
|||
|
//public double? CeilingPrice { get; set; }
|
|||
|
|
|||
|
///// <summary>
|
|||
|
///// 发单条件 - 佣金比例
|
|||
|
///// </summary>
|
|||
|
//[
|
|||
|
// Category("1)、自动采集"), DisplayName("05.佣金比例"), DefaultValue(null),
|
|||
|
// Description(@"采集的产品佣金比例条件,选中的比例包含选中的值.不填写表示不限制佣金比例!")
|
|||
|
//]
|
|||
|
//public double? PromotionRate { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 发单条件 - 类目
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("1)、自动采集"), DisplayName("03.类目"), DefaultValue(@"小编推荐"),
|
|||
|
Description(@"筛选平台:小编推荐、实时热销榜、当日热推榜、高佣爆款榜、团长招商榜、九块九专区"),
|
|||
|
Editor(typeof(CategoryControl), typeof(System.Drawing.Design.UITypeEditor))
|
|||
|
]
|
|||
|
public string Category { get; set; }
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 开始时间
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 朋友圈发单二维码模板
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("2)、朋友圈设置"), DisplayName("01.发单二维码模板"), DefaultValue(QrImageType.模板B),
|
|||
|
Description(@"朋友圈发单二维码模板")
|
|||
|
]
|
|||
|
public QrImageType Model { get; set; }
|
|||
|
|
|||
|
private string[] _sendTaskTimes;
|
|||
|
/// <summary>
|
|||
|
/// 发送任务时间段
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("2)、朋友圈设置"), DisplayName("02.发送任务时间段"),
|
|||
|
Description(@"每一行为一个发送时间段
|
|||
|
格式:时间1-时间2
|
|||
|
注:时间1 必须大于 时间2")
|
|||
|
]
|
|||
|
public string[] SendTaskTimes //{ get; set; }
|
|||
|
{
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private int _sendGoodsImageNum;
|
|||
|
/// <summary>
|
|||
|
/// 发送商品图片数量
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("2)、朋友圈设置"), DisplayName("03.发送推广图片数量"), DefaultValue(9),
|
|||
|
Description(@"发送朋友圈推广图片数量,最多9张图片")
|
|||
|
]
|
|||
|
public int SendGoodsImageNum
|
|||
|
{
|
|||
|
get { return _sendGoodsImageNum; }
|
|||
|
set
|
|||
|
{
|
|||
|
if (9 < value || value < 1) throw new Exception("发送推广图片数量应该大于等于1,小于等于9");
|
|||
|
_sendGoodsImageNum = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 朋友圈发送间隔,单位 分
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("2)、朋友圈设置"), DisplayName("04.朋友圈发送间隔"), DefaultValue(120),
|
|||
|
Description(@"朋友圈推广商品间隔,单位 分")
|
|||
|
]
|
|||
|
public double Interval_Circle { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 发送的文字内容
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("2)、朋友圈设置"), DisplayName("05.发送的文字内容"), DefaultValue(@"╭┈┈┈┄┈┈┈┈┈╮
|
|||
|
爆款榜单
|
|||
|
╰┈┈┈┈┈┈┈┈┈╯
|
|||
|
补贴奖励和帮助渠道
|
|||
|
|
|||
|
手机苏宁分享宝贝给我
|
|||
|
可以查询优惠券款下单
|
|||
|
|
|||
|
还有网购红包领哦"),
|
|||
|
Description(@"发送朋友圈时的文本内容"),
|
|||
|
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
|||
|
]
|
|||
|
public string Content_Circle { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 宝贝描述语
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("2)、朋友圈设置"), DisplayName("06.宝贝描述语"), DefaultValue(@""),
|
|||
|
Description(@"图片中宝贝描述信息,为空时以采集到的数据为准.
|
|||
|
支持变量:[商品标题]、[商品描述]、[已售数量]、[店铺名称]、[优惠券门槛金额]、[优惠券金额]、[券后价]、[购买地址]"),
|
|||
|
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
|||
|
]
|
|||
|
public string Goods_Desc { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 朋友圈追加评语
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("2)、朋友圈设置"), DisplayName("07.朋友圈追加评语"), DefaultValue(@""),
|
|||
|
Description(@"朋友圈商品推广之后,追加评语"),
|
|||
|
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
|||
|
]
|
|||
|
public string AdditionalComment { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 记录发送的时间
|
|||
|
/// </summary>
|
|||
|
[Browsable(false)]
|
|||
|
public DateTime RecordSendTime { get; set; }
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 自动清理
|
|||
|
/// </summary>
|
|||
|
[
|
|||
|
Category("3)、定时清理"), DisplayName("01.定时清理"), DefaultValue(SwitchType.开启),
|
|||
|
Description(@"功能开启时,将在设置的时间进行采集数据的清空操作")
|
|||
|
]
|
|||
|
public SwitchType Auto_IsClear { get; set; }
|
|||
|
|
|||
|
private string _autoClearTaskTimes;
|
|||
|
[
|
|||
|
Category("3)、定时清理"), DisplayName("02.定时清理时间"), DefaultValue(@"23:59"),
|
|||
|
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.GatherTouchNum = 10;
|
|||
|
this.Category = @"小编推荐";
|
|||
|
this.Content_Circle = @"╭┈┈┈┄┈┈┈┈┈╮
|
|||
|
爆款榜单
|
|||
|
╰┈┈┈┈┈┈┈┈┈╯
|
|||
|
补贴奖励和帮助渠道
|
|||
|
|
|||
|
手机苏宁分享宝贝给我
|
|||
|
可以查询优惠券款下单
|
|||
|
|
|||
|
还有网购红包领哦";
|
|||
|
this.SendGoodsImageNum = 9;
|
|||
|
this._sendGoodsImageNum = 9;
|
|||
|
this.Interval_Circle = 120;
|
|||
|
this.SendTaskTimes = new string[] { };
|
|||
|
this._sendTaskTimes = new string[] { "09:00-22:00" };
|
|||
|
this._autoClearTaskTimes = "23:59";
|
|||
|
this.Model = QrImageType.模板B;
|
|||
|
this.AdditionalComment = string.Empty;
|
|||
|
this.Goods_Desc = string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|