1006 lines
45 KiB
C#
1006 lines
45 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Drawing;
|
|||
|
using System.Data;
|
|||
|
using System.Text;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
using DevExpress.XtraEditors;
|
|||
|
using Api.Framework.Enums;
|
|||
|
using Api.Framework.Tools;
|
|||
|
using CsharpHttpHelper;
|
|||
|
using Api.Framework;
|
|||
|
using FLSystem.Events;
|
|||
|
using System.Threading;
|
|||
|
using Api.Framework.Events;
|
|||
|
using Api.Framework.SDK;
|
|||
|
using Api.Framework.Timers;
|
|||
|
using Api.Framework.Model;
|
|||
|
using SqlSugar;
|
|||
|
using UI.Framework.Forms;
|
|||
|
using Chat.Framework;
|
|||
|
|
|||
|
namespace FLSystem.Forms
|
|||
|
{
|
|||
|
public partial class cps_order_weipinhui : DevExpress.XtraEditors.XtraUserControl
|
|||
|
{
|
|||
|
public cps_order_weipinhui()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
public class view_cps_order_weipinhui
|
|||
|
{
|
|||
|
public long id { get; set; }
|
|||
|
public string orderSn { get; set; }
|
|||
|
public SystemOrderStatus db_status { get; set; }
|
|||
|
|
|||
|
private string _robotname;
|
|||
|
/// <summary>
|
|||
|
/// 机器人账号
|
|||
|
/// </summary>
|
|||
|
public string robotname
|
|||
|
{
|
|||
|
get { return _robotname; }
|
|||
|
set { if (string.IsNullOrEmpty(value)) _robotname = string.Empty; else _robotname = value; }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 机器人昵称
|
|||
|
/// </summary>
|
|||
|
public string robotnick { get; set; }
|
|||
|
|
|||
|
private string _username;
|
|||
|
public string username
|
|||
|
{
|
|||
|
get { return _username; }
|
|||
|
set { if (string.IsNullOrEmpty(value)) _username = string.Empty; else _username = value; }
|
|||
|
}
|
|||
|
|
|||
|
private string _usernick;
|
|||
|
public string usernick
|
|||
|
{
|
|||
|
get { return _usernick; }
|
|||
|
set { if (string.IsNullOrEmpty(value)) _usernick = string.Empty; else _usernick = value; }
|
|||
|
}
|
|||
|
|
|||
|
public long db_userid { get; set; }
|
|||
|
|
|||
|
public string db_point { get; set; }
|
|||
|
public string db_cpsname { get; set; }
|
|||
|
public string db_cpsnick { get; set; }
|
|||
|
public DateTime db_endtime { get; set; }
|
|||
|
public string mallId { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 是否自推自买 0-否,1-是
|
|||
|
/// </summary>
|
|||
|
public WeipinhuiShiFou selfBuy { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 下单时间 时间戳 单位毫秒
|
|||
|
/// </summary>
|
|||
|
public long orderTime { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 商品id
|
|||
|
/// </summary>
|
|||
|
public string goodsId { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 商品名称
|
|||
|
/// </summary>
|
|||
|
public string goodsName { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 商品数量
|
|||
|
/// </summary>
|
|||
|
public int goodsCount { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 商品成交价(元,保留两位小数,商品成交价上线之后的订单才有该值)
|
|||
|
/// </summary>
|
|||
|
public double goodsFinalPrice { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 商品计佣金额(元,保留两位小数)
|
|||
|
/// </summary>
|
|||
|
public double commissionTotalCost { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 商品佣金比例(%)
|
|||
|
/// </summary>
|
|||
|
public double commissionRate { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 商品佣金金额(元,保留两位小数)
|
|||
|
/// </summary>
|
|||
|
public double commission { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 推广PID:目前等同于channelTag
|
|||
|
/// </summary>
|
|||
|
public string pid { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 售后订单佣金变动:仅在订单完结之后发生售后行为时返回
|
|||
|
/// </summary>
|
|||
|
public string afterSaleChangeCommission { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// 售后订单总商品数量变动:仅在订单完结之后发生售后行为时返回
|
|||
|
/// </summary>
|
|||
|
public string afterSaleChangeGoodsCount { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 是否预付订单:0-否,1-是
|
|||
|
/// </summary>
|
|||
|
public WeipinhuiShiFou isPrepay { get; set; }
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 订单归因方式:0-常规推广,1-惊喜红包,2-锁粉,3-超级红包
|
|||
|
/// </summary>
|
|||
|
public WeipinhuiGuiYin orderTrackReason { get; set; }
|
|||
|
|
|||
|
public string sizeId { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
private void cps_order_weipinhui_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
simpleButton1_Click(this.simpleButton1, null);
|
|||
|
}
|
|||
|
|
|||
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.pageControl1.Go(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
public cps_order_weipinhui(string textedit = "")
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.textEdit1.Text = textedit;
|
|||
|
this.comboBoxEdit1.SelectedIndex = string.IsNullOrEmpty(textedit) ? 0 : 5;
|
|||
|
this.checkBox1.Checked = false;
|
|||
|
this.gridView1.CustomDrawRowIndicator += gridView1_CustomDrawRowIndicator;
|
|||
|
|
|||
|
#region 增加所有的机器人账号
|
|||
|
this.comboBoxEdit3.Properties.Items.Clear();
|
|||
|
var weixinBases = Chat.Framework.ChatClient.WXClient.Values.ToList();
|
|||
|
var objList = new List<object>() { "全部平台" };
|
|||
|
foreach (var item in weixinBases)
|
|||
|
{
|
|||
|
objList.Add(item.WeixinHao);
|
|||
|
}
|
|||
|
|
|||
|
var qqBases = ChatClient.QQClients.Values;
|
|||
|
foreach (var item in qqBases)
|
|||
|
{
|
|||
|
objList.Add(item.QQ.ToString());
|
|||
|
}
|
|||
|
|
|||
|
this.comboBoxEdit3.Properties.Items.AddRange(objList);
|
|||
|
comboBoxEdit3.SelectedIndex = 0;
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
this.pageControl1.Bind(delegate (int index, int pagesize)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
var isOld = true;
|
|||
|
List<view_cps_order_weipinhui> result = null;
|
|||
|
//List<IConditionalModel> conModels = new List<IConditionalModel>();
|
|||
|
var sqlwhere = string.Empty;
|
|||
|
if (this.checkBox1.Checked)
|
|||
|
{
|
|||
|
isOld = false;
|
|||
|
//sqlwhere += $" and '{this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss")}' <= orderTime and orderTime <= '{this.dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
|
|||
|
sqlwhere += $" and '{HttpExtend.GetTimeStamp(this.dateTimePicker1.Value)}000' <= orderTime and orderTime <= '{HttpExtend.GetTimeStamp(this.dateTimePicker2.Value)}000'";
|
|||
|
}
|
|||
|
|
|||
|
string where = string.Empty;
|
|||
|
string keyword = this.textEdit1.Text.Trim();
|
|||
|
if (!string.IsNullOrEmpty(keyword) || comboBoxEdit1.Text == "未绑定用户")
|
|||
|
{
|
|||
|
switch (this.comboBoxEdit1.Text)
|
|||
|
{
|
|||
|
case "订单编号":
|
|||
|
sqlwhere += $" and orderSn = '{keyword}'";
|
|||
|
break;
|
|||
|
case "商品编号":
|
|||
|
sqlwhere += $" and goodsId = '{keyword}'";
|
|||
|
break;
|
|||
|
case "商品标题":
|
|||
|
sqlwhere += $" and goodsName like '%{keyword}%'";
|
|||
|
break;
|
|||
|
case "客户编号":
|
|||
|
sqlwhere += $" and db_userid = '{keyword}'";
|
|||
|
break;
|
|||
|
case "客户账号":
|
|||
|
var ids = FindMemberIdByKey("username", keyword);
|
|||
|
if (ids != null)
|
|||
|
{
|
|||
|
if (ids.Count == 0)
|
|||
|
ids.Add("-1");
|
|||
|
sqlwhere += $" and db_userid in ('{string.Join("','", ids)}')";
|
|||
|
}
|
|||
|
break;
|
|||
|
case "客户昵称":
|
|||
|
ids = FindMemberIdByKey("usernick", keyword);
|
|||
|
if (ids != null)
|
|||
|
{
|
|||
|
if (ids.Count == 0)
|
|||
|
ids.Add("-1");
|
|||
|
sqlwhere += $" and db_userid in ('{string.Join("','", ids)}')";
|
|||
|
}
|
|||
|
break;
|
|||
|
case "店铺编码":
|
|||
|
sqlwhere += $" and mallId = '{keyword}'";
|
|||
|
break;
|
|||
|
case "推广位PID":
|
|||
|
sqlwhere += $" and pid = '{keyword}'";
|
|||
|
break;
|
|||
|
case "联盟账号":
|
|||
|
sqlwhere += $" and db_cpsname = '{keyword}'";
|
|||
|
break;
|
|||
|
case "联盟昵称":
|
|||
|
sqlwhere += $" and db_cpsnick = '{keyword}'";
|
|||
|
break;
|
|||
|
case "未绑定用户":
|
|||
|
sqlwhere += $" and db_userid = '0'";
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
var status = this.comboBoxEdit2.SelectedIndex == 0 ? SystemOrderStatus.订单未知 : Util.ConvertEnum<SystemOrderStatus>(this.comboBoxEdit2.Text);
|
|||
|
|
|||
|
if (status != SystemOrderStatus.订单未知)
|
|||
|
sqlwhere += $" and db_status = '{((int)status).ToString()}'";
|
|||
|
|
|||
|
if (this.comboBoxEdit3.SelectedIndex != 0)
|
|||
|
sqlwhere += $" and db_robotname = '{comboBoxEdit3.Text.Trim()}'";
|
|||
|
|
|||
|
//总记录数
|
|||
|
int totalNumber = 0;
|
|||
|
|
|||
|
if (isOld && checkBox_isOld.Checked)
|
|||
|
{
|
|||
|
//sqlwhere += $" and '{DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd HH:mm:ss")}' <= orderTime";
|
|||
|
sqlwhere += $" and '{HttpExtend.GetTimeStamp(DateTime.Now.AddYears(-1))}000' <= orderTime";
|
|||
|
}
|
|||
|
|
|||
|
sqlwhere += $" order by id desc";
|
|||
|
|
|||
|
var getCount = session.Find<int>("select count(*) from fl_order_weipinhui where 1=1 " + sqlwhere);
|
|||
|
if (getCount != null && getCount.Count != 0)
|
|||
|
totalNumber = getCount[0];
|
|||
|
|
|||
|
sqlwhere += $" limit {(index - 1) * pagesize},{pagesize}";
|
|||
|
|
|||
|
var resultTmp = session.Find<fl_order_weipinhui>("select * from fl_order_weipinhui where 1=1 " + sqlwhere);
|
|||
|
|
|||
|
result = new List<view_cps_order_weipinhui>();
|
|||
|
foreach (var o in resultTmp)
|
|||
|
{
|
|||
|
result.Add(new view_cps_order_weipinhui()
|
|||
|
{
|
|||
|
id = o.id,
|
|||
|
db_cpsname = o.db_cpsname,
|
|||
|
db_cpsnick = o.db_cpsnick,
|
|||
|
db_endtime = o.db_endtime,
|
|||
|
db_point = o.db_point,
|
|||
|
db_status = o.db_status,
|
|||
|
goodsId = o.goodsId,
|
|||
|
goodsName = o.goodsName,
|
|||
|
goodsFinalPrice = o.goodsFinalPrice,
|
|||
|
goodsCount = o.goodsCount,
|
|||
|
commissionRate = o.commissionRate,
|
|||
|
commissionTotalCost = o.commissionTotalCost,
|
|||
|
orderTime = o.orderTime,
|
|||
|
orderSn = o.orderSn,
|
|||
|
commission = o.commission,
|
|||
|
pid = o.pid,
|
|||
|
robotname = o.db_robotname,
|
|||
|
db_userid = o.db_userid,
|
|||
|
orderTrackReason = o.orderTrackReason,
|
|||
|
isPrepay = o.isPrepay,
|
|||
|
afterSaleChangeGoodsCount = o.afterSaleChangeGoodsCount,
|
|||
|
afterSaleChangeCommission = o.afterSaleChangeCommission,
|
|||
|
selfBuy = o.selfBuy,
|
|||
|
mallId = o.mallId,
|
|||
|
sizeId = o.sizeId
|
|||
|
//username = u.username,
|
|||
|
//usernick = u.usernick
|
|||
|
});
|
|||
|
}
|
|||
|
if (result.Count != 0)
|
|||
|
{
|
|||
|
#region 附加用户
|
|||
|
var bindUsersList = result.Where(f => f.db_userid != 0).Select(f => f.db_userid.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();
|
|||
|
int count = 1;
|
|||
|
foreach (var member in memberData)
|
|||
|
{
|
|||
|
count++;
|
|||
|
var items = result.Where(f => f.db_userid == member.id).ToList();
|
|||
|
|
|||
|
if (ApiClient.Setting.DbConfig.DatabaseType == DatabaseType.SQLITE && count % 10 == 0)
|
|||
|
Thread.Sleep(50);
|
|||
|
|
|||
|
foreach (var item in items)
|
|||
|
{
|
|||
|
item.usernick = member.usernick;
|
|||
|
item.username = member.username;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 附加机器人信息
|
|||
|
var robotList = result.Where(f => !string.IsNullOrWhiteSpace(f.robotname)).GroupBy(f => f.robotname).Select(f => f.Key).ToList();
|
|||
|
var robotData = session.FindRobots().Where(f => robotList.Contains(f.name)).ToList();
|
|||
|
foreach (var robot in robotData)
|
|||
|
{
|
|||
|
var items = result.Where(f => f.robotname == robot.name).ToList();
|
|||
|
foreach (var item in items)
|
|||
|
{
|
|||
|
item.robotnick = robot.nick;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
return new UI.Framework.Controls.PageControl.SerchResult() { Result = result, Total = totalNumber };
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
BaseForm.ShowError(ex);
|
|||
|
}
|
|||
|
return null;
|
|||
|
}, this.gridControl1, 50, false, true);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
if (!this.IsDisposed)
|
|||
|
BaseForm.ShowError(ex);
|
|||
|
}
|
|||
|
|
|||
|
MainEvent.CommonEvents += Main_CommonEvents;
|
|||
|
this.Disposed += Control_Disposed;
|
|||
|
}
|
|||
|
|
|||
|
private void Control_Disposed(object sender, EventArgs e)
|
|||
|
{
|
|||
|
MainEvent.CommonEvents -= Main_CommonEvents;
|
|||
|
}
|
|||
|
|
|||
|
private void Main_CommonEvents(object sender, CommonEvents e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (e.Commons != null && e.Commons.Count != 0)
|
|||
|
{
|
|||
|
if (e.Commons.ContainsKey("cps_type") && e.Commons.ContainsKey("username"))
|
|||
|
{
|
|||
|
var cps_type = (CpsType)int.Parse(e.Commons["cps_type"].ToString());
|
|||
|
if (cps_type == CpsType.唯品联盟)
|
|||
|
{
|
|||
|
textEdit1.Text = e.Commons["username"].ToString();
|
|||
|
comboBoxEdit1.SelectedIndex = 5;
|
|||
|
comboBoxEdit3.SelectedIndex = comboBoxEdit2.SelectedIndex = 0;
|
|||
|
checkBox1.Checked = false;
|
|||
|
pageControl1.GotoPage(1);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
if (!this.IsDisposed)
|
|||
|
BaseForm.ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
|
|||
|
{
|
|||
|
if (e.Info.IsRowIndicator && e.RowHandle >= 0) e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 条件查询(用户账号/用户昵称),模糊查询,获取用户的id
|
|||
|
/// </summary>
|
|||
|
/// <param name="type">查询的字段</param>
|
|||
|
/// <param name="keyword">模糊的关键词</param>
|
|||
|
/// <returns></returns>
|
|||
|
private List<string> FindMemberIdByKey(string type, string keyword)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
return session.Find<int>($"select id from fl_member_info where {type} like '%{keyword}%'").Select(f => f.ToString()).ToList();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{ }
|
|||
|
return new List<string>();
|
|||
|
}
|
|||
|
|
|||
|
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
{
|
|||
|
switch (e.Column.Caption)
|
|||
|
{
|
|||
|
case "软件状态":
|
|||
|
e.DisplayText = Util.ConvertEnum<SystemOrderStatus>(int.Parse(e.Value.ToString())).ToString();
|
|||
|
break;
|
|||
|
case "一级提成":
|
|||
|
e.DisplayText = HttpExtend.JsonToDictionary(e.Value.ToString().ToLower())["awardone"].ToString();
|
|||
|
break;
|
|||
|
case "二级提成":
|
|||
|
e.DisplayText = HttpExtend.JsonToDictionary(e.Value.ToString().ToLower())["awardtwo"].ToString();
|
|||
|
break;
|
|||
|
case "三级提成":
|
|||
|
{
|
|||
|
var result = HttpExtend.JsonToDictionary(e.Value.ToString().ToLower());
|
|||
|
if (result != null && result.ContainsKey("awardthree"))
|
|||
|
e.DisplayText = result["awardthree"].ToString();
|
|||
|
else
|
|||
|
e.DisplayText = "0";
|
|||
|
}
|
|||
|
break;
|
|||
|
case "群负责人提成":
|
|||
|
e.DisplayText = HttpExtend.JsonToDictionary(e.Value.ToString().ToLower())["awardcreate"].ToString();
|
|||
|
break;
|
|||
|
case "订单类型":
|
|||
|
e.DisplayText = e.Value.ToString();
|
|||
|
break;
|
|||
|
case "下单时间":
|
|||
|
e.DisplayText = Util.GetDateTime(long.Parse(e.Value.ToString())).ToString("yyyy-MM-dd HH:mm:ss");
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
|
|||
|
{
|
|||
|
var row = e.Row as view_cps_order_weipinhui;
|
|||
|
if (e.Column.Caption == "客户所得")
|
|||
|
{
|
|||
|
var point = CsharpHttpHelper.HttpHelper.JsonToObject<ItemPoint>(row.db_point) as ItemPoint;
|
|||
|
if (point != null)
|
|||
|
e.Value = point.UserPoint;
|
|||
|
else
|
|||
|
e.Value = 0;
|
|||
|
}
|
|||
|
else if (e.Column.Caption == "预付订单")
|
|||
|
e.Value = row.isPrepay.ToString();
|
|||
|
else if (e.Column.Caption == "自推自买")
|
|||
|
e.Value = row.selfBuy.ToString();
|
|||
|
}
|
|||
|
|
|||
|
private void 刷新ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.pageControl1.GotoPage(1);
|
|||
|
}
|
|||
|
|
|||
|
private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows.Length != 0)
|
|||
|
{
|
|||
|
var info = this.gridView1.GetRow(rows[0]) as view_cps_order_weipinhui;
|
|||
|
if (XtraMessageBox.Show("您确定要删除选中数据嘛?\r\n" + info.goodsName, "友情提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
session.ExcuteSQL("delete from fl_order_weipinhui where id=" + info.id);
|
|||
|
}
|
|||
|
this.pageControl1.GotoPage(1);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.textEdit1.Enabled = (comboBoxEdit1.SelectedIndex != 0 && comboBoxEdit1.SelectedIndex != 11);
|
|||
|
if (!textEdit1.Enabled)
|
|||
|
this.textEdit1.Text = string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.dateTimePicker1.Enabled = this.dateTimePicker2.Enabled = this.checkBox1.Checked;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 订单绑定
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void 绑定用户ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
//获取选中数据
|
|||
|
var row = this.gridView1.GetRow(rows[0]) as view_cps_order_weipinhui;
|
|||
|
var db_status = row.db_status;
|
|||
|
|
|||
|
if (db_status == SystemOrderStatus.订单失效 || db_status == SystemOrderStatus.订单结算 || db_status == SystemOrderStatus.全额退款 || db_status == SystemOrderStatus.部分退款)
|
|||
|
throw new Exception("该订单状态为已完结,不允许修改!");
|
|||
|
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
if (row.db_userid != 0)
|
|||
|
{
|
|||
|
var member = session.FindMemberInfoById(row.db_userid);
|
|||
|
if (member != null)
|
|||
|
{
|
|||
|
if (member.bind_order > 0)
|
|||
|
{
|
|||
|
member.bind_order--;
|
|||
|
member = session.UpdateMemberGroup(member);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
select_member_form select_form = new select_member_form();
|
|||
|
select_form.ShowDialog();
|
|||
|
if (select_form.fl_member_info != null)
|
|||
|
{
|
|||
|
var weipinhui = session.FindSingle<fl_order_weipinhui>("id = @id", new { id = row.id });
|
|||
|
if (weipinhui != null)
|
|||
|
{
|
|||
|
if (weipinhui.db_robottype == 0) weipinhui.db_robottype = select_form.fl_member_info.robot_type;
|
|||
|
if (string.IsNullOrWhiteSpace(weipinhui.db_robotname)) weipinhui.db_robotname = select_form.fl_member_info.robot_name;
|
|||
|
|
|||
|
var itempoint = session.FindItemPoint(select_form.fl_member_info, weipinhui.commission, weipinhui.goodsCount, CpsType.唯品联盟);
|
|||
|
if (itempoint != null)
|
|||
|
{
|
|||
|
weipinhui.db_point = HttpHelper.ObjectToJson(itempoint);
|
|||
|
weipinhui.db_userpoint = itempoint.UserPoint;
|
|||
|
}
|
|||
|
|
|||
|
weipinhui.db_userid = select_form.fl_member_info.id;
|
|||
|
session.SaveOrUpdate(weipinhui);
|
|||
|
|
|||
|
#region 获取查询时的比例
|
|||
|
var query_item = session.FindSingle<fl_query_hist>("userid=@userid and itemid=@itemid and adzoneid = @adzoneid and crt_time > @time order by id", new { userid = weipinhui.db_userid, itemid = weipinhui.goodsId, adzoneid = weipinhui.pid, time = DateTime.Now.AddHours(-24).ToString("yyyy-MM-dd HH:mm:ss") });
|
|||
|
if (query_item != null && !string.IsNullOrWhiteSpace(query_item.compute_configdic))
|
|||
|
{
|
|||
|
if (weipinhui.id == 0)
|
|||
|
session.SaveOrUpdate(weipinhui);
|
|||
|
var queryRatioHist = new fl_query_ratio_hist()
|
|||
|
{
|
|||
|
compute_config = query_item.compute_configdic,
|
|||
|
db_orderid = weipinhui.id,
|
|||
|
createtime = DateTime.Now,
|
|||
|
cpstype = CpsType.唯品联盟
|
|||
|
};
|
|||
|
session.SaveOrUpdate(queryRatioHist);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
simpleButton1_Click(null, null);
|
|||
|
|
|||
|
//更新显示值
|
|||
|
row.db_userid = select_form.fl_member_info.id;
|
|||
|
row.username = select_form.fl_member_info.username;
|
|||
|
row.usernick = select_form.fl_member_info.usernick;
|
|||
|
row.db_point = weipinhui.db_point;
|
|||
|
|
|||
|
select_form.fl_member_info.bind_order++;
|
|||
|
|
|||
|
#region 首次付款时间
|
|||
|
try
|
|||
|
{
|
|||
|
var record = session.FindStatisticsRecord(select_form.fl_member_info.id);
|
|||
|
if (record == null)
|
|||
|
{
|
|||
|
record = new fl_statistics_record() { uid = select_form.fl_member_info.id, ex2 = 0, ex4 = CsharpHttpHelper.HttpExtend.GetTimeStamp(DateTime.Now) };
|
|||
|
session.Saveable<fl_statistics_record>(record).ExecuteCommand();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (record.ex2 == 0 && record.ex4 == 0)
|
|||
|
{
|
|||
|
record.ex4 = CsharpHttpHelper.HttpExtend.GetTimeStamp(DateTime.Now);
|
|||
|
session.Saveable<fl_statistics_record>(record).ExecuteCommand();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{ }
|
|||
|
#endregion
|
|||
|
|
|||
|
session.UpdateMemberGroup(select_form.fl_member_info);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 订单解绑
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void 解绑ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
//获取选中数据
|
|||
|
var row = this.gridView1.GetRow(rows[0]) as view_cps_order_weipinhui;
|
|||
|
var db_status = row.db_status;
|
|||
|
if (db_status == SystemOrderStatus.订单失效 || db_status == SystemOrderStatus.订单结算 || db_status == SystemOrderStatus.全额退款 || db_status == SystemOrderStatus.部分退款)
|
|||
|
throw new Exception("该订单状态为已完结,不允许解绑!");
|
|||
|
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
|
|||
|
if (row.db_userid != 0)
|
|||
|
{
|
|||
|
var member = session.FindMemberInfoById(row.db_userid);
|
|||
|
if (member != null && member.bind_order > 0)
|
|||
|
{
|
|||
|
member.bind_order--;
|
|||
|
member = session.UpdateMemberGroup(member);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
session.ExcuteSQL("delete from fl_query_hist where itemid = @num_iid", new { num_iid = row.goodsId });
|
|||
|
session.ExcuteSQL("update fl_order_weipinhui set db_userid = @userid where id=@id", new { id = row.id, userid = 0 });
|
|||
|
session.ExcuteSQL("delete from fl_query_ratio_hist where db_orderid=@id", new { id = row.id });
|
|||
|
|
|||
|
//更新显示值
|
|||
|
row.db_userid = 0;
|
|||
|
row.username = string.Empty;
|
|||
|
row.usernick = string.Empty;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void 立即结算ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (XtraMessageBox.Show("确定要结算选中订单?", "友情提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
//获取选中数据
|
|||
|
var row = this.gridView1.GetRow(rows[0]) as view_cps_order_weipinhui;
|
|||
|
var db_status = row.db_status;
|
|||
|
|
|||
|
if (db_status == SystemOrderStatus.订单失效 || db_status == SystemOrderStatus.订单创建 || db_status == SystemOrderStatus.订单结算 || db_status == SystemOrderStatus.全额退款 || db_status == SystemOrderStatus.部分退款 || db_status == SystemOrderStatus.订单退款)
|
|||
|
throw new Exception($"选中订单:{db_status},不予操作");
|
|||
|
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
//var weipinhui = session.FindSingle<fl_order_weipinhui>("orderSn = @orderSn", new { orderSn = row.orderSn });
|
|||
|
var weipinhui = session.FindSingle<fl_order_weipinhui>("orderSn=@orderSn and goodsId=@goodsId and sizeId = @sizeId", new { orderSn = row.orderSn, goodsId = row.goodsId, sizeId = row.sizeId });
|
|||
|
if (weipinhui == null) throw new Exception("数据查询失败,请稍后重试");
|
|||
|
weipinhui.db_endtime = DateTime.Now;
|
|||
|
weipinhui.db_status = SystemOrderStatus.订单冻结;
|
|||
|
weipinhui.orderSubStatusName = WeipinhuiOrderSubStatusName.已结算;
|
|||
|
var task = TimerTask.GetTimer<DownWeipinhuiTimer>() as DownWeipinhuiTimer;
|
|||
|
var notices = new List<OrderNoticeEvent>();
|
|||
|
task.UpdateOrder(weipinhui, session, notices);
|
|||
|
|
|||
|
var tasks = TimerTask.GetTimer<Update_NoticeQueue>() as Update_NoticeQueue;
|
|||
|
foreach (var item in notices)
|
|||
|
{
|
|||
|
if (item.Member == null) continue;
|
|||
|
var order = item.Order as fl_order_weipinhui;
|
|||
|
tasks.Add(item);
|
|||
|
}
|
|||
|
//更新显示值
|
|||
|
row.db_status = SystemOrderStatus.订单结算;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void 查看用户信息ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
var username = gridView1.GetRowCellValue(rows[0], "username").ToString();//获取列的数据;
|
|||
|
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 rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
var username = this.gridView1.GetRowCellValue(rows[0], "username").ToString();//获取列的数据
|
|||
|
|
|||
|
var tsmi = sender as ToolStripMenuItem;
|
|||
|
if (tsmi == null) throw new Exception("数据异常");
|
|||
|
|
|||
|
var text = tsmi.Text.Replace("订单", "").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);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 查询用户对应积分列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void 积分ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
var username = this.gridView1.GetRowCellValue(rows[0], "username").ToString();//获取列的数据
|
|||
|
|
|||
|
var tsmi = sender as ToolStripMenuItem;
|
|||
|
if (tsmi == null) throw new Exception("数据异常");
|
|||
|
var common = new Dictionary<string, object>();
|
|||
|
common["control_name"] = "提现管理";
|
|||
|
common["query_type"] = 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 result = XtraMessageBox.Show("确定要失效选中订单?", "友情提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|||
|
if (result == DialogResult.Yes)
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
//获取选中数据
|
|||
|
var row = this.gridView1.GetRow(rows[0]) as view_cps_order_weipinhui;
|
|||
|
var db_status = row.db_status;
|
|||
|
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
var weipinhui = session.FindSingle<fl_order_weipinhui>("orderSn=@orderSn and goodsId=@goodsId and sizeId = @sizeId", new { orderSn = row.orderSn, goodsId = row.goodsId, sizeId = row.sizeId });
|
|||
|
if (weipinhui == null) throw new Exception("数据查询失败,请稍后重试");
|
|||
|
|
|||
|
var flag = false;
|
|||
|
var notices = new List<OrderNoticeEvent>();
|
|||
|
if (db_status == SystemOrderStatus.订单结算)
|
|||
|
flag = true;
|
|||
|
else if (weipinhui.IsFinish())
|
|||
|
throw new Exception($"选中订单:{db_status},不予操作");
|
|||
|
|
|||
|
weipinhui.orderSubStatusName = WeipinhuiOrderSubStatusName.手动失效;
|
|||
|
weipinhui.db_endtime = DateTime.Now;
|
|||
|
weipinhui.db_status = SystemOrderStatus.订单失效;
|
|||
|
var task = TimerTask.GetTimer<DownWeipinhuiTimer>() as DownWeipinhuiTimer;
|
|||
|
|
|||
|
if (!flag)
|
|||
|
task.UpdateOrder(weipinhui, session, notices);
|
|||
|
else
|
|||
|
{
|
|||
|
new OrderHelper().DeductWeipinhuiOrderPoint(notices, weipinhui);
|
|||
|
session.SaveOrUpdate(weipinhui);
|
|||
|
}
|
|||
|
|
|||
|
var tasks = TimerTask.GetTimer<Update_NoticeQueue>() as Update_NoticeQueue;
|
|||
|
foreach (var item in notices)
|
|||
|
{
|
|||
|
if (item.Member == null) continue;
|
|||
|
var order = item.Order as fl_order_weipinhui;
|
|||
|
tasks.Add(item);
|
|||
|
}
|
|||
|
//更新显示值
|
|||
|
row.db_status = SystemOrderStatus.订单失效;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void contextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
this.用户个人信息ToolStripMenuItem.Enabled = this.gridView1.GetRowCellValue(rows[0], "username") != null;
|
|||
|
this.冻结延期ToolStripMenuItem.Enabled = this.gridView1.GetRowCellValue(rows[0], "db_status").ToString() == "订单冻结";
|
|||
|
}
|
|||
|
else
|
|||
|
e.Cancel = true;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void 冻结延期ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (XtraMessageBox.Show("确定要延长冻结选中订单?", "友情提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
//获取选中数据
|
|||
|
var row = this.gridView1.GetRow(rows[0]) as view_cps_order_weipinhui;
|
|||
|
var db_status = row.db_status;
|
|||
|
|
|||
|
if (db_status != SystemOrderStatus.订单冻结)
|
|||
|
throw new Exception($"选中订单:{db_status},不予操作");
|
|||
|
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
var endtime_form = new setting_endtime_form(row.db_endtime);
|
|||
|
endtime_form.ShowDialog();
|
|||
|
if (endtime_form.newtime == DateTime.MinValue) return;
|
|||
|
var weipinhui = session.FindSingle<fl_order_weipinhui>("id = @id", new { id = row.id });
|
|||
|
if (endtime_form.newtime != row.db_endtime)
|
|||
|
{
|
|||
|
weipinhui.db_endtime = endtime_form.newtime;
|
|||
|
session.Updateable(weipinhui).ExecuteCommand();
|
|||
|
}
|
|||
|
row.db_endtime = endtime_form.newtime;//更新显示值
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private CancellationTokenSource tokenSource = new CancellationTokenSource();
|
|||
|
/// <summary>
|
|||
|
/// 要删除的@@@@@
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void 一键结算ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (MessageBox.Show("确定结算所有该所有的订单吗", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|||
|
{
|
|||
|
var orders = ApiClient.GetSession().Find<fl_order_weipinhui>("select * from fl_order_weipinhui where db_userid != 0 and (db_status = @db_status1 or db_status = @db_status2)", new { db_status1 = SystemOrderStatus.订单付款, db_status2 = SystemOrderStatus.订单冻结 });
|
|||
|
|
|||
|
if (orders.Count != 0)
|
|||
|
{
|
|||
|
Task.Run(() =>
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
try
|
|||
|
{
|
|||
|
var task = TimerTask.GetTimer<DownWeipinhuiTimer>() as DownWeipinhuiTimer;
|
|||
|
var notices = new List<OrderNoticeEvent>();
|
|||
|
foreach (var order in orders)
|
|||
|
{
|
|||
|
tokenSource.Token.ThrowIfCancellationRequested();
|
|||
|
|
|||
|
order.orderSubStatusName = WeipinhuiOrderSubStatusName.已结算;
|
|||
|
order.db_endtime = DateTime.Now;
|
|||
|
order.db_status = SystemOrderStatus.订单冻结;
|
|||
|
|
|||
|
task.UpdateOrder(order, session, notices);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
XtraMessageBox.Show($"一键结算成功,一共结算{orders.Count}笔订单!", "温馨提示", MessageBoxButtons.OK);
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{ }
|
|||
|
}, tokenSource.Token);
|
|||
|
}
|
|||
|
else
|
|||
|
XtraMessageBox.Show($"当前无可结算的订单!", "温馨提示", MessageBoxButtons.OK);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
XtraMessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void comboBoxEdit1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void 重新计算未结算订单ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var db = ApiClient.GetSession();
|
|||
|
var orders = db.Queryable<fl_order_weipinhui>().Where(f =>
|
|||
|
f.db_userid != 0 && (f.db_status == SystemOrderStatus.订单付款 ||
|
|||
|
f.db_status == SystemOrderStatus.订单冻结 ||
|
|||
|
f.db_status == SystemOrderStatus.订单维权中)).ToList();
|
|||
|
EventClient.OnEvent("", $"唯品会需要重新计算的订单数:{orders.Count}");
|
|||
|
|
|||
|
foreach (var order in orders)
|
|||
|
{
|
|||
|
var member = db.FindMemberInfoById(order.db_userid);
|
|||
|
var itempoint = db.FindItemPoint(member, order.commission, order.goodsCount, CpsType.唯品联盟);
|
|||
|
if (itempoint != null)
|
|||
|
{
|
|||
|
order.db_point = HttpHelper.ObjectToJson(itempoint);
|
|||
|
order.db_userpoint = itempoint.UserPoint;
|
|||
|
|
|||
|
db.SaveOrUpdate(order);
|
|||
|
EventClient.OnEvent("", $"唯品会单号:{order.orderSn},重新计算完成");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
EventClient.OnEvent("", $"唯品会重新计算异常:{ex.Message}");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|