260 lines
9.7 KiB
C#
260 lines
9.7 KiB
C#
using Api.Framework.Enums;
|
||
using Api.Framework.SDK;
|
||
using AutoAnswer.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.Config.SystemConfig;
|
||
using static AutoAnswer.Enums;
|
||
|
||
namespace AutoAnswer
|
||
{
|
||
/// <summary>
|
||
/// 配置插件配置文件: Name = 文件名,IsSaveDB = 是否保存到数据库, IsEncryption = 是否对数据加密
|
||
/// </summary>
|
||
[Config(Name = "插件-问答插件-配置")]
|
||
public class Config
|
||
{
|
||
|
||
#region 基础属性
|
||
/// <summary>
|
||
/// 图灵开关
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public bool TuLing_OnOff { get; set; }
|
||
/// <summary>
|
||
/// 图灵apikey
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public string TuLing_apikey { get; set; }
|
||
/// <summary>
|
||
/// 图灵响应的前缀
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public string TuLing_prefix { get; set; }
|
||
/// <summary>
|
||
/// 是否开启自动回复
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public bool Is_Auto_Answer { get; set; }
|
||
/// <summary>
|
||
/// 是否置顶用户
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public bool Is_Top_User { get; set; }
|
||
/// <summary>
|
||
/// 都否开启自动清理
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public bool Is_AutoClear_Start { get; set; }
|
||
/// <summary>
|
||
/// 删除多少天之前的数据
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public int Logs_Keep_Days { get; set; }
|
||
/// <summary>
|
||
/// 是否记录包含默认回复的关键词
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public bool Is_Log { get; set; }
|
||
/// <summary>
|
||
/// 默认回复集合
|
||
/// </summary>
|
||
[Browsable(false)]
|
||
public List<string> DefaultContents { get; set; }
|
||
#endregion
|
||
|
||
#region 呼叫客服属性
|
||
|
||
/// <summary>
|
||
/// 呼叫客服开关
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("01.呼叫客服开关"), DefaultValue(SwitchType.开启)
|
||
]
|
||
public SwitchType CellCustomerServiceSwitch { get; set; }
|
||
|
||
/// <summary>
|
||
/// 触发关键词
|
||
/// </summary>
|
||
[Category("1)、呼叫客服"), DisplayName("02.触发关键词"), DefaultValue(@"^(客服|在吗|人呢)$"),
|
||
Description(@"支持正则表达式,通过指令可以触发下面的提示语!")]
|
||
public string TriggerAntistop { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否置顶
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("03.呼叫后自动置顶"), DefaultValue(SwitchType.开启),
|
||
Description(@"只支持微信,呼叫后自动置顶")
|
||
]
|
||
public SwitchType IsStickSwitch { get; set; }
|
||
|
||
/// <summary>
|
||
/// 工作日
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("04.工作日"), DefaultValue(@"星期一,星期二,星期三,星期四,星期五,星期六"),
|
||
Description(@""),
|
||
Editor(typeof(CategoryControl), typeof(System.Drawing.Design.UITypeEditor))
|
||
]
|
||
public string WeekDay { get; set; }
|
||
|
||
private string[] _workdayTimes;
|
||
/// <summary>
|
||
/// 发送任务时间段
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("05.上班时间"),
|
||
Description(@"每一行为一个上班时间区间段
|
||
格式:时间1-时间2
|
||
注:时间1 必须大于 时间2")
|
||
]
|
||
public string[] WorkDayTimes
|
||
{
|
||
get { return _workdayTimes; }
|
||
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]}]");
|
||
}
|
||
}
|
||
}
|
||
_workdayTimes = value;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 上班时间触发内容
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("06.上班时回复"), DefaultValue(@"正在为您呼叫客服,请稍等...."),
|
||
Description(@""),
|
||
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
||
]
|
||
public string OnDuty_ReplyMessage { get; set; }
|
||
|
||
/// <summary>
|
||
/// 下班时间触发内容
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("07.下班时回复"), DefaultValue(@"客服正在休息,您可以继续留言,客服上班后会联系您!"),
|
||
Description(@""),
|
||
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
||
]
|
||
public string OffDuty_ReplyMessage { get; set; }
|
||
|
||
/// <summary>
|
||
/// 休息日触发内容
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("08.节假日回复"), DefaultValue(@"亲,今天客服不上班!\r\n您有疑问可以给我们留言哦,上班后会给您处理!"),
|
||
Description(@"用户触发关键词,将自动发送本文内容"),
|
||
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
||
]
|
||
public string UnWeekDay_ReplyMessage { get; set; }
|
||
|
||
|
||
///// <summary>
|
||
///// 休息日触发内容
|
||
///// </summary>
|
||
//[
|
||
// Category("1)、呼叫客服"), DisplayName("09.钉钉群机器人"), DefaultValue(@""),
|
||
// Description(@"钉钉群机器人,不填写将会调用主程序链接!"),
|
||
// Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
||
//]
|
||
//public string DingdingRobot { get; set; }
|
||
|
||
///// <summary>
|
||
///// 休息日触发内容
|
||
///// </summary>
|
||
//[
|
||
// Category("1)、呼叫客服"), DisplayName("10.钉钉群Token"), DefaultValue(@""),
|
||
// Description(@"钉钉群机器人,不填写将会调用主程序链接!"),
|
||
// Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
||
//]
|
||
//public string DingdingRobotToken { get; set; }
|
||
|
||
|
||
/// <summary>
|
||
/// 钉钉群通知
|
||
/// </summary>
|
||
[Category("1)、呼叫客服"), DisplayName("09.钉钉/微信群机器人"), DefaultValue("请选择(钉钉/微信群机器人API名称)"), Description("请选择已存在的机器人名称,如果还没有添加,在【系统管理->群通知机器人】中添加机器人!"), TypeConverter(typeof(notice_robotname_item))]
|
||
public string notice_robotname { get; set; }
|
||
|
||
|
||
/// <summary>
|
||
/// 回复模式
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("10.钉钉传递消息模式"), DefaultValue(ReplyModel.传递最近5条消息),
|
||
Description(@"1、传递最近5条消息:钉钉将收到用户最近触发的5条消息
|
||
2、传递当前消息:钉钉将收到用户当前发送的消息")
|
||
]
|
||
public ReplyModel MatchModel { get; set; }
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
[
|
||
Category("1)、呼叫客服"), DisplayName("11.触发客服关键词后继续推送默认消息"), DefaultValue(SwitchType.关闭),
|
||
Description(@"触发客服关键词后继续推送默认消息")
|
||
]
|
||
public SwitchType ForcedResponse { get; set; }
|
||
|
||
#endregion
|
||
|
||
#region 未识别的消息转发
|
||
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 机器人调用默认的构造函数
|
||
/// </summary>
|
||
public Config()
|
||
{
|
||
#region 基础属性
|
||
TuLing_OnOff = false;
|
||
TuLing_prefix = "#|~";
|
||
TuLing_apikey = "";
|
||
DefaultContents = new List<string>();//初始化集合对象
|
||
Logs_Keep_Days = 15;//初始化天数
|
||
Is_AutoClear_Start = true;//默认打开自动清理
|
||
Is_Auto_Answer = false;//默认关闭自动回复
|
||
Is_Top_User = false;//默认关闭自定置顶
|
||
Is_Log = false;
|
||
#endregion
|
||
|
||
#region 呼叫客服属性
|
||
this.CellCustomerServiceSwitch = SwitchType.关闭;
|
||
this.IsStickSwitch = SwitchType.开启;
|
||
this.TriggerAntistop = @"^(客服|在吗|人呢)$";
|
||
this.WeekDay = @"星期一,星期二,星期三,星期四,星期五,星期六";
|
||
this._workdayTimes = new string[] { "09:00-12:00", "13:00-22:00" };
|
||
|
||
this.OnDuty_ReplyMessage = @"正在为您呼叫客服,请稍等....";
|
||
this.OffDuty_ReplyMessage = @"客服正在休息,您可以继续留言,客服上班后会联系您!";
|
||
this.UnWeekDay_ReplyMessage = @"亲,今天客服不上班!\r\n您有疑问可以给我们留言哦,上班后会给您处理!";
|
||
this.notice_robotname = "请选择(钉钉/微信群机器人API名称)";
|
||
this.MatchModel = ReplyModel.传递最近5条消息;
|
||
this.ForcedResponse = SwitchType.关闭;
|
||
#endregion
|
||
|
||
}
|
||
}
|
||
}
|