2257 lines
102 KiB
C#
2257 lines
102 KiB
C#
using Api.Framework;
|
||
using Api.Framework.Enums;
|
||
using Api.Framework.Model;
|
||
using Api.Framework.SDK;
|
||
using Api.Framework.Tools;
|
||
using CsharpHttpHelper;
|
||
using CsharpHttpHelper.Enum;
|
||
using DevExpress.XtraEditors;
|
||
using FLSystem.Events;
|
||
using Newtonsoft.Json;
|
||
using SqlSugar;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Diagnostics;
|
||
using System.Linq;
|
||
using System.Text.RegularExpressions;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
using Api.Framework.Utils;
|
||
using UI.Framework.Controls;
|
||
using UI.Framework.Entitys;
|
||
using UI.Framework.Forms;
|
||
using ApplyType = Chat.Framework.WXSdk.IPAD.ApplyType;
|
||
|
||
namespace FLSystem.Forms
|
||
{
|
||
public partial class point_manage_control : XtraUserControl
|
||
{
|
||
private string username = string.Empty;
|
||
private string query_type = string.Empty;
|
||
public point_manage_control(string username, string query_type)
|
||
{
|
||
InitializeComponent();
|
||
this.username = username;
|
||
this.query_type = query_type;
|
||
}
|
||
|
||
private void MainEvent_CommonEvents(object sender, CommonEvents e)
|
||
{
|
||
if (this.IsDisposed) return;
|
||
try
|
||
{
|
||
if (e.Commons != null && e.Commons.Count != 0 && xtraTabControl1.TabPages.Count != 0)
|
||
{
|
||
if (e.Commons.ContainsKey("control_name") && e.Commons.ContainsKey("username"))
|
||
{
|
||
if (e.Commons["control_name"].ToString() == "提现管理")
|
||
{
|
||
var query_type = e.Commons["query_type"].ToString();
|
||
if (query_type == "积分日志")
|
||
{
|
||
textBox1.Text = e.Commons["username"].ToString();
|
||
comboBox1.SelectedIndex = 0;
|
||
comboBoxEdit3.SelectedIndex = 1;
|
||
if (xtraTabControl1.SelectedTabPageIndex == 2)
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
xtraTabControl1.SelectedTabPageIndex = 2;
|
||
}
|
||
else if (query_type == "未兑换提现")
|
||
{
|
||
textBox3.Text = e.Commons["username"].ToString();
|
||
comboBoxEdit1.SelectedIndex = 0;
|
||
comboBoxEdit4.SelectedIndex = 1;
|
||
checkBox2.Checked = false;
|
||
if (this.xtraTabControl1.SelectedTabPageIndex == 1)
|
||
xtraTabControl1.SelectedTabPageIndex = 0;
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
}
|
||
else if (query_type == "已兑换提现")
|
||
{
|
||
textBox2.Text = e.Commons["username"].ToString();
|
||
comboBoxEdit2.SelectedIndex = 0;
|
||
comboBoxEdit5.SelectedIndex = 1;
|
||
checkBox1.Checked = false;
|
||
if (xtraTabControl1.SelectedTabPageIndex == 0)
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
xtraTabControl1.SelectedTabPageIndex = 0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
|
||
public class exchange_list_temp
|
||
{
|
||
[
|
||
Browsable(false)
|
||
]
|
||
public long id { get; set; }
|
||
|
||
/// <summary>
|
||
/// 用户id
|
||
/// </summary>
|
||
[
|
||
Browsable(false)
|
||
]
|
||
public long uid { get; set; }
|
||
|
||
/// <summary>
|
||
/// 机器人id
|
||
/// </summary>
|
||
[
|
||
Browsable(false)
|
||
]
|
||
public long rid { get; set; }
|
||
|
||
/// <summary>
|
||
/// 平台类型
|
||
/// </summary>
|
||
[
|
||
Category("1)、平台信息"), DisplayName("平台"), ReadOnly(true), Description(@"只读:平台信息"),
|
||
]
|
||
public ChatType chattype { get; set; }
|
||
/// <summary>
|
||
/// 用户fl_robot_info的机器人账号 robot_name
|
||
/// </summary>
|
||
[
|
||
Category("1)、平台信息"), DisplayName("机器人账号"), ReadOnly(true), Description(@"只读:机器人账号"),
|
||
]
|
||
public string robot_name { get; set; }
|
||
/// <summary>
|
||
/// 用户fl_robot_info的机器人昵称 nick
|
||
/// </summary>
|
||
[
|
||
Category("1)、平台信息"), DisplayName("机器人昵称"), ReadOnly(true), Description(@"只读:机器人昵称"),
|
||
]
|
||
public string robot_nick { get; set; }
|
||
/// <summary>
|
||
/// 用户账号
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("用户账号"), ReadOnly(true), Description(@"只读:用户账号")
|
||
]
|
||
public string username { get; set; }
|
||
/// <summary>
|
||
/// [昵称]
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("昵称"), ReadOnly(true), Description(@"只读:昵称")
|
||
]
|
||
public string usernick { get; set; }
|
||
|
||
/// <summary>
|
||
/// [昵称]
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("用户备注"), ReadOnly(true), Description(@"只读:用户备注")
|
||
]
|
||
public string member_remark { get; set; }
|
||
/// <summary>
|
||
/// 支付宝账号
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("支付宝账号"), ReadOnly(true), Description(@"只读:用户支付宝账号")
|
||
]
|
||
public string alipay_num { get; set; }
|
||
/// <summary>
|
||
/// 支付宝名称
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("支付宝名称"), ReadOnly(true), Description(@"只读:用户支付宝名称")
|
||
]
|
||
public string alipay_name { get; set; }
|
||
/// <summary>
|
||
/// 身份证名称
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("身份证名称"), ReadOnly(true), Description(@"只读:用户身份证名称")
|
||
]
|
||
public string identity_name { get; set; }
|
||
/// <summary>
|
||
/// 身份证号码
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("身份证号码"), ReadOnly(true), Description(@"只读:用户身份证号码")
|
||
]
|
||
public string identity_card { get; set; }
|
||
/// <summary>
|
||
/// 兑换群
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("兑换群号"), ReadOnly(true), Description(@"只读:再群内兑换才会有群号")
|
||
]
|
||
public string groupid { get; set; }
|
||
/// <summary>
|
||
/// 兑换时间
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("用户兑换时间"), ReadOnly(true), Description(@"只读:用户的兑换时间")
|
||
]
|
||
public DateTime time { get; set; }
|
||
/// <summary>
|
||
/// 用户积分
|
||
/// </summary>
|
||
[
|
||
Category("2)、用户信息"), DisplayName("用户兑换积分"), ReadOnly(true), Description(@"只读:用户兑换积分")
|
||
]
|
||
public double point { get; set; }
|
||
/// <summary>
|
||
/// 状态
|
||
/// </summary>
|
||
[
|
||
Category("3)、订单操作"), DisplayName("订单状态"), Description(@"设置订单状态")
|
||
]
|
||
public ApplyType state { get; set; }
|
||
|
||
/// <summary>
|
||
/// 备注
|
||
/// </summary>
|
||
[
|
||
Category("3)、订单操作"), DisplayName("订单备注"), Description(@"用户兑换备注"), Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
||
]
|
||
public string remark { get; set; }
|
||
|
||
/// <summary>
|
||
/// 审核时间
|
||
/// </summary>
|
||
[
|
||
Browsable(false)
|
||
]
|
||
public DateTime check_time { get; set; }
|
||
}
|
||
|
||
//积分日志
|
||
public class pointlog_list_temp
|
||
{
|
||
public long uid { get; set; }
|
||
|
||
public long rid { get; set; }
|
||
|
||
/// <summary>
|
||
/// 平台类型
|
||
/// </summary>
|
||
public ChatType chattype { get; set; }
|
||
/// <summary>
|
||
/// 用户账号
|
||
/// </summary>
|
||
public string username { get; set; }
|
||
/// <summary>
|
||
/// 用户昵称
|
||
/// </summary>
|
||
public string usernick { get; set; }
|
||
/// <summary>
|
||
/// 机器人昵称
|
||
/// </summary>
|
||
public string robot_nick { get; set; }
|
||
/// <summary>
|
||
/// 机器人账号
|
||
/// </summary>
|
||
public string robot_name { get; set; }
|
||
/// <summary>
|
||
/// 操作积分
|
||
/// </summary>
|
||
public double point { get; set; }
|
||
/// <summary>
|
||
/// 平台类型
|
||
/// </summary>
|
||
public string pointtype { get; set; }
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string message { get; set; }
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public DateTime crt_time { get; set; }
|
||
|
||
/// <summary>
|
||
/// 修改前积分
|
||
/// </summary>
|
||
public double before_point { get; set; }
|
||
|
||
/// <summary>
|
||
/// 修改后积分
|
||
/// </summary>
|
||
public double after_point { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 商户链接临时类
|
||
/// </summary>
|
||
public class shpay_temp
|
||
{
|
||
public long id { get; set; }
|
||
/// <summary>
|
||
/// 机器人id
|
||
/// </summary>
|
||
public long rid { get; set; }
|
||
/// <summary>
|
||
/// 机器人账号
|
||
/// </summary>
|
||
public string robot_name { get; set; }
|
||
/// <summary>
|
||
/// 机器人昵称
|
||
/// </summary>
|
||
public string robot_nick { get; set; }
|
||
|
||
/// <summary>
|
||
/// 用户id
|
||
/// </summary>
|
||
public long uid { get; set; }
|
||
/// <summary>
|
||
/// 用户账号
|
||
/// </summary>
|
||
public string username { get; set; }
|
||
/// <summary>
|
||
/// 用户昵称
|
||
/// </summary>
|
||
public string usernick { get; set; }
|
||
/// <summary>
|
||
/// 用户备注
|
||
/// </summary>
|
||
public string remark { get; set; }
|
||
/// <summary>
|
||
/// 平台
|
||
/// </summary>
|
||
public ChatType chattype { get; set; }
|
||
/// <summary>
|
||
/// 提现金额
|
||
/// </summary>
|
||
public double point { get; set; }
|
||
/// <summary>
|
||
/// 商户连接
|
||
/// </summary>
|
||
public string payurl { get; set; }
|
||
/// <summary>
|
||
/// 生成连接时间
|
||
/// </summary>
|
||
public long ctime { get; set; }
|
||
/// <summary>
|
||
/// 领取状态
|
||
/// </summary>
|
||
public PayGetType paytype { get; set; } = PayGetType.未领取;
|
||
/// <summary>
|
||
/// 用户领取时间
|
||
/// </summary>
|
||
public long paytime { get; set; }
|
||
/// <summary>
|
||
/// 商户orderid
|
||
/// </summary>
|
||
public string orderid { get; set; }
|
||
/// <summary>
|
||
/// 生成日期
|
||
/// </summary>
|
||
public long ctimedate { get; set; }
|
||
/// <summary>
|
||
/// 通知发送时间
|
||
/// </summary>
|
||
public long sendtime { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 商户请求状态返回
|
||
/// </summary>
|
||
public class shpayResult
|
||
{
|
||
/// <summary>
|
||
/// 请求状态
|
||
/// </summary>
|
||
public bool ok { get; set; }
|
||
/// <summary>
|
||
/// 7d043f8e8e4be0784a596a25cbc078fb|未支付\r\n144a00f52c271c39513937c252a54ef6|已支付
|
||
/// </summary>
|
||
public string res { get; set; }
|
||
}
|
||
|
||
private void gridView3_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
//if (e.HitInfo.Column.Caption == "状态")
|
||
// gridView3.SelectRow(e.HitInfo.RowHandle);
|
||
//if (gridView3.GetSelectedRows().Length == 0) return;
|
||
//var selectRow = gridView3.GetSelectedRows()[0];
|
||
var id = this.gridView3.GetRowCellValue(e.RowHandle, "id").ToString();//获取ID列的数据
|
||
var state = this.gridView3.GetRowCellValue(e.RowHandle, "state").ToString().ToLower();//获取state列的数据
|
||
#region 单元格双击修改 用户兑换状态
|
||
if (e.Clicks == 2)
|
||
{
|
||
if (state == ApplyType.未审核.ToString())
|
||
{
|
||
var session = ApiClient.GetSession();
|
||
|
||
var exchange = session.Queryable<fl_exchange_info>()
|
||
.Where(f => f.id == int.Parse(id))
|
||
.Select<exchange_list_temp>((o) =>
|
||
new exchange_list_temp()
|
||
{
|
||
id = o.id,
|
||
groupid = o.groupid,
|
||
time = o.time,
|
||
point = o.point,
|
||
state = o.state,
|
||
remark = o.remark,
|
||
uid = o.uid,
|
||
rid = o.rid
|
||
//alipay_name = ,
|
||
//alipay_num = ,
|
||
//chattype = ,
|
||
//identity_card = ,
|
||
//identity_name = ,
|
||
//member_remark = ,
|
||
//rid = ,
|
||
//robot_name = ,
|
||
//robot_nick = ,
|
||
//uid = ,
|
||
//username = ,
|
||
//usernick =
|
||
}).First();
|
||
|
||
if (exchange != null)
|
||
{
|
||
#region 附加用户
|
||
if (exchange.uid != 0)
|
||
{
|
||
var member = session.Queryable<fl_member_info>().First(f => f.id == exchange.uid);
|
||
if (member != null)
|
||
{
|
||
exchange.alipay_name = member.alipay_name;
|
||
exchange.alipay_num = member.alipay_num;
|
||
exchange.chattype = member.robot_type;
|
||
exchange.identity_card = member.identity_card;
|
||
exchange.identity_name = member.identity_name;
|
||
exchange.member_remark = member.remark;
|
||
exchange.username = member.username;
|
||
exchange.usernick = member.usernick;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 附加机器人信息
|
||
if (exchange.rid != 0)
|
||
{
|
||
var robot = session.FindRobots().FirstOrDefault(f => f.id == exchange.rid);
|
||
if (robot != null)
|
||
{
|
||
exchange.chattype = robot.type;
|
||
exchange.robot_name = robot.name;
|
||
exchange.robot_nick = robot.nick;
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
try
|
||
{
|
||
var exchangeStateForm = new ExchangeStateForm(exchange);
|
||
exchangeStateForm.ShowDialog();
|
||
if (exchange.state != ApplyType.未审核)
|
||
{
|
||
var exchangeResult = session.Find<fl_exchange_info>("select * from fl_exchange_info where id = @id", new { id = id }).FirstOrDefault();
|
||
if (exchangeResult == null) throw new Exception("对不起数据异常,请稍后重试!");
|
||
session.ExcuteSQL("update fl_exchange_info set state = @state,remark = @remark,check_time = @check_time where id = @id", new { state = exchange.state, check_time = DateTime.Now, remark = exchange.remark, id = id });
|
||
var robot_info = session.FindRobotInfo(exchange.robot_name, exchange.chattype);
|
||
// if (robot_info == null) throw new Exception(@"兑换异常
|
||
//机器人账号:" + exchange.robot_name + " 信息异常");
|
||
var member_info = session.Find<fl_member_info>("select * from fl_member_info where id = @id", new { id = exchangeResult.uid }).FirstOrDefault();
|
||
|
||
var pointConfig = ApiClient.GetPointManageConfig();
|
||
if (pointConfig == null)
|
||
throw new Exception("获取积分管理配置为空/");
|
||
if (member_info != null && robot_info != null)
|
||
{
|
||
if (exchange.state == ApplyType.退回兑换)
|
||
{
|
||
member_info = session.ChangePoint(PointType.退回积分, exchangeResult.point, member_info.id, $"退回兑换{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
|
||
if (robot_info != null)
|
||
ApiClient.SendMessage(robot_info, exchange.username, new VariateReplace().CommonReplace(pointConfig.ExchangeReturnTip.Replace("[兑换金额]", exchangeResult.point.ToString()).Replace("[备注]", exchange.remark), member_info), exchange.groupid);
|
||
}
|
||
else if (exchange.state == ApplyType.已审核)
|
||
{
|
||
if (member_info != null && robot_info != null)
|
||
{
|
||
var mess = new VariateReplace().CommonReplace(pointConfig.ExchangeAdoptTip.Replace("[兑换金额]", exchangeResult.point.ToString()).Replace("[领取地址]", exchangeStateForm.pay_url), member_info);
|
||
|
||
var sends = new List<temp_send_data>();
|
||
if (!string.IsNullOrWhiteSpace(exchangeStateForm.mess))
|
||
sends.Add(new temp_send_data() { Groupid = exchange.groupid, Message = exchangeStateForm.mess, Robot = robot_info, TouserName = exchange.username });
|
||
sends.Add(new temp_send_data() { Groupid = exchange.groupid, Message = mess, Robot = robot_info, TouserName = exchange.username });
|
||
|
||
ApiClient.SendMessage(sends.ToArray());
|
||
}
|
||
}
|
||
else //没收兑换
|
||
{
|
||
ApiClient.SendMessage(robot_info, exchange.username, new VariateReplace().CommonReplace(pointConfig.ExchangeConfiscateTip.Replace("[兑换金额]", exchangeResult.point.ToString()).Replace("[备注]", exchange.remark), member_info), exchange.groupid);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (exchange.state == ApplyType.退回兑换)
|
||
throw new Exception("兑换退回失败,请稍后重试.");
|
||
}
|
||
this.gridView3.DeleteRow(e.RowHandle);
|
||
}
|
||
else
|
||
{
|
||
session.ExcuteSQL("update fl_exchange_info set remark = @remark where id = @id", new { remark = exchange.remark, id = id });
|
||
}
|
||
|
||
label3.Visible = gridView3.RowCount == 0;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message + "-" + ex.StackTrace, "错误1", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message + "*" + ex.StackTrace, "错误2", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
|
||
private void simpleButton2_Click(object sender, EventArgs e)
|
||
{
|
||
this.pageControl3.GotoPage();
|
||
label3.Visible = gridView3.RowCount == 0;
|
||
}
|
||
|
||
private void simpleButton3_Click(object sender, EventArgs e)
|
||
{
|
||
this.pageControl2.GotoPage();
|
||
label2.Visible = gridView2.RowCount == 0;
|
||
}
|
||
|
||
private void simpleButton1_Click(object sender, EventArgs e)
|
||
{
|
||
this.pageControl4.GotoPage();
|
||
label4.Visible = gridView4.RowCount == 0;
|
||
}
|
||
|
||
private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
if (xtraTabControl1.SelectedTabPageIndex == 0)
|
||
{
|
||
Task.Run(() =>
|
||
{
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
if (IsInitYiJingDuiHuan == false)
|
||
{
|
||
YiJingDuihuan();
|
||
}
|
||
|
||
if (IsInitYiJingDuiHuan)
|
||
{
|
||
pageControl2.GotoPage(1);
|
||
label2.Visible = gridView2.RowCount == 0;
|
||
}
|
||
}));
|
||
});
|
||
}
|
||
else if (xtraTabControl1.SelectedTabPageIndex == 1)
|
||
{
|
||
if (IsInitNotDuiHuan == false)
|
||
{
|
||
NotDuiHuan();
|
||
}
|
||
|
||
if (IsInitNotDuiHuan)
|
||
{
|
||
pageControl3.GotoPage(1);
|
||
label3.Visible = gridView3.RowCount == 0;
|
||
}
|
||
}
|
||
else if (xtraTabControl1.SelectedTabPageIndex == 2)
|
||
{
|
||
if (IsInitJiFenRecord == false)
|
||
{
|
||
JiFenRecord();
|
||
}
|
||
|
||
if (IsInitJiFenRecord)
|
||
{
|
||
pageControl4.GotoPage(1);
|
||
label4.Visible = gridView4.RowCount == 0;
|
||
}
|
||
}
|
||
else if (xtraTabControl1.SelectedTabPageIndex == 3)
|
||
{
|
||
if (IsInitShangHuView == false)
|
||
{
|
||
ShangHuView();
|
||
}
|
||
|
||
if (IsInitShangHuView)
|
||
{
|
||
pageControl1.GotoPage(1);
|
||
label1.Visible = gridView1.RowCount == 0;
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
|
||
private void checkBox2_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
dateTimePicker6.Enabled = dateTimePicker5.Enabled = checkBox2.Checked;
|
||
}
|
||
|
||
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
dateTimePicker4.Enabled = dateTimePicker3.Enabled = checkBox1.Checked;
|
||
}
|
||
|
||
private string FindUsernameByGrid()
|
||
{
|
||
try
|
||
{
|
||
if (xtraTabControl1.SelectedTabPageIndex == 0)
|
||
{
|
||
var rows = gridView2.GetSelectedRows();
|
||
if (rows != null && rows.Length > 0)
|
||
return gridView2.GetRowCellValue(rows[0], "username").ToString();//获取列的数据
|
||
return string.Empty;
|
||
}
|
||
else if (xtraTabControl1.SelectedTabPageIndex == 1)
|
||
{
|
||
//var rows = gridView3.GetSelectedRows();
|
||
var rows1 = gridView3.GetFocusedRow();
|
||
if (rows1 != null)
|
||
return (rows1 as exchange_list_temp).username;
|
||
//var rows = gridView3.GetFocusedDataSourceRowIndex();
|
||
//if (rows >= 0)
|
||
// return gridView3.GetRowCellValue(rows, "username").ToString();//获取列的数据
|
||
return string.Empty;
|
||
}
|
||
else if (xtraTabControl1.SelectedTabPageIndex == 2)
|
||
{
|
||
var rows = gridView4.GetSelectedRows();
|
||
if (rows != null && rows.Length > 0)
|
||
return gridView4.GetRowCellValue(rows[0], "username").ToString();//获取列的数据
|
||
return string.Empty;
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{ }
|
||
return string.Empty;
|
||
}
|
||
|
||
private void 查看用户信息1ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
var username = FindUsernameByGrid();
|
||
if (!string.IsNullOrWhiteSpace(username))
|
||
{
|
||
var tsmi = sender as ToolStripMenuItem;
|
||
if (tsmi == null) throw new Exception("数据异常");
|
||
|
||
var common = new Dictionary<string, object>();
|
||
common["control_name"] = tsmi.Text;
|
||
common["username"] = username;
|
||
MainEvent.OnEvent(null, new CommonEvents(common));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
|
||
private void ToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
var username = FindUsernameByGrid();
|
||
if (!string.IsNullOrWhiteSpace(username))
|
||
{
|
||
var tsmi = sender as ToolStripMenuItem;
|
||
if (tsmi == null) throw new Exception("数据异常");
|
||
|
||
var text = tsmi.Text.Replace("订单", "");
|
||
var cps = (CpsType)Enum.Parse(typeof(CpsType), text);
|
||
|
||
var common = new Dictionary<string, object>();
|
||
common["cps_type"] = (int)cps;
|
||
common["username"] = username;
|
||
MainEvent.OnEvent(null, new CommonEvents(common));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
|
||
private void ToolStripMenuItem2_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
var username = FindUsernameByGrid();
|
||
if (!string.IsNullOrWhiteSpace(username))
|
||
{
|
||
var tsmi = sender as ToolStripMenuItem;
|
||
if (tsmi == null) throw new Exception("数据异常");
|
||
|
||
if (tsmi.Text == "查看积分日志")
|
||
{
|
||
xtraTabControl1.SelectedTabPageIndex = 2;
|
||
textBox1.Text = username;
|
||
comboBox1.SelectedIndex = 0;
|
||
comboBoxEdit3.SelectedIndex = 1;
|
||
dateTimePicker1.Value = DateTime.Today.AddDays(-10);
|
||
dateTimePicker2.Value = DateTime.Today;
|
||
pageControl4.GotoPage(1);
|
||
label4.Visible = gridView4.RowCount == 0;
|
||
}
|
||
else if (tsmi.Text == "未兑换提现")
|
||
{
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
textBox3.Text = username;
|
||
comboBoxEdit1.SelectedIndex = 0;
|
||
comboBoxEdit4.SelectedIndex = 1;
|
||
pageControl3.GotoPage(1);
|
||
label3.Visible = gridView3.RowCount == 0;
|
||
}
|
||
else if (tsmi.Text == "已兑换提现")
|
||
{
|
||
xtraTabControl1.SelectedTabPageIndex = 0;
|
||
comboBoxEdit5.SelectedIndex = 1;
|
||
textBox2.Text = username;
|
||
comboBoxEdit2.SelectedIndex = 0;
|
||
pageControl2.GotoPage(1);
|
||
label2.Visible = gridView2.RowCount == 0;
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
|
||
private CancellationTokenSource tokenSource = new CancellationTokenSource();
|
||
|
||
private async void hyperlinkLabelControl1_Click(object sender, EventArgs e)
|
||
{
|
||
if (XtraMessageBox.Show(@"是否校准用户对应机器人信息
|
||
|
||
校准情况如下:
|
||
①机器人信息删除,导致用户绑定的机器人信息丢失
|
||
②机器人账号异常,用户迁移新机器人无法审核提现
|
||
|
||
注:校验后还没有机器人信息,让客户发条信息后重试!
|
||
", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) return;
|
||
try
|
||
{
|
||
EventClient.StopParsing = true;
|
||
groupBox2.Enabled = false;
|
||
try
|
||
{
|
||
await Task.Run(() =>
|
||
{
|
||
var session = ApiClient.GetSession();
|
||
session.BeginTransaction();
|
||
try
|
||
{
|
||
var exchange_infos = session.Find<fl_exchange_info>("state = 1");
|
||
var robots = session.FindRobots(true);
|
||
foreach (var item in exchange_infos)
|
||
{
|
||
var member = session.FindMemberInfoById(item.uid);
|
||
if (member == null) continue;
|
||
var robot = robots.FirstOrDefault(f => f.name == member.robot_name && f.type == member.robot_type);
|
||
if (robot == null) continue;
|
||
if (robot.id == item.rid) continue;
|
||
item.rid = robot.id;
|
||
session.Updateable(item).ExecuteCommand();
|
||
}
|
||
session.Commit();
|
||
XtraMessageBox.Show("校准完成", "温馨提示", MessageBoxButtons.OK);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
session.Rollback();
|
||
this.Invoke(new Action(delegate
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "校准失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}));
|
||
}
|
||
finally
|
||
{
|
||
this.Invoke(new Action(delegate
|
||
{
|
||
groupBox2.Enabled = true;
|
||
EventClient.StopParsing = false;
|
||
pageControl3.GotoPage(1);
|
||
}));
|
||
}
|
||
}, tokenSource.Token);
|
||
}
|
||
catch (Exception)
|
||
{ }
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
}
|
||
|
||
private bool IsInitYiJingDuiHuan = false;
|
||
|
||
/// <summary>
|
||
/// 初始化已经兑换
|
||
/// </summary>
|
||
private void YiJingDuihuan()
|
||
{
|
||
#region 加载已兑换用户信息列表
|
||
|
||
try
|
||
{
|
||
pageControl2.Bind((index, size) =>
|
||
{
|
||
var stopWatch = new Stopwatch();
|
||
stopWatch.Start();
|
||
|
||
|
||
var stopWatch4 = new Stopwatch();
|
||
stopWatch4.Start();
|
||
|
||
var keyword = textBox2.Text.Replace("'", "''").Trim();
|
||
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
||
var session = ApiClient.GetSession();
|
||
if (!string.IsNullOrWhiteSpace(keyword))
|
||
{
|
||
List<string> member_ids = new List<string>();
|
||
switch (comboBoxEdit5.Text)
|
||
{
|
||
case "客户账号":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "username", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户昵称":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "usernick", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户备注":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "remark", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户编号":
|
||
{
|
||
member_ids.Add(keyword);
|
||
}
|
||
break;
|
||
case "支付宝账号":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "alipay_num", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "支付宝姓名":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "alipay_name", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
}
|
||
|
||
if (member_ids.Count == 1)
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "uid",
|
||
ConditionalType = ConditionalType.Equal,
|
||
FieldValue = member_ids[0]
|
||
});
|
||
else if (member_ids.Count == 0)
|
||
conModels.Add(new ConditionalModel()
|
||
{ FieldName = "uid", ConditionalType = ConditionalType.Equal, FieldValue = "-1" });
|
||
else
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "uid",
|
||
ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", member_ids)
|
||
});
|
||
}
|
||
|
||
conModels.Add(new ConditionalModel()
|
||
{ FieldName = "state", ConditionalType = ConditionalType.IsNot, FieldValue = "1" });
|
||
|
||
if (checkBox1.Checked)
|
||
{
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "time",
|
||
ConditionalType = ConditionalType.GreaterThanOrEqual,
|
||
FieldValue = dateTimePicker4.Value.Date.ToString("yyyy-MM-dd HH:mm:ss")
|
||
});
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "time",
|
||
ConditionalType = ConditionalType.LessThanOrEqual,
|
||
FieldValue = dateTimePicker3.Value.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")
|
||
});
|
||
}
|
||
|
||
if (comboBoxEdit2.SelectedIndex != 0)
|
||
{
|
||
var robotIds = session.FindRobots().Where(f => f.name == comboBoxEdit2.Text.Trim())
|
||
.Select(f => f.id).ToList();
|
||
if (robotIds != null)
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "rid",
|
||
ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", robotIds)
|
||
});
|
||
}
|
||
|
||
stopWatch4.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"A-3执行时间:{stopWatch4.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
#region 统计已提现金额
|
||
|
||
var point = session.Queryable<fl_exchange_info>().Where(conModels).Sum(f => f.point);
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
gridView2.Columns["point"].SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Custom, point.ToString("0.00"));
|
||
}));
|
||
|
||
#endregion
|
||
|
||
var stopWatch3 = new Stopwatch();
|
||
stopWatch3.Start();
|
||
int totalNumber = 0; //总数
|
||
|
||
var result = session.Queryable<fl_exchange_info>()
|
||
.Where(conModels)
|
||
.OrderBy(f => f.id, OrderByType.Desc)
|
||
.Select<exchange_list_temp>(f => new exchange_list_temp()
|
||
{
|
||
id = f.id,
|
||
groupid = f.groupid,
|
||
point = f.point,
|
||
remark = f.remark,
|
||
state = f.state,
|
||
time = f.time,
|
||
uid = f.uid,
|
||
rid = f.rid,
|
||
check_time = f.check_time
|
||
//alipay_name = m.alipay_name,
|
||
//alipay_num = m.alipay_num,
|
||
//chattype = m.robot_type,
|
||
//identity_card = m.identity_card,
|
||
//identity_name = m.identity_name,
|
||
//member_remark = m.remark,
|
||
//username = m.username,
|
||
//usernick = m.usernick,
|
||
//robot_name = r.name,
|
||
//robot_nick = r.nick
|
||
}).ToPageList(index, size, ref totalNumber);
|
||
|
||
stopWatch3.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"A-2执行时间:{stopWatch3.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
if (result.Count != 0)
|
||
{
|
||
#region 附加用户
|
||
|
||
var stopWatch2 = new Stopwatch();
|
||
stopWatch2.Start();
|
||
var bindUsersList = result.Where(f => f.uid != 0).Select(f => f.uid.ToString()).ToList();
|
||
var memberData = new List<fl_member_info>();
|
||
if (bindUsersList != null && bindUsersList.Count != 0)
|
||
{
|
||
memberData = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "id", ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", bindUsersList)
|
||
}
|
||
}).ToList();
|
||
}
|
||
|
||
foreach (var member in memberData)
|
||
{
|
||
var items = result.Where(f => f.uid == member.id).ToList();
|
||
foreach (var item in items)
|
||
{
|
||
item.alipay_name = member.alipay_name;
|
||
item.alipay_num = member.alipay_num;
|
||
item.chattype = member.robot_type;
|
||
item.identity_card = member.identity_card;
|
||
item.identity_name = member.identity_name;
|
||
item.member_remark = member.remark;
|
||
item.username = member.username;
|
||
item.usernick = member.usernick;
|
||
}
|
||
}
|
||
|
||
stopWatch2.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"A-0执行时间:{stopWatch2.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
#endregion
|
||
|
||
#region 附加机器人信息
|
||
|
||
var stopWatch1 = new Stopwatch();
|
||
stopWatch1.Start();
|
||
var robotList = result.Where(f => f.rid != 0).Select(f => f.rid.ToString()).ToList();
|
||
var robotData = new List<fl_robot_info>();
|
||
if (robotList != null && robotList.Count != 0)
|
||
robotData = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "id", ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", robotList)
|
||
}
|
||
}).ToList();
|
||
|
||
foreach (var robot in robotData)
|
||
{
|
||
var items = result.Where(f => f.rid == robot.id).ToList();
|
||
foreach (var item in items)
|
||
{
|
||
item.robot_name = robot.name;
|
||
item.robot_nick = robot.nick;
|
||
}
|
||
}
|
||
|
||
stopWatch1.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"A-1执行时间:{stopWatch1.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
#endregion
|
||
}
|
||
|
||
stopWatch.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"A执行时间:{stopWatch.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
return new PageControl.SerchResult() { Result = result, Total = totalNumber };
|
||
}, gridControl2, 40, true, true);
|
||
IsInitYiJingDuiHuan = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsInitYiJingDuiHuan = false;
|
||
BaseForm.ShowError(ex);
|
||
}
|
||
|
||
label2.Visible = gridView2.RowCount == 0;
|
||
|
||
#endregion
|
||
}
|
||
|
||
private bool IsInitNotDuiHuan = false;
|
||
|
||
private void NotDuiHuan()
|
||
{
|
||
#region 未兑换列表
|
||
try
|
||
{
|
||
pageControl3.Bind((page, size) =>
|
||
{
|
||
var stopWatch = new Stopwatch();
|
||
stopWatch.Start();
|
||
|
||
var keyword = textBox3.Text.Replace("'", "''").Trim();
|
||
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
||
var session = ApiClient.GetSession();
|
||
if (!string.IsNullOrWhiteSpace(keyword))
|
||
{
|
||
List<string> member_ids = new List<string>();
|
||
switch (comboBoxEdit4.Text)
|
||
{
|
||
case "客户账号":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "username", ConditionalType = ConditionalType.Like, FieldValue = keyword } }).Select(f => f.id.ToString()).ToList();//模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户昵称":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "usernick", ConditionalType = ConditionalType.Like, FieldValue = keyword } }).Select(f => f.id.ToString()).ToList();//模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户备注":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "remark", ConditionalType = ConditionalType.Like, FieldValue = keyword } }).Select(f => f.id.ToString()).ToList();//模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户编号":
|
||
{
|
||
member_ids.Add(keyword);
|
||
}
|
||
break;
|
||
case "支付宝账号":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "alipay_num", ConditionalType = ConditionalType.Like, FieldValue = keyword } }).Select(f => f.id.ToString()).ToList();//模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "支付宝姓名":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "alipay_name", ConditionalType = ConditionalType.Like, FieldValue = keyword } }).Select(f => f.id.ToString()).ToList();//模糊查询的用户id集合
|
||
}
|
||
break;
|
||
}
|
||
if (member_ids.Count == 1)
|
||
conModels.Add(new ConditionalModel() { FieldName = "uid", ConditionalType = ConditionalType.Equal, FieldValue = member_ids[0] });
|
||
else if (member_ids.Count == 0)
|
||
conModels.Add(new ConditionalModel() { FieldName = "uid", ConditionalType = ConditionalType.Equal, FieldValue = "-1" });
|
||
else
|
||
conModels.Add(new ConditionalModel() { FieldName = "uid", ConditionalType = ConditionalType.In, FieldValue = string.Join(",", member_ids) });
|
||
}
|
||
|
||
if (checkBox2.Checked)
|
||
{
|
||
//where += " and '" + dateTimePicker6.Value.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' <= e.time and e.time < '" + dateTimePicker5.Value.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||
|
||
conModels.Add(new ConditionalModel() { FieldName = "time", ConditionalType = ConditionalType.GreaterThanOrEqual, FieldValue = dateTimePicker6.Value.Date.ToString("yyyy-MM-dd HH:mm:ss") });
|
||
conModels.Add(new ConditionalModel() { FieldName = "time", ConditionalType = ConditionalType.LessThan, FieldValue = dateTimePicker5.Value.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss") });
|
||
}
|
||
|
||
if (comboBoxEdit1.SelectedIndex != 0)
|
||
{
|
||
var robotIds = session.FindRobots().Where(f => f.name == comboBoxEdit2.Text.Trim()).Select(f => f.id).ToList();
|
||
if (robotIds != null)
|
||
{
|
||
conModels.Add(new ConditionalModel() { FieldName = "rid", ConditionalType = ConditionalType.In, FieldValue = string.Join(",", robotIds) });
|
||
}
|
||
}
|
||
conModels.Add(new ConditionalModel() { FieldName = "state", ConditionalType = ConditionalType.Equal, FieldValue = "1" });
|
||
|
||
#region 统计未提现金额
|
||
var point = session.Queryable<fl_exchange_info>().Where(conModels).Sum(f => f.point);
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
gridView3.Columns["point"].SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Custom, point.ToString("0.00"));
|
||
}));
|
||
#endregion
|
||
|
||
int totalNumber = 0;//总数
|
||
|
||
var result = session.Queryable<fl_exchange_info>()
|
||
.Where(conModels)
|
||
.OrderBy(f => f.id, OrderByType.Desc)
|
||
.Select(f => new exchange_list_temp()
|
||
{
|
||
id = f.id,
|
||
groupid = f.groupid,
|
||
point = f.point,
|
||
remark = f.remark,
|
||
state = f.state,
|
||
time = f.time,
|
||
uid = f.uid,
|
||
rid = f.rid
|
||
//alipay_name = m.alipay_name,
|
||
//alipay_num = m.alipay_num,
|
||
//chattype = m.robot_type,
|
||
//identity_card = m.identity_card,
|
||
//identity_name = m.identity_name,
|
||
//member_remark = m.remark,
|
||
//username = m.username,
|
||
//usernick = m.usernick,
|
||
//robot_name = r.name,
|
||
//robot_nick = r.nick
|
||
}).ToPageList(page, size, ref totalNumber);
|
||
|
||
if (result.Count != 0)
|
||
{
|
||
#region 附加用户
|
||
var bindUsersList = result.Where(f => f.uid != 0).Select(f => f.uid.ToString()).Distinct().ToList();
|
||
var memberData = new List<fl_member_info>();
|
||
if (bindUsersList.Count != 0)
|
||
{
|
||
memberData = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.In, FieldValue = string.Join(",", bindUsersList) } }).ToList();
|
||
}
|
||
foreach (var member in memberData)
|
||
{
|
||
var items = result.Where(f => f.uid == member.id).ToList();
|
||
foreach (var item in items)
|
||
{
|
||
item.alipay_name = member.alipay_name;
|
||
item.alipay_num = member.alipay_num;
|
||
item.chattype = member.robot_type;
|
||
item.identity_card = member.identity_card;
|
||
item.identity_name = member.identity_name;
|
||
item.member_remark = member.remark;
|
||
item.username = member.username;
|
||
item.usernick = member.usernick;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 附加机器人信息
|
||
var robotList = result.Where(f => f.rid != 0).Select(f => f.rid.ToString()).Distinct().ToList();
|
||
var robotData = new List<fl_robot_info>();
|
||
if (robotList != null && robotList.Count != 0)
|
||
{
|
||
//robotData = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>() { session.WhereConditionaOrList("id", robotList) }).ToList();
|
||
robotData = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.In, FieldValue = string.Join(",", robotList) } }).ToList();
|
||
}
|
||
|
||
foreach (var robot in robotData)
|
||
{
|
||
var items = result.Where(f => f.rid == robot.id).ToList();
|
||
foreach (var item in items)
|
||
{
|
||
item.robot_name = robot.name;
|
||
item.robot_nick = robot.nick;
|
||
item.chattype = robot.type;
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
stopWatch.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"B执行时间:{stopWatch.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
return new PageControl.SerchResult() { Result = result, Total = totalNumber };
|
||
}, gridControl3, 40, true, true);
|
||
IsInitNotDuiHuan = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsInitNotDuiHuan = false;
|
||
BaseForm.ShowError(ex);
|
||
}
|
||
label3.Visible = gridView3.RowCount == 0;
|
||
|
||
#endregion
|
||
}
|
||
|
||
private bool IsInitShangHuView = false;
|
||
private void ShangHuView()
|
||
{
|
||
#region 加载商户链接信息列表
|
||
|
||
try
|
||
{
|
||
pageControl1.Bind((index, size) =>
|
||
{
|
||
var stopWatch = new Stopwatch();
|
||
stopWatch.Start();
|
||
|
||
var stopWatch2 = new Stopwatch();
|
||
stopWatch2.Start();
|
||
|
||
var keyword = textBox4.Text.Replace("'", "''").Trim();
|
||
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
||
var session = ApiClient.GetSession();
|
||
if (!string.IsNullOrWhiteSpace(keyword))
|
||
{
|
||
var isrobot = false;
|
||
List<string> member_ids = new List<string>();
|
||
List<string> robot_ids = new List<string>();
|
||
switch (comboBoxEdit6.Text)
|
||
{
|
||
case "客户账号":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "username", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户昵称":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "usernick", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户备注":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "remark", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户编号":
|
||
{
|
||
member_ids.Add(keyword);
|
||
}
|
||
break;
|
||
case "机器人编号":
|
||
{
|
||
isrobot = true;
|
||
robot_ids.Add(keyword);
|
||
}
|
||
break;
|
||
case "机器人账号":
|
||
{
|
||
isrobot = true;
|
||
robot_ids = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "name", ConditionalType = ConditionalType.Like, FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList();
|
||
}
|
||
break;
|
||
case "机器人昵称":
|
||
{
|
||
isrobot = true;
|
||
robot_ids = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "nick", ConditionalType = ConditionalType.Like, FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList();
|
||
}
|
||
break;
|
||
}
|
||
|
||
if (!isrobot)
|
||
{
|
||
if (member_ids.Count == 1)
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "uid",
|
||
ConditionalType = ConditionalType.Equal,
|
||
FieldValue = member_ids[0]
|
||
});
|
||
else if (member_ids.Count == 0)
|
||
conModels.Add(new ConditionalModel()
|
||
{ FieldName = "uid", ConditionalType = ConditionalType.Equal, FieldValue = "-1" });
|
||
else
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "uid",
|
||
ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", member_ids)
|
||
});
|
||
}
|
||
else
|
||
{
|
||
if (robot_ids.Count == 1)
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "rid",
|
||
ConditionalType = ConditionalType.Equal,
|
||
FieldValue = robot_ids[0]
|
||
});
|
||
else if (robot_ids.Count == 0)
|
||
conModels.Add(new ConditionalModel()
|
||
{ FieldName = "rid", ConditionalType = ConditionalType.Equal, FieldValue = "-1" });
|
||
else
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "rid",
|
||
ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", robot_ids)
|
||
});
|
||
}
|
||
}
|
||
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "ctime",
|
||
ConditionalType = ConditionalType.GreaterThanOrEqual,
|
||
FieldValue = HttpExtend.GetTimeStamp(dateTimePicker8.Value.Date).ObjToString()
|
||
});
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "ctime",
|
||
ConditionalType = ConditionalType.LessThanOrEqual,
|
||
FieldValue = HttpExtend.GetTimeStamp(dateTimePicker7.Value.Date.AddDays(1)).ToString()
|
||
});
|
||
|
||
if (comboBoxEdit7.SelectedIndex != 0)
|
||
{
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "chattype",
|
||
ConditionalType = ConditionalType.Equal,
|
||
FieldValue = (comboBoxEdit7.SelectedIndex - 1).ToString()
|
||
});
|
||
}
|
||
|
||
if (comboBoxEdit8.SelectedIndex != 0)
|
||
{
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "paytype",
|
||
ConditionalType = ConditionalType.Equal,
|
||
FieldValue = (comboBoxEdit8.SelectedIndex - 1).ToString()
|
||
});
|
||
}
|
||
|
||
stopWatch2.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"D-1执行时间:{stopWatch2.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
var stopWatch3 = new Stopwatch();
|
||
stopWatch3.Start();
|
||
|
||
int totalNumber = 0; //总数
|
||
|
||
var result = session.Queryable<fl_shpay_hist>()
|
||
.Where(conModels)
|
||
.OrderBy(f => f.id, OrderByType.Desc)
|
||
.Select(f => new shpay_temp()
|
||
{
|
||
id = f.id,
|
||
chattype = f.chattype,
|
||
point = f.point,
|
||
ctime = f.ctime,
|
||
paytime = f.paytime,
|
||
uid = f.uid,
|
||
rid = f.rid,
|
||
paytype = f.paytype,
|
||
payurl = f.payurl,
|
||
ctimedate = f.ctimedate,
|
||
orderid = f.orderid,
|
||
sendtime = f.sendtime,
|
||
robot_name = f.robotname,
|
||
robot_nick = f.robotnick,
|
||
username = f.username,
|
||
usernick = f.usernick
|
||
}).ToPageList(index, size, ref totalNumber);
|
||
|
||
stopWatch3.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"D-2执行时间:{stopWatch3.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
if (result.Count != 0)
|
||
{
|
||
#region 这里获取远程获取商户链接领取状态
|
||
|
||
var stopWatch4 = new Stopwatch();
|
||
stopWatch4.Start();
|
||
var resultTmp = result.Where(f => f.paytype == PayGetType.未领取).ToList();
|
||
|
||
if (resultTmp.Count != 0)
|
||
{
|
||
List<string> yjPayList = new List<string>(); //已经领取的连接
|
||
var timedate = resultTmp.GroupBy(f => f.ctimedate).Select(f => f.Key).ToList();
|
||
foreach (var date in timedate)
|
||
{
|
||
var html = string.Empty;
|
||
try
|
||
{
|
||
var arr = resultTmp.Where(f => f.ctimedate == date)
|
||
.Select(f => "\"" + f.orderid + "\"").ToList();
|
||
if (arr.Count() != 0)
|
||
{
|
||
string parm = "orders=[" + string.Join(",", arr) + $"]&time={date}";
|
||
|
||
HttpHelper http = new HttpHelper();
|
||
HttpItem item = new HttpItem()
|
||
{
|
||
URL = "https://pay.api.52cmg.cn/pay/CheckOrders",
|
||
Method = "POST",
|
||
Timeout = 100000,
|
||
ReadWriteTimeout = 30000,
|
||
IsToLower = false,
|
||
Cookie = "",
|
||
UserAgent =
|
||
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",
|
||
Accept = "text/html, application/xhtml+xml, */*",
|
||
ContentType = "application/json",
|
||
Referer = "",
|
||
Allowautoredirect = false,
|
||
AutoRedirectCookie = false,
|
||
Postdata = parm,
|
||
ResultType = ResultType.String,
|
||
};
|
||
html = http.GetHtml(item).Html;
|
||
|
||
//{"ok":true,"res":"7d043f8e8e4be0784a596a25cbc078fb|未支付\r\n144a00f52c271c39513937c252a54ef6|已支付"}
|
||
|
||
var shResult = JsonConvert.DeserializeObject<shpayResult>(html);
|
||
if (shResult != null && shResult.ok)
|
||
{
|
||
var regs = Regex.Split(shResult.res, @"[\r\n]")
|
||
.Where(f => !string.IsNullOrWhiteSpace(f)).ToList();
|
||
if (regs.Count == 0) continue;
|
||
|
||
foreach (var tmp in regs)
|
||
{
|
||
var split = tmp.Split(new string[] { "|" },
|
||
StringSplitOptions.RemoveEmptyEntries);
|
||
var r = result.FirstOrDefault(f => split[0] == f.orderid);
|
||
if (r != null)
|
||
{
|
||
r.paytype = split[1] == "已支付" ? PayGetType.已领取 : PayGetType.未领取;
|
||
if (r.paytype == PayGetType.已领取)
|
||
yjPayList.Add(split[0]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
EventClient.OnEvent("", $"商户状态查询异常:{ex.Message} - {ex.StackTrace} , {html}");
|
||
}
|
||
}
|
||
|
||
#region 修改数据库中的状态
|
||
|
||
if (yjPayList.Count != 0)
|
||
{
|
||
try
|
||
{
|
||
var shpayList = new List<fl_shpay_hist>();
|
||
foreach (var item in yjPayList)
|
||
{
|
||
var shpay = session.FindSingle<fl_shpay_hist>("orderid = @orderid",
|
||
new { orderid = item });
|
||
if (shpay != null)
|
||
{
|
||
shpay.paytime = HttpExtend.GetTimeStamp(DateTime.Now);
|
||
shpay.paytype = PayGetType.已领取;
|
||
shpayList.Add(shpay);
|
||
}
|
||
}
|
||
|
||
if (shpayList.Count != 0)
|
||
session.Updateable(shpayList).ExecuteCommand();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
EventClient.OnEvent("", $"商户状态修改异常:{ex.Message} - {ex.StackTrace}");
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
}
|
||
|
||
stopWatch4.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"D-4执行时间:{stopWatch4.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
#endregion
|
||
|
||
if (comboBoxEdit8.SelectedIndex == 1)
|
||
result = result.Where(f => f.paytype == PayGetType.未领取).ToList();
|
||
else if (comboBoxEdit8.SelectedIndex == 2)
|
||
result = result.Where(f => f.paytype == PayGetType.已领取).ToList();
|
||
|
||
#region 附加用户xxx
|
||
|
||
//var bindUsersList = result.Where(f => f.uid != 0).Select(f => f.uid.ToString()).ToList();
|
||
//var memberData = new List<fl_member_info>();
|
||
//if (bindUsersList != null && bindUsersList.Count != 0)
|
||
//{
|
||
// memberData = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.In, FieldValue = string.Join(",", bindUsersList) } }).ToList();
|
||
//}
|
||
|
||
//foreach (var member in memberData)
|
||
//{
|
||
// var items = result.Where(f => f.uid == member.id).ToList();
|
||
// foreach (var item in items)
|
||
// {
|
||
// item.remark = member.remark;
|
||
// item.chattype = member.robot_type;
|
||
// item.username = member.username;
|
||
// item.usernick = member.usernick;
|
||
// }
|
||
//}
|
||
|
||
#endregion
|
||
|
||
#region 附加机器人信息xxx
|
||
|
||
//var robotList = result.Where(f => f.rid != 0).Select(f => f.rid.ToString()).ToList();
|
||
//var robotData = new List<fl_robot_info>();
|
||
//if (robotList != null && robotList.Count != 0)
|
||
// robotData = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>() { new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.In, FieldValue = string.Join(",", robotList) } }).ToList();
|
||
|
||
//foreach (var robot in robotData)
|
||
//{
|
||
// var items = result.Where(f => f.rid == robot.id).ToList();
|
||
// foreach (var item in items)
|
||
// {
|
||
// item.robot_name = robot.name;
|
||
// item.robot_nick = robot.nick;
|
||
// }
|
||
//}
|
||
|
||
#endregion
|
||
}
|
||
|
||
stopWatch.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"D执行时间:{stopWatch.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
return new PageControl.SerchResult() { Result = result, Total = totalNumber };
|
||
}, gridControl1, 40, true, true);
|
||
IsInitShangHuView = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsInitShangHuView = false;
|
||
BaseForm.ShowError(ex);
|
||
}
|
||
label1.Visible = gridView1.RowCount == 0;
|
||
|
||
#endregion
|
||
}
|
||
|
||
private bool IsInitJiFenRecord = false;
|
||
|
||
private void JiFenRecord()
|
||
{
|
||
#region 用户积分兑换日志
|
||
|
||
try
|
||
{
|
||
pageControl4.Bind((page, size) =>
|
||
{
|
||
var stopWatch = new Stopwatch();
|
||
stopWatch.Start();
|
||
|
||
var keyword = textBox1.Text.Replace("'", "''").Trim();
|
||
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
if (comboBox1.SelectedIndex != 0)
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "type",
|
||
ConditionalType = ConditionalType.Equal,
|
||
FieldValue = comboBox1.Text
|
||
});
|
||
}));
|
||
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "crt_time",
|
||
ConditionalType = ConditionalType.GreaterThan,
|
||
FieldValue = dateTimePicker1.Value.AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss")
|
||
});
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "crt_time",
|
||
ConditionalType = ConditionalType.LessThanOrEqual,
|
||
FieldValue = dateTimePicker2.Value.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss")
|
||
});
|
||
|
||
var session = ApiClient.GetSession();
|
||
|
||
if (!string.IsNullOrWhiteSpace(keyword))
|
||
{
|
||
List<string> member_ids = new List<string>();
|
||
switch (comboBoxEdit3.Text)
|
||
{
|
||
case "客户账号":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "username", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户昵称":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "usernick", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户备注":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "remark", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "客户编号":
|
||
{
|
||
member_ids.Add(keyword);
|
||
}
|
||
break;
|
||
case "支付宝账号":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "alipay_num", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
case "支付宝姓名":
|
||
{
|
||
member_ids = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "alipay_name", ConditionalType = ConditionalType.Like,
|
||
FieldValue = keyword
|
||
}
|
||
}).Select(f => f.id.ToString()).ToList(); //模糊查询的用户id集合
|
||
}
|
||
break;
|
||
}
|
||
|
||
if (member_ids.Count == 1)
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "uid",
|
||
ConditionalType = ConditionalType.Equal,
|
||
FieldValue = member_ids[0]
|
||
});
|
||
else if (member_ids.Count == 0)
|
||
conModels.Add(new ConditionalModel()
|
||
{ FieldName = "uid", ConditionalType = ConditionalType.Equal, FieldValue = "-1" });
|
||
else
|
||
conModels.Add(new ConditionalModel()
|
||
{
|
||
FieldName = "uid",
|
||
ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", member_ids)
|
||
});
|
||
}
|
||
|
||
#region 统计积分日志金额
|
||
|
||
var point = session.Queryable<fl_point_hist>().Where(conModels).Sum(f => f.point);
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
gridView4.Columns["point"].SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Custom, point.ToString("0.00"));
|
||
}));
|
||
|
||
#endregion
|
||
|
||
int totalNumber = 0; //总记录数
|
||
|
||
var result = session.Queryable<fl_point_hist>()
|
||
.Where(conModels)
|
||
.OrderBy(p => p.id, OrderByType.Desc)
|
||
.Select<pointlog_list_temp>(p => new pointlog_list_temp()
|
||
{
|
||
after_point = p.after_point,
|
||
before_point = p.before_point,
|
||
crt_time = p.crt_time,
|
||
message = p.message,
|
||
point = p.point,
|
||
pointtype = p.type,
|
||
uid = p.uid,
|
||
rid = p.rid
|
||
//robot_name = r.name,
|
||
//robot_nick = r.nick,
|
||
//chattype = m.robot_type,
|
||
//username = m.username,
|
||
//usernick = m.usernick
|
||
}).ToPageList(page, size, ref totalNumber);
|
||
|
||
if (result.Count != 0)
|
||
{
|
||
#region 附加用户
|
||
|
||
var bindUsersList = result.Where(f => f.uid != 0).Select(f => f.uid.ToString()).Distinct()
|
||
.ToList();
|
||
var memberData = new List<fl_member_info>();
|
||
if (bindUsersList != null && bindUsersList.Count != 0)
|
||
{
|
||
memberData = session.Queryable<fl_member_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "id", ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", bindUsersList)
|
||
}
|
||
}).ToList();
|
||
}
|
||
|
||
foreach (var member in memberData)
|
||
{
|
||
var items = result.Where(f => f.uid == member.id).ToList();
|
||
foreach (var item in items)
|
||
{
|
||
item.chattype = member.robot_type;
|
||
item.username = member.username;
|
||
item.usernick = member.usernick;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 附加机器人信息
|
||
|
||
var robotList = result.Where(f => f.rid != 0).Select(f => f.rid.ToString()).Distinct().ToList();
|
||
var robotData = new List<fl_robot_info>();
|
||
if (robotList.Count != 0)
|
||
{
|
||
//robotData = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>() { session.WhereConditionaOrList("id", robotList) }).ToList();
|
||
robotData = session.Queryable<fl_robot_info>().Where(new List<IConditionalModel>()
|
||
{
|
||
new ConditionalModel()
|
||
{
|
||
FieldName = "id", ConditionalType = ConditionalType.In,
|
||
FieldValue = string.Join(",", robotList)
|
||
}
|
||
}).ToList();
|
||
}
|
||
|
||
foreach (var robot in robotData)
|
||
{
|
||
var items = result.Where(f => f.rid == robot.id).ToList();
|
||
foreach (var item in items)
|
||
{
|
||
item.robot_name = robot.name;
|
||
item.robot_nick = robot.nick;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
|
||
stopWatch.Stop();
|
||
LogHelper.GetSingleObj().Info("", $"C执行时间:{stopWatch.Elapsed.TotalSeconds.ToString("0.0000")}");
|
||
|
||
return new PageControl.SerchResult() { Result = result, Total = totalNumber };
|
||
}, gridControl4, 40, true, true);
|
||
|
||
IsInitJiFenRecord = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsInitJiFenRecord = false;
|
||
BaseForm.ShowError(ex);
|
||
}
|
||
label4.Visible = gridView4.RowCount == 0;
|
||
|
||
#endregion
|
||
}
|
||
|
||
private void point_manage_control_Load(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
memoEdit1.Text = ApiClient.Setting.SystemConfig.send_shpay_msg;
|
||
checkEdit1.Checked = ApiClient.Setting.SystemConfig.send_shpay_switch;
|
||
checkEdit2.Checked = ApiClient.Setting.SystemConfig.send_shpay_minixml;
|
||
comboBoxEdit8.SelectedIndex = 0;
|
||
|
||
#region 增加平台类型
|
||
this.comboBoxEdit7.Properties.Items.Clear();
|
||
|
||
var objList1 = new List<object>() { "全部平台" };
|
||
|
||
foreach (ChatType chat in Enum.GetValues(typeof(ChatType)))
|
||
{
|
||
objList1.Add(chat.ToString());
|
||
}
|
||
this.comboBoxEdit7.Properties.Items.AddRange(objList1);
|
||
comboBoxEdit7.SelectedIndex = 0;
|
||
#endregion
|
||
|
||
#region 增加所有的机器人账号
|
||
this.comboBoxEdit2.Properties.Items.Clear();
|
||
//var weixinBases = Chat.Framework.ChatClient.WXClient.Values.ToList();
|
||
var robots = ApiClient.GetSession().FindRobots();
|
||
var objList = new List<object>() { "全部平台" };
|
||
foreach (var item in robots)
|
||
{
|
||
objList.Add(item.name);
|
||
}
|
||
|
||
var qqBases = Chat.Framework.ChatClient.QQClients.Values;
|
||
foreach (var item in qqBases)
|
||
{
|
||
objList.Add(item.QQ.ToString());
|
||
}
|
||
|
||
this.comboBoxEdit2.Properties.Items.AddRange(objList);
|
||
this.comboBoxEdit1.Properties.Items.AddRange(objList);
|
||
comboBoxEdit1.SelectedIndex = comboBoxEdit2.SelectedIndex = 0;
|
||
#endregion
|
||
|
||
#region 用户积分使用类型
|
||
comboBox1.Items.Clear();
|
||
comboBox1.Items.Add("选择全部");
|
||
comboBox1.SelectedIndex = 0;
|
||
foreach (PointType item in Enum.GetValues(typeof(PointType)))
|
||
{
|
||
comboBox1.Items.Add(item);
|
||
}
|
||
#endregion
|
||
|
||
NotDuiHuan();
|
||
|
||
dateTimePicker4.Value = DateTime.Today.AddDays(-10);
|
||
dateTimePicker3.Value = DateTime.Today;
|
||
checkBox1.Checked = true;
|
||
|
||
#region
|
||
if (query_type == "积分日志")
|
||
{
|
||
textBox1.Text = username;
|
||
comboBox1.SelectedIndex = 0;
|
||
comboBoxEdit3.SelectedIndex = 1;
|
||
}
|
||
else if (query_type == "未兑换提现")
|
||
{
|
||
textBox3.Text = username;
|
||
comboBoxEdit1.SelectedIndex = 0;
|
||
comboBoxEdit4.SelectedIndex = 1;
|
||
}
|
||
else if (query_type == "已兑换提现")
|
||
{
|
||
textBox2.Text = username;
|
||
comboBoxEdit2.SelectedIndex = 0;
|
||
comboBoxEdit5.SelectedIndex = 1;
|
||
}
|
||
#endregion
|
||
|
||
dateTimePicker1.Value = DateTime.Today.AddDays(-10);
|
||
dateTimePicker2.Value = DateTime.Today;
|
||
|
||
#region
|
||
if (query_type == "积分日志")
|
||
xtraTabControl1.SelectedTabPageIndex = 2;
|
||
else if (query_type == "未兑换提现")
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
else if (query_type == "已兑换提现")
|
||
xtraTabControl1.SelectedTabPageIndex = 0;
|
||
#endregion
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||
}
|
||
MainEvent.CommonEvents += MainEvent_CommonEvents;
|
||
this.Disposed += Control_Disposed;
|
||
}
|
||
|
||
|
||
|
||
private void Control_Disposed(object sender, EventArgs e)
|
||
{
|
||
MainEvent.CommonEvents -= MainEvent_CommonEvents;
|
||
tokenSource.Cancel();
|
||
}
|
||
|
||
private void comboBoxEdit3_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
if (comboBoxEdit3.SelectedIndex == 0)
|
||
{
|
||
this.textBox1.Enabled = false;
|
||
this.textBox1.Text = "";
|
||
}
|
||
else this.textBox1.Enabled = true;
|
||
}
|
||
|
||
private void comboBoxEdit5_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
if (comboBoxEdit5.SelectedIndex == 0)
|
||
{
|
||
this.textBox2.Enabled = false;
|
||
this.textBox2.Text = "";
|
||
}
|
||
else this.textBox2.Enabled = true;
|
||
}
|
||
|
||
private void comboBoxEdit4_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
if (comboBoxEdit4.SelectedIndex == 0)
|
||
{
|
||
this.textBox3.Enabled = false;
|
||
this.textBox3.Text = "";
|
||
}
|
||
else this.textBox3.Enabled = true;
|
||
}
|
||
|
||
private void contextMenuStrip3_Opening(object sender, CancelEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
var rows = this.gridView4.GetSelectedRows();
|
||
if (rows != null && rows.Length > 0)
|
||
{ }
|
||
else
|
||
e.Cancel = true;
|
||
}
|
||
catch (Exception)
|
||
{ }
|
||
}
|
||
|
||
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
|
||
{
|
||
try
|
||
{
|
||
int rows = 0;
|
||
if (xtraTabControl1.SelectedTabPageIndex == 0)
|
||
{
|
||
rows = this.gridView2.GetSelectedRows().Length;
|
||
一键审核勾选项ToolStripMenuItem.Visible = false;
|
||
}
|
||
else
|
||
{
|
||
rows = this.gridView3.GetFocusedDataSourceRowIndex() + 1;
|
||
一键审核勾选项ToolStripMenuItem.Visible = true;
|
||
}
|
||
if (rows > 0)
|
||
{ }
|
||
else
|
||
e.Cancel = true;
|
||
}
|
||
catch (Exception)
|
||
{ }
|
||
}
|
||
|
||
#region 商户连接列表
|
||
private void simpleButton4_Click(object sender, EventArgs e)
|
||
{
|
||
this.pageControl1.GotoPage();
|
||
label1.Visible = gridView1.RowCount == 0;
|
||
}
|
||
|
||
#endregion
|
||
|
||
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
||
{
|
||
switch (e.Column.Caption)
|
||
{
|
||
case "生成时间":
|
||
case "领取时间":
|
||
e.DisplayText = HttpExtend.GetDateTime(e.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
|
||
break;
|
||
//case "二级提成":
|
||
// e.DisplayText = HttpExtend.JsonToDictionary(e.Value.ToString())["AwardTwo"].ToString();
|
||
// break;
|
||
//case "三级提成":
|
||
// {
|
||
// var result = HttpExtend.JsonToDictionary(e.Value.ToString());
|
||
// e.DisplayText = (result != null && result.ContainsKey("AwardThree")) ? result["AwardThree"].ToString() : "0";
|
||
// }
|
||
// break;
|
||
//case "群负责人提成":
|
||
// e.DisplayText = HttpExtend.JsonToDictionary(e.Value.ToString())["AwardCreate"].ToString();
|
||
// break;
|
||
default:
|
||
{
|
||
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
private void comboBoxEdit6_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
if (comboBoxEdit6.SelectedIndex == 0)
|
||
{
|
||
this.textBox4.Enabled = false;
|
||
this.textBox4.Text = "";
|
||
}
|
||
else this.textBox4.Enabled = true;
|
||
}
|
||
|
||
private static bool IsRunSend = false;
|
||
|
||
private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
||
{
|
||
var rownumber = gridView1.GetSelectedRows().ToList();//获取选中行号;
|
||
if (rownumber != null & rownumber.Count != 0)
|
||
{
|
||
if (IsRunSend)
|
||
{
|
||
BaseForm.ShowErrorAutoClose("已经有在运行的任务,请稍后重试~!");
|
||
return;
|
||
}
|
||
IsRunSend = true;
|
||
try
|
||
{
|
||
var shpayList = new List<fl_shpay_hist>();
|
||
foreach (var item in rownumber)
|
||
{
|
||
var row = gridView1.GetRow(item) as shpay_temp;
|
||
if (row == null || row.paytype == PayGetType.已领取) continue;
|
||
shpayList.Add(new fl_shpay_hist()
|
||
{
|
||
id = row.id,
|
||
chattype = row.chattype,
|
||
point = row.point,
|
||
ctime = row.ctime,
|
||
paytime = row.paytime,
|
||
uid = row.uid,
|
||
rid = row.rid,
|
||
paytype = row.paytype,
|
||
payurl = row.payurl,
|
||
ctimedate = row.ctimedate,
|
||
orderid = row.orderid,
|
||
sendtime = row.sendtime,
|
||
robotname = row.robot_name,
|
||
robotnick = row.robot_nick,
|
||
username = row.username,
|
||
usernick = row.usernick
|
||
});
|
||
}
|
||
|
||
if (shpayList.Count != 0)
|
||
{
|
||
if (XtraMessageBox.Show($"勾选项中未领取的用户有:{shpayList.Count}位,是否立即给客户发送领取消息?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) return;
|
||
|
||
Utils.SendShPayMes(shpayList);
|
||
|
||
EventClient.OnEvent("", $"商户未领取的用户通知完毕~!");
|
||
}
|
||
else
|
||
{
|
||
BaseForm.ShowSuccessAutoClose("勾选项中没有存在未领取的用户,操作无效~!");
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
BaseForm.ShowErrorAutoClose(ex, 10000);
|
||
}
|
||
finally
|
||
{
|
||
IsRunSend = false;
|
||
}
|
||
}
|
||
else
|
||
BaseForm.ShowErrorAutoClose("请勾选后操作~!");
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
ApiClient.Setting.SystemConfig.send_shpay_msg = memoEdit1.Text;
|
||
ApiClient.Setting.SystemConfig.send_shpay_switch = checkEdit1.Checked;
|
||
ApiClient.Setting.SystemConfig.send_shpay_minixml = checkEdit2.Checked;
|
||
ApiClient.Setting.Save();
|
||
MessageBox.Show("保存成功~!");
|
||
}
|
||
|
||
private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||
{
|
||
var ll = sender as LinkLabel;
|
||
memoEdit1.Text += (ll != null ? ll.Text.Trim() : string.Empty);
|
||
}
|
||
|
||
private static bool IsRunExchange = false;
|
||
|
||
private void OneKeyToolStripMenuItem_Click(object sender, EventArgs e)
|
||
{
|
||
if (IsRunExchange)
|
||
{
|
||
BaseForm.ShowErrorAutoClose("已经有在运行的任务,请稍后重试~!");
|
||
return;
|
||
}
|
||
IsRunExchange = true;
|
||
|
||
try
|
||
{
|
||
var item = sender as ToolStripMenuItem;
|
||
if (item == null) throw new Exception("未知异常");
|
||
|
||
var rowNum = gridView3.GetSelectedRows().ToList();//获取选中行号;
|
||
if (rowNum == null || rowNum.Count == 0) throw new Exception("未勾选执行项~!");
|
||
if (XtraMessageBox.Show($"确定要一键处理:{rowNum.Count}个审核项吗?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) return;
|
||
|
||
var exchangeList = new List<exchange_list_temp>();
|
||
foreach (var row in rowNum)
|
||
{
|
||
var temp = gridView3.GetRow(row) as exchange_list_temp;
|
||
if (temp != null)
|
||
exchangeList.Add(temp);
|
||
}
|
||
if (exchangeList != null && exchangeList.Count != 0)
|
||
new OneKeyExchangeForm(exchangeList, item.Text).ShowDialog();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
BaseForm.ShowErrorAutoClose(ex, 10000);
|
||
}
|
||
finally
|
||
{
|
||
IsRunExchange = false;
|
||
}
|
||
this.pageControl3.GotoPage();
|
||
label3.Visible = gridView3.RowCount == 0;
|
||
}
|
||
|
||
private void xtraTabControl1_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
}
|
||
}
|