using Api.Framework.Enums; using Api.Framework.SDK; using PDDCircleFriends.Controls; 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 PDDCircleFriends.Enums; namespace PDDCircleFriends { [Config(Name = "插件-拼多多发单-配置")] public class Config { #region 发单功能 #region 采集 /// /// 发单条件 - 商品最低售价 /// [ Category("1)、自动采集"), DisplayName("01.采集开关"), DefaultValue(SwitchType.开启) ] public SwitchType Switch { get; set; } /// /// 采集数据触发数量 /// [ Category("1)、自动采集"), DisplayName("02.采集触发量"), DefaultValue(10), Description(@"当采集开关为开启时,该值为一个采集点,当采集剩余的商品数量少于等于采集触发量,将自动进行采集操作") ] public int GatherTouchNum { get; set; } /// /// 发单条件 - 商品最低售价 /// [ Category("1)、自动采集"), DisplayName("03.商品最低售价"), DefaultValue(null), Description(@"采集的产品最低价格,不填写表示不限制最低价!") ] public double? FloorPrice { get; set; } /// /// 发单条件 - 商品最高售价 /// [ Category("1)、自动采集"), DisplayName("04.商品最高售价"), DefaultValue(null), Description(@"采集的产品最高价格,不填写表示不限制最高价!") ] public double? CeilingPrice { get; set; } /// /// 发单条件 - 佣金比例 /// [ Category("1)、自动采集"), DisplayName("05.佣金比例"), DefaultValue(null), Description(@"采集的产品佣金比例条件,选中的比例包含选中的值.不填写表示不限制佣金比例!") ] public double? PromotionRate { get; set; } /// /// 发单条件 - 类目 /// [ Category("1)、自动采集"), DisplayName("06.类目"), DefaultValue(@"精选"), Description(@"筛选类目:精选、百货、母婴、服饰、美食、美妆、内衣、鞋包、男装、手机、文具、电器、家纺、运动、家装、汽车、水果"), Editor(typeof(CategoryControl), typeof(System.Drawing.Design.UITypeEditor)) ] public string Category { get; set; } /// /// 发单条件 - 店铺评分 /// [ Category("1)、自动采集"), DisplayName("07.店铺评分"), DefaultValue(ShopScoreType.不限), Description(@"采集的产品对店铺的条件,选中的评分包含高于选中评分") ] public ShopScoreType ShopScore { get; set; } #endregion #region 开始时间 /// /// 朋友圈发单二维码模板 /// [ Category("2)、朋友圈设置"), DisplayName("01.发单二维码模板"), DefaultValue(QrImageType.模板B), Description(@"朋友圈发单二维码模板") ] public QrImageType Model { get; set; } private string[] _sendTaskTimes; /// /// 发送任务时间段 /// [ 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; /// /// 发送商品图片数量 /// [ 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; } } /// /// 朋友圈发送间隔,单位 分 /// [ Category("2)、朋友圈设置"), DisplayName("04.朋友圈发送间隔"), DefaultValue(120), Description(@"朋友圈推广商品间隔,单位 分") ] public double Interval_Circle { get; set; } /// /// 发送的文字内容 /// [ Category("2)、朋友圈设置"), DisplayName("05.发送的文字内容"), DefaultValue(@"╭┈┈┈┄┈┈┈┈┈╮ 爆款榜单 ╰┈┈┈┈┈┈┈┈┈╯ 补贴奖励和帮助渠道 手机拼多多分享宝贝给我 可以查询优惠券款下单 还有网购红包领哦"), Description(@"发送朋友圈时的文本内容"), Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor)) ] public string Content_Circle { get; set; } /// /// 宝贝描述语 /// [ Category("2)、朋友圈设置"), DisplayName("06.宝贝描述语"), DefaultValue(@""), Description(@"图片中宝贝描述信息,为空时以采集到的数据为准. 支持变量:[商品标题]、[商品描述]、[已售数量]、[店铺名称]、[优惠券门槛金额]、[优惠券金额]、[优惠券数量]、[商品单买价]、[券后单买价]、[单买地址]、[商品拼团价]、[券后拼团价]、[拼团地址]"), Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor)) ] public string Goods_Desc { get; set; } /// /// 朋友圈追加评语 /// [ Category("2)、朋友圈设置"), DisplayName("07.朋友圈追加评语"), DefaultValue(@""), Description(@"朋友圈商品推广之后,追加评语"), Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor)) ] public string AdditionalComment { get; set; } /// /// 记录发送的时间 /// [Browsable(false)] public DateTime RecordSendTime { get; set; } #endregion /// /// 自动清理 /// [ 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.FloorPrice = null; this.CeilingPrice = null; this.PromotionRate = null; this.Category = @"精选"; this.ShopScore = ShopScoreType.不限; 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; } } }