230 lines
7.8 KiB
C#
230 lines
7.8 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 static Api.Framework.ApiClient;
|
||
using static Weixin.WPHCirclePromotion.Enums;
|
||
|
||
namespace Weixin.WPHCirclePromotion
|
||
{
|
||
[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(ChannelType.出单爆款),
|
||
Description(@"采集的产品频道类型")
|
||
]
|
||
public ChannelType ChannelType { 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.ChannelType = ChannelType.出单爆款;
|
||
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;
|
||
}
|
||
|
||
}
|
||
} |