修改消费记录总金额计算方法
This commit is contained in:
1 parent
107bf82f97
commit
d8064b95ef
4 files changed
+166
-74
No files matched your search
+12
-2
@@ -1147,7 +1147,14 @@ Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+
|
||||
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.1+(KHTML,+like+Gecko)+Chrome/21.0.1180.89+Safari/537.1
|
||||
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/45.0.2454.101+Safari/537.36
|
||||
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400";
|
||||
|
||||
public static async Task<string> PostJsonAsync(string url, object postData, int timeOut = 0)
|
||||
{
|
||||
return await PostUtf8Async(url, JsonHelper.SerializeObject(postData), contentType: "application/json", timeOut: timeOut);
|
||||
}
|
||||
public static async Task<string> PostJsonAsync(string url, string postData, int timeOut = 0)
|
||||
{
|
||||
return await PostUtf8Async(url, postData, contentType: "application/json", timeOut: timeOut);
|
||||
}
|
||||
/// <summary>
|
||||
/// post 数据
|
||||
/// </summary>
|
||||
@@ -1309,7 +1316,10 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom
|
||||
|
||||
request.Method = "POST";
|
||||
request.ServicePoint.Expect100Continue = false;
|
||||
|
||||
if (!string.IsNullOrEmpty(contentType))
|
||||
{
|
||||
request.ContentType = contentType;
|
||||
}
|
||||
string body = postData;
|
||||
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
|
||||
request.ContentLength = postBytes.Length;
|
||||
|
||||
+56
-18
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using AllBase;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using AllBase;
|
||||
using NaiBa.Util.Extension;
|
||||
|
||||
namespace Work
|
||||
{
|
||||
@@ -294,14 +297,11 @@ namespace Work
|
||||
/// 获取签名字符串
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetSignature(bool isPhoneOrder = false)
|
||||
public static string GetSignature()
|
||||
{
|
||||
int time = BaseClass.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent;
|
||||
string code = Encryption(time);
|
||||
if (isPhoneOrder)
|
||||
{
|
||||
code = BaseClass.GetMd5(time.ToString() + "8eLg*MDD46YjA_e*onDgnvkdIaGhi=7B").ToUpper();
|
||||
}
|
||||
|
||||
return "time=" + time + "&code=" + code + "&NbCodeVersion=1";
|
||||
}
|
||||
|
||||
@@ -311,28 +311,66 @@ namespace Work
|
||||
/// 获取签名字符串,新版
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetSignaturex(bool isPhoneOrder = false, int posttype = 0)
|
||||
public static string GetSignaturex()
|
||||
{
|
||||
return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName, isPhoneOrder, posttype);
|
||||
return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName);
|
||||
}
|
||||
|
||||
public static string GetSignaturex(string shopId, string shopName, bool isPhoneOrder = false, int posttype=0)
|
||||
public static string GetSignaturex(string shopId, string shopName)
|
||||
{
|
||||
var dict = GetSignaturexDict(shopId, shopName);
|
||||
return string.Join("&", dict.Select(kv => $"{kv.Key}={kv.Value}"));
|
||||
}
|
||||
public static object GetSignPostData(object data)
|
||||
{
|
||||
var dict = GetSignaturexDict(BaseClass.ShopId, BaseClass.ShopName);
|
||||
|
||||
var result = new ExpandoObject() as IDictionary<string, object>;
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
foreach (var prop in data.GetType().GetProperties())
|
||||
{
|
||||
result[prop.Name] = prop.GetValue(data) ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加sign的属性
|
||||
foreach (var kv in dict)
|
||||
{
|
||||
result[kv.Key] = kv.Value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
private static Dictionary<string, string> GetSignaturexDict(string shopId, string shopName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shopId))
|
||||
shopId = BaseClass.ShopId;
|
||||
if (string.IsNullOrEmpty(shopName))
|
||||
shopName = BaseClass.ShopName;
|
||||
int time = BaseClass.ConvertDateTimeInt(DateTime.Now) + BaseClass.TimeDifferent;
|
||||
|
||||
int time = BaseClass.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent;
|
||||
string time1 = Encryption(time);
|
||||
if (posttype==1)
|
||||
|
||||
var dict = new Dictionary<string, string>
|
||||
{
|
||||
return time1;
|
||||
}
|
||||
return GetSignature(isPhoneOrder) + "&version=" + BaseClass.VersionCount + "&uid=" + BaseClass.UserId + "&key=" + BaseClass.UserKey +
|
||||
"&cid=" + BaseClass.CompanyId + "&company=" + GetHtml.UrlEncodeUtf8(BaseClass.CompanyName) + "&user_name=" + BaseClass.UserName +
|
||||
"&sid=" + shopId + "&shop=" + GetHtml.UrlEncodeUtf8(shopName);
|
||||
{ "time", time.ToString() },
|
||||
{ "code", time1 },
|
||||
{ "code_version", "1" },
|
||||
{ "version", BaseClass.VersionCount.ToString() },
|
||||
{ "user_name", BaseClass.UserName },
|
||||
{ "path", BaseClass.MainPath }
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(BaseClass.AgentCode))
|
||||
{
|
||||
dict.Add("agent_code", BaseClass.AgentCode);
|
||||
dict.Add("agent_name", BaseClass.AgentName);
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
/// <summary>
|
||||
/// 签名算法
|
||||
/// </summary>
|
||||
|
||||
+46
-46
@@ -30,9 +30,9 @@ namespace Work._29Tools.Forms.UserForms
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.pbQrcode = new System.Windows.Forms.PictureBox();
|
||||
this.btnRefresh = new DevComponents.DotNetBar.PanelEx();
|
||||
@@ -45,6 +45,9 @@ namespace Work._29Tools.Forms.UserForms
|
||||
this.btnBalanceTopUp = new DevComponents.DotNetBar.PanelEx();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.ucGroupBoxEx1 = new Work.UserComponents.UcGroupBoxEx(this.components);
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.consumptionArmt = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.rangeUsedAramt = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.exportRecord = new System.Windows.Forms.LinkLabel();
|
||||
@@ -75,9 +78,6 @@ namespace Work._29Tools.Forms.UserForms
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.statusBarUserControl1 = new Work.UserControls.StatusBarUserControl();
|
||||
this.ucSplitPage1 = new Work.UserControls.UcSplitPage();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.consumptionArmt = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbQrcode)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
|
||||
@@ -319,6 +319,32 @@ namespace Work._29Tools.Forms.UserForms
|
||||
this.ucGroupBoxEx1.Text = "查询条件";
|
||||
this.ucGroupBoxEx1.Enter += new System.EventHandler(this.ucGroupBoxEx1_Enter);
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(614, 50);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(56, 17);
|
||||
this.label13.TabIndex = 1182;
|
||||
this.label13.Text = "截至时间";
|
||||
//
|
||||
// consumptionArmt
|
||||
//
|
||||
this.consumptionArmt.Location = new System.Drawing.Point(1078, 18);
|
||||
this.consumptionArmt.Name = "consumptionArmt";
|
||||
this.consumptionArmt.Size = new System.Drawing.Size(67, 17);
|
||||
this.consumptionArmt.TabIndex = 1181;
|
||||
this.consumptionArmt.Text = "xxxx.xx";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(1016, 18);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(68, 17);
|
||||
this.label11.TabIndex = 1180;
|
||||
this.label11.Text = "消费总额:";
|
||||
//
|
||||
// rangeUsedAramt
|
||||
//
|
||||
this.rangeUsedAramt.Location = new System.Drawing.Point(943, 64);
|
||||
@@ -353,7 +379,7 @@ namespace Work._29Tools.Forms.UserForms
|
||||
this.balanceArmt.Name = "balanceArmt";
|
||||
this.balanceArmt.Size = new System.Drawing.Size(67, 17);
|
||||
this.balanceArmt.TabIndex = 1167;
|
||||
this.balanceArmt.Text = "1000.00";
|
||||
this.balanceArmt.Text = "xxxx.xx";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
@@ -370,7 +396,7 @@ namespace Work._29Tools.Forms.UserForms
|
||||
this.rechargeArmtTotal.Name = "rechargeArmtTotal";
|
||||
this.rechargeArmtTotal.Size = new System.Drawing.Size(67, 17);
|
||||
this.rechargeArmtTotal.TabIndex = 1165;
|
||||
this.rechargeArmtTotal.Text = "10000.00";
|
||||
this.rechargeArmtTotal.Text = "xxxx.xx";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
@@ -525,20 +551,20 @@ namespace Work._29Tools.Forms.UserForms
|
||||
//
|
||||
this.dgvPayment.AllowUserToAddRows = false;
|
||||
this.dgvPayment.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle4.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvPayment.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvPayment.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgvPayment.AutoRowNumber = true;
|
||||
this.dgvPayment.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dgvPayment.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgvPayment.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvPayment.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvPayment.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dgvPayment.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvPayment.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colCheck,
|
||||
@@ -582,8 +608,8 @@ namespace Work._29Tools.Forms.UserForms
|
||||
//
|
||||
// colAmount
|
||||
//
|
||||
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colAmount.DefaultCellStyle = dataGridViewCellStyle6;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colAmount.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.colAmount.FillWeight = 60F;
|
||||
this.colAmount.HeaderText = "金额";
|
||||
this.colAmount.Name = "colAmount";
|
||||
@@ -643,32 +669,6 @@ namespace Work._29Tools.Forms.UserForms
|
||||
this.ucSplitPage1.PageChange += new System.Action<object>(this.ucSplitPage1_PageChange);
|
||||
this.ucSplitPage1.Load += new System.EventHandler(this.ucSplitPage1_Load);
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(1016, 18);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(68, 17);
|
||||
this.label11.TabIndex = 1180;
|
||||
this.label11.Text = "消费总额:";
|
||||
//
|
||||
// consumptionArmt
|
||||
//
|
||||
this.consumptionArmt.Location = new System.Drawing.Point(1078, 18);
|
||||
this.consumptionArmt.Name = "consumptionArmt";
|
||||
this.consumptionArmt.Size = new System.Drawing.Size(67, 17);
|
||||
this.consumptionArmt.TabIndex = 1181;
|
||||
this.consumptionArmt.Text = "1000.00";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(614, 50);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(56, 17);
|
||||
this.label13.TabIndex = 1182;
|
||||
this.label13.Text = "截至时间";
|
||||
//
|
||||
// WXGetBalanceQrCodeForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
|
||||
@@ -5,6 +5,7 @@ using CefSharp.WinForms;
|
||||
using DevComponents.WinForms.Drawing;
|
||||
using NaiBa.CefHelper;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,6 +17,7 @@ using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -25,6 +27,7 @@ using Work._29Tools.BLL;
|
||||
using Work._29Tools.Forms.ShopForms;
|
||||
using Work.BaseForms;
|
||||
using Work.Extension;
|
||||
using WxOrder.Framework.Commons;
|
||||
|
||||
namespace Work._29Tools.Forms.UserForms
|
||||
{
|
||||
@@ -37,6 +40,9 @@ namespace Work._29Tools.Forms.UserForms
|
||||
{
|
||||
InitializeComponent();
|
||||
updateBalanceAction = updateBalance;
|
||||
_ = GetUserAmountSummary();
|
||||
rangeUsedAramt.Visible = false;
|
||||
label9.Visible = false;
|
||||
}
|
||||
|
||||
public void refreshQrcode()
|
||||
@@ -209,14 +215,14 @@ namespace Work._29Tools.Forms.UserForms
|
||||
#endif
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
rechargeArmtTotal.Text = BaseClass.RechargeAmountTotal.ToString("N2");
|
||||
balanceArmt.Text = BaseClass.Balance.ToString("N2");
|
||||
rangeUsedAramt.Text = paymentList.Sum(a => a.amount).ToString("N2");
|
||||
List<int> types = new List<int> { 16, 20, 23, 24, 26, 31 };
|
||||
consumptionArmt.Text =
|
||||
(paymentList.Where(a => types.Contains(a.type.Value)).Sum(a => a.amount)
|
||||
- paymentList.Where(a => a.type == 23).Sum(a => a.amount))
|
||||
.ToString("N2"); // paymentList.Sum(a => a.amount).ToString("N2");
|
||||
//rechargeArmtTotal.Text = BaseClass.RechargeAmountTotal.ToString("N2");
|
||||
//balanceArmt.Text = BaseClass.Balance.ToString("N2");
|
||||
//rangeUsedAramt.Text = paymentList.Sum(a => a.amount).ToString("N2");
|
||||
//List<int> types = new List<int> { 16, 20, 23, 24, 26, 31 };
|
||||
//consumptionArmt.Text =
|
||||
//(paymentList.Where(a => types.Contains(a.type.Value)).Sum(a => a.amount)
|
||||
//- paymentList.Where(a => a.type == 23).Sum(a => a.amount))
|
||||
//.ToString("N2"); // paymentList.Sum(a => a.amount).ToString("N2");
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -298,5 +304,43 @@ namespace Work._29Tools.Forms.UserForms
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task GetUserAmountSummary()
|
||||
{
|
||||
var url = BaseClass.Build29WxObjString("user/GetUserAmountSummary");
|
||||
var data3 = UserLogin.GetSignPostData(new { });
|
||||
var html3 = await GetHtml.PostJsonAsync(url, data3);
|
||||
var ret = JsonConvert.DeserializeObject<Result<UserAmountSummary>>(html3);
|
||||
if (ret.Code != 200)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
rechargeArmtTotal.Text = (ret.Data.RechargeTotal / 100m).ToString("N2");
|
||||
balanceArmt.Text = (ret.Data.Balance / 100m).ToString("N2");
|
||||
//rangeUsedAramt.Text = paymentList.Sum(a => a.amount).ToString("N2");
|
||||
consumptionArmt.Text = (ret.Data.ConsumeTotal / 100m).ToString("N2");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class UserAmountSummary
|
||||
{
|
||||
/// <summary>
|
||||
/// 充值总额
|
||||
/// </summary>
|
||||
public long RechargeTotal { get; set; }
|
||||
/// <summary>
|
||||
/// 消费总额
|
||||
/// </summary>
|
||||
public long ConsumeTotal { get; set; }
|
||||
/// <summary>
|
||||
/// 剩余余额
|
||||
/// </summary>
|
||||
public long Balance { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user