using Api.Framework;
using Api.Framework.Enums;
using Api.Framework.Model;
using Api.Framework.SDK;
using Api.Framework.Tools;
using Api.Framework.Utils;
using BackupAndImport;
using BackupAndImport.ECO;
using BackupAndImport.ECO.Entitys;
using BackupAndImport.ECO.Events;
using BackupAndImport.Entitys;
using BackupAndImport.Entitys.annaer;
using BackupAndImport.Entitys.annaer_cloud;
using BackupAndImport.Entitys.lieke;
using BackupAndImport.Entitys.悠哉;
using BackupAndImport.Entitys.淘某喵;
using BackupAndImport.Entitys.速推客;
using BackupAndImport.NianChu;
using BackupAndImport.Properties;
using CsharpHttpHelper;
using DataDocking.Entitys;
using DataDocking.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using BackupAndImport.速推客云端;
using BackupAndImport.速推客云端.Entitys;
using CsharpHttpHelper.Enum;
using DevExpress.Data.Helpers;
using Newtonsoft.Json.Linq;
using UI.Framework.Forms;
using static Api.Framework.Cps.AlimamaApi;
using static BackupAndImport.ECO.Eco;
using static BackupAndImport.ECO.EventLog;
namespace DataDocking
{
public partial class MainForm : BaseForm
{
///
/// 用户自定义回复库
///
public class fl_plugin_autoanswer_definedlib : base_model
{
///
/// 平台类型
///
public string chat_type { get; set; }
///
/// 关键词
///
public string antistop { get; set; }
///
/// 匹配模式 0是为完全匹配,false为模糊 and 正则表达式 【这里用int类型,主要是因为dev中的Gridcontrol bool好像不支持 修改界面显示】
///
public int match_pattern { get; set; }
///
/// 指定回复的机器人信息,为空时所有机器人都使用
///
public string specific_robot_setting_text { get; set; }
///
/// 回复内容
///
[SugarColumn(Length = 10000)]//设置字段为长文本
public string content { get; set; }
///
/// 是否通知管理员 【这里用int类型,主要是因为dev中的Gridcontrol bool好像不支持 修改界面显示】
///
public int is_alert_admin { get; set; }
public bool CheckChatType(ChatType type)
{
return string.IsNullOrWhiteSpace(this.chat_type) ? false : this.chat_type.Split(',').FirstOrDefault(f => ushort.Parse(f) == (ushort)type) != null ? true : false;
}
}
public class fl_plugin_autoanswer_userdefinedlibrary : base_model
{
///
/// 平台类型
///
public string chat_type { get; set; }
///
/// 关键词
///
public string antistop { get; set; }
///
/// 匹配模式 0是为完全匹配,false为模糊 and 正则表达式 【这里用int类型,主要是因为dev中的Gridcontrol bool好像不支持 修改界面显示】
///
public int match_pattern { get; set; }
///
/// 回复内容
///
[SugarColumn(Length = 10000)]//设置字段为长文本
public string content { get; set; }
///
/// 是否通知管理员 【这里用int类型,主要是因为dev中的Gridcontrol bool好像不支持 修改界面显示】
///
public int is_alert_admin { get; set; }
public bool CheckChatType(ChatType type)
{
return string.IsNullOrWhiteSpace(this.chat_type) ? false : this.chat_type.Split(',').FirstOrDefault(f => ushort.Parse(f) == (ushort)type) != null ? true : false;
}
}
///
/// 打标记条件
///
public enum SignType
{
好友天数 = 0,
查询次数 = 1,
订单总数 = 2,
退款总数 = 3,
推荐人数 = 4
}
///
/// 自动打标签数据表
///
public class fl_plugin_signcontacts_sign_info : base_model
{
public SignType signtype { get; set; }
public long amount { get; set; }
public string sign { get; set; }
}
public MainForm()
{
InitializeComponent();
this.Text = Resources.MainFormTitle;
}
public void CloseForm()
{
if (!this.IsDisposed)
{
this.Invoke(new Action(delegate
{
this.Close();
this.Dispose();
}));
}
}
///
/// 数据库表中的数据
///
List tableData = new List() { "延迟结算配置", "会员分组配置", "分出比例配置", "自定义问答", "自动打标签数据", "独立分出比例" };
private void MainForm_Load(object sender, EventArgs e)
{
BackupAndImport.ECO.EventLog.LogEvent += EventLog_LogEvent;
BackupAndImport.NianChu.EventLog.LogEvent += NCEventLog_LogEvent;
BackupAndImport.速推客云端.EventLog.LogEvent += STKEventLog_LogEvent;
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, "全选"));
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, "全消"));
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, tableData[0]));
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, tableData[1]));
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, tableData[2]));
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, tableData[3]));
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, tableData[4]));
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, tableData[5]));
var session = ApiClient.GetSession();
var system_configs = session.Find("select * from fl_dictionary_item");
if (system_configs != null && system_configs.Count != 0)
{
foreach (var item in system_configs)
{
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, item.dickey));
}
this.checkedListBoxControl1.Tag = system_configs;
}
else
this.checkedListBoxControl1.Items.Add(new CheckedListBoxItem(null, "无配置信息!"));
Auto_Bak_onoff.Checked = Class1.Config.Auto_Bak_OnOff;
label12.Text = (session.CurrentConnectionConfig.DbType == SqlSugar.DbType.MySql) ? "Mysql" : "Sqlite";
if (string.IsNullOrWhiteSpace(Class1.Config.Auto_Bak_Path))
Class1.Config.Auto_Bak_Path = Util.MapPath($"File\\备份");
textEdit7.Text = Class1.Config.Auto_Bak_Path;
dateTimePicker1.Value = Class1.Config.Auto_Bak_Time;
numericUpDown2.Value = Class1.Config.Auto_Bak_Day;
checkBox6.Checked = Class1.Config.Is_Bak_Send_Email;
#region 增加所有微信机器人账号
this.comboBoxEdit3.Properties.Items.Clear();
//var weixinBases = Chat.Framework.ChatClient.WXClient.Values.ToList();
var objList = new List