2022-09-20 03:10:29 +00:00
|
|
|
|
using Api.Framework;
|
|
|
|
|
using Api.Framework.Model;
|
|
|
|
|
using Api.Framework.Tools;
|
|
|
|
|
using System;
|
2022-10-10 07:15:51 +00:00
|
|
|
|
using System.Text;
|
2022-09-20 03:10:29 +00:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using UI.Framework.Forms;
|
|
|
|
|
|
|
|
|
|
namespace FLSystem.Forms
|
|
|
|
|
{
|
|
|
|
|
public partial class AddCloudblack : BaseForm
|
|
|
|
|
{
|
|
|
|
|
public AddCloudblack(fl_member_info info)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this.info = info;
|
|
|
|
|
this.textEdit1.Text = this.info.robot_type.ToString();
|
|
|
|
|
this.textEdit2.Text = this.info.username;
|
|
|
|
|
this.textEdit3.Text = this.info.usernick;
|
|
|
|
|
}
|
|
|
|
|
fl_member_info info;
|
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ServiceResult rst = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CloudBlack black = new CloudBlack();
|
|
|
|
|
rst = black.InsertBlack(info, this.textEdit4.Text);
|
|
|
|
|
if (rst.Ok)
|
|
|
|
|
{
|
|
|
|
|
info.status = Api.Framework.Enums.MemberType.黑名单;
|
|
|
|
|
var session = ApiClient.GetSession();
|
2022-10-10 07:15:51 +00:00
|
|
|
|
//session.Updateable<fl_member_info>(new { status = info.status }).Where(f => f.id == info.id).ExecuteCommand();
|
|
|
|
|
session.Updateable(info);
|
2022-09-20 03:10:29 +00:00
|
|
|
|
|
|
|
|
|
var _black = session.Queryable<fl_blackuser>().First(f => f.username == info.username && f.usertype == info.robot_type);
|
2022-10-10 07:15:51 +00:00
|
|
|
|
|
2022-09-20 03:10:29 +00:00
|
|
|
|
if (_black != null)
|
|
|
|
|
{
|
|
|
|
|
_black.nickname = info.usernick;
|
|
|
|
|
_black.remark = textEdit4.Text;
|
|
|
|
|
_black.iscloud = true;
|
|
|
|
|
_black.isdel = false;//标记没有被删除
|
|
|
|
|
session.Updateable(_black).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_black = new fl_blackuser();
|
|
|
|
|
_black.usertype = info.robot_type;
|
|
|
|
|
_black.username = info.username;
|
|
|
|
|
_black.nickname = info.usernick;
|
|
|
|
|
_black.remark = textEdit4.Text;
|
|
|
|
|
_black.isdel = false;
|
|
|
|
|
_black.iscloud = true;
|
|
|
|
|
_black.updatetime = DateTime.Now;
|
|
|
|
|
session.Insertable(_black).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseForm.ShowSuccess(rst.Message);
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
else
|
2022-10-10 07:15:51 +00:00
|
|
|
|
{
|
2022-09-20 03:10:29 +00:00
|
|
|
|
throw new Exception(rst.Message ?? rst.Data?.ToString());
|
2022-10-10 07:15:51 +00:00
|
|
|
|
}
|
2022-09-20 03:10:29 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
EventClient.OnEvent("添加云黑名单异常:", "添加云黑名单:" + (rst == null ? string.Empty : JsonConvert.SerializeObject(rst)));
|
|
|
|
|
BaseForm.ShowError(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void simpleButton2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ServiceResult rst = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CloudBlack black = new CloudBlack();
|
|
|
|
|
rst = black.RemoveBlack(info);
|
|
|
|
|
if (rst != null && rst.Ok)
|
|
|
|
|
{
|
|
|
|
|
info.status = Api.Framework.Enums.MemberType.正常;
|
|
|
|
|
var session = ApiClient.GetSession();
|
2022-10-10 07:15:51 +00:00
|
|
|
|
//session.Updateable<fl_member_info>(new { status = info.status }).Where(f => f.id == info.id).ExecuteCommand();
|
|
|
|
|
session.Updateable(info);
|
|
|
|
|
|
2022-09-20 03:10:29 +00:00
|
|
|
|
var blackuser = session.Queryable<fl_blackuser>().First(f => f.username == info.username && f.usertype == info.robot_type);
|
|
|
|
|
if (blackuser != null)
|
|
|
|
|
{
|
|
|
|
|
blackuser.isdel = true;
|
|
|
|
|
blackuser.iscloud = false;
|
|
|
|
|
blackuser.updatetime = DateTime.Now;
|
|
|
|
|
session.Updateable(blackuser).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BaseForm.ShowSuccess(rst.Message);
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
throw new Exception(rst.Message ?? rst.Data?.ToString());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
EventClient.OnEvent("删除云黑名单异常:", "删除云黑名单:" + (rst == null ? string.Empty : CsharpHttpHelper.HttpHelper.ObjectToJson(rst)));
|
|
|
|
|
BaseForm.ShowError(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|