From d8064b95ef3b1a139800e391b037513826b7ab0a Mon Sep 17 00:00:00 2001 From: chfei Date: Sun, 20 Sep 2026 18:49:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B6=88=E8=B4=B9=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=80=BB=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/GetHtml.cs | 14 +- Work/UserLogin.cs | 924 +++++++++--------- .../WXGetBalanceQrCodeForm.Designer.cs | 108 +- .../Forms/UserForms/WXGetBalanceQrCodeForm.cs | 60 +- .../UserForms/WXGetBalanceQrCodeForm.resx | 54 +- 5 files changed, 626 insertions(+), 534 deletions(-) diff --git a/AllBase/GetHtml.cs b/AllBase/GetHtml.cs index 4d9b2f7..80bc254 100644 --- a/AllBase/GetHtml.cs +++ b/AllBase/GetHtml.cs @@ -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 PostJsonAsync(string url, object postData, int timeOut = 0) + { + return await PostUtf8Async(url, JsonHelper.SerializeObject(postData), contentType: "application/json", timeOut: timeOut); + } + public static async Task PostJsonAsync(string url, string postData, int timeOut = 0) + { + return await PostUtf8Async(url, postData, contentType: "application/json", timeOut: timeOut); + } /// /// post 数据 /// @@ -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; diff --git a/Work/UserLogin.cs b/Work/UserLogin.cs index f53955a..a3f6c1e 100644 --- a/Work/UserLogin.cs +++ b/Work/UserLogin.cs @@ -1,484 +1,522 @@ -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 { - public class UserLogin - { - public string Mobile; - public string Password; - public static bool Logining = false, NoRegedit = false, NoFindPass = false, NoBuy = false; - /// - /// 登录 - /// - /// - /// - public bool Get(ref string message, out int lockUserName, out int weakPassword, out string messageInfo) - { - bool IsLoginDef = false; - Logining = true; - string mobile = Mobile; - string password = Password; - string passwordMd5; - if (password == "******") - passwordMd5 = BaseClass.PassWord; - else - passwordMd5 = Md5Base.GetMd5(password).ToLower(); - BaseClass.PassWord = passwordMd5; - BaseClass.PassWordBak = BaseClass.PassWord; - BaseClass.UserName = Mobile; - Random r = new Random(); - int r2 = r.Next(100000000, 899999999); //生成随机码 - string url = BaseClass.Build29WxObjString("user/user_login"); - for (int j = 0; j < 100 && string.IsNullOrEmpty(BaseClass.MacInfo); j++) - { - Thread.Sleep(10); - } - Agian: - string data = "mobile=" + mobile + "&r2=" + r2 + "&password=" + passwordMd5 + "&" + GetSignature() + "&mac=" + BaseClass.MacInfo + "&version=" + BaseClass.VersionCount; - data += "&from_tool=" + GetHtml.UrlEncodeUtf8(BaseClass.AgentName) + "&client_ip=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddress) + "&client_addr=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddressName); - data += "&sub_soft_type=order"; - string html = GetHtml.PostUtf8(url, data); - lockUserName = -1; - weakPassword = -1; - messageInfo = ""; - if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) - { - if (!IsLoginDef) - { - IsLoginDef = true; - url = BaseClass.Build29WxObjString("login"); - goto Agian; - } + public class UserLogin + { + public string Mobile; + public string Password; + public static bool Logining = false, NoRegedit = false, NoFindPass = false, NoBuy = false; + /// + /// 登录 + /// + /// + /// + public bool Get(ref string message, out int lockUserName, out int weakPassword, out string messageInfo) + { + bool IsLoginDef = false; + Logining = true; + string mobile = Mobile; + string password = Password; + string passwordMd5; + if (password == "******") + passwordMd5 = BaseClass.PassWord; + else + passwordMd5 = Md5Base.GetMd5(password).ToLower(); + BaseClass.PassWord = passwordMd5; + BaseClass.PassWordBak = BaseClass.PassWord; + BaseClass.UserName = Mobile; + Random r = new Random(); + int r2 = r.Next(100000000, 899999999); //生成随机码 + string url = BaseClass.Build29WxObjString("user/user_login"); + for (int j = 0; j < 100 && string.IsNullOrEmpty(BaseClass.MacInfo); j++) + { + Thread.Sleep(10); + } + Agian: + string data = "mobile=" + mobile + "&r2=" + r2 + "&password=" + passwordMd5 + "&" + GetSignature() + "&mac=" + BaseClass.MacInfo + "&version=" + BaseClass.VersionCount; + data += "&from_tool=" + GetHtml.UrlEncodeUtf8(BaseClass.AgentName) + "&client_ip=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddress) + "&client_addr=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddressName); + data += "&sub_soft_type=order"; + string html = GetHtml.PostUtf8(url, data); + lockUserName = -1; + weakPassword = -1; + messageInfo = ""; + if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) + { + if (!IsLoginDef) + { + IsLoginDef = true; + url = BaseClass.Build29WxObjString("login"); + goto Agian; + } - message = "链接服务器失败\r\n" + - "如有问题请联系官方QQ:" + BaseClass.ServiceQQ; - return false; - } - if (html == "need open") - { - message = "登录失败\r\n请先点击“购买开户”开通本软件使用权限"; - return false; - } - if (!html.Contains("\"code\":200")) - { - var errMsg = BaseRegex.GetStringJson(ref html, "msg"); - if (string.IsNullOrEmpty(errMsg)) - errMsg = html; - message = errMsg; - return false; - } - string code = BaseRegex.GetStringJson(ref html, "c"); - string codex = Encryption(r2); - if (code != codex) - { - message = "登录失败\r\n链接异常请重试"; - return false; - } + message = "链接服务器失败\r\n" + + "如有问题请联系官方QQ:" + BaseClass.ServiceQQ; + return false; + } + if (html == "need open") + { + message = "登录失败\r\n请先点击“购买开户”开通本软件使用权限"; + return false; + } + if (!html.Contains("\"code\":200")) + { + var errMsg = BaseRegex.GetStringJson(ref html, "msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = html; + message = errMsg; + return false; + } + string code = BaseRegex.GetStringJson(ref html, "c"); + string codex = Encryption(r2); + if (code != codex) + { + message = "登录失败\r\n链接异常请重试"; + return false; + } - if (IsLoginDef) - { - //BaseClass.LoginApiUrl = "http://new.qixiaoke.com/"; - //BaseClass.ImageApiUrl = BaseClass.LoginApiUrl + "index.php?obj=api/image"; - } + if (IsLoginDef) + { + //BaseClass.LoginApiUrl = "http://new.qixiaoke.com/"; + //BaseClass.ImageApiUrl = BaseClass.LoginApiUrl + "index.php?obj=api/image"; + } - //BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end"); - //BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company"); - //BaseClass.UserId =Convert.ToInt32(BaseRegex.GetStringJson(ref html, "uid")); - //BaseClass.UserKey = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "key")); - //BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nickname"); - //BaseClass.UserVersion = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "v")); - //BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "vt"); - //BaseClass.CompanyId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cid")); - //BaseClass.GroupId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "groupid")); - //BaseClass.Balance = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "balance")); - //BaseClass.IsFactory = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "factory")) == 1; - //BaseClass.IsCloudBuyOrder = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cloud_buy_order_status")) == 1; - //if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11) - //{ - // BaseClass.UserId = 0; - // BaseClass.UserKey = 0; - // return false; - //} - //BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end"); - //BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company"); - - //string islock = BaseRegex.GetStringJson(ref html, "is_lock"); - //int.TryParse(islock, out lockUserName); - //string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password"); - //int.TryParse(isweak, out weakPassword); - //messageInfo = BaseRegex.GetStringJson(ref html, "message"); + //BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end"); + //BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company"); + //BaseClass.UserId =Convert.ToInt32(BaseRegex.GetStringJson(ref html, "uid")); + //BaseClass.UserKey = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "key")); + //BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nickname"); + //BaseClass.UserVersion = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "v")); + //BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "vt"); + //BaseClass.CompanyId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cid")); + //BaseClass.GroupId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "groupid")); + //BaseClass.Balance = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "balance")); + //BaseClass.IsFactory = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "factory")) == 1; + //BaseClass.IsCloudBuyOrder = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cloud_buy_order_status")) == 1; + //if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11) + //{ + // BaseClass.UserId = 0; + // BaseClass.UserKey = 0; + // return false; + //} + //BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end"); + //BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company"); - //// 代理权限列表 - //string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth"); + //string islock = BaseRegex.GetStringJson(ref html, "is_lock"); + //int.TryParse(islock, out lockUserName); + //string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password"); + //int.TryParse(isweak, out weakPassword); + //messageInfo = BaseRegex.GetStringJson(ref html, "message"); - BaseClass.UserId = BaseRegex.GetStringJson(ref html, "id").ParseToInt(); - BaseClass.UserKey = BaseRegex.GetStringJson(ref html, "user_key").ParseToInt(); - BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nick_name"); - BaseClass.UserName = BaseRegex.GetStringJson(ref html, "user_name"); - BaseClass.ParentUserName = BaseRegex.GetStringJson(ref html, "parent_user_name"); - BaseClass.SaLevel = BaseRegex.GetIntJson(ref html, "sa_level").ParseToInt(); - BaseClass.UserAuthority = BaseRegex.GetStringJson(ref html, "authority").ParseToString(); - BaseClass.ParentAuthority = BaseRegex.GetStringJson(ref html, "parent_authority").ParseToString(); - BaseClass.ForbiddenPage = BaseRegex.GetStringJson(ref html, "forbidden_page").ParseToString(); - BaseClass.Mobile = BaseRegex.GetStringJson(ref html, "mobile"); - BaseClass.UserVersion = BaseRegex.GetStringJson(ref html, "version").ParseToInt(); - BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "version_s"); - BaseClass.CompanyId = BaseRegex.GetStringJson(ref html, "company_Id").ParseToInt(); - BaseClass.GroupId = BaseRegex.GetStringJson(ref html, "group_id").ParseToInt(); - //BaseClass.AuthorizedAmount = BaseRegex.GetNullableDecimalJson(ref html, "authorized_amount"); - BaseClass.Points = BaseRegex.GetStringJson(ref html, "points").ParseToInt(); - BaseClass.ShopPointsPerMonth = BaseRegex.GetStringJson(ref html, "shop_points_per_month").ParseToInt(); - BaseClass.Balance = BaseRegex.GetDecimalJson(ref html, "balance"); + //// 代理权限列表 + //string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth"); + + BaseClass.UserId = BaseRegex.GetStringJson(ref html, "id").ParseToInt(); + BaseClass.UserKey = BaseRegex.GetStringJson(ref html, "user_key").ParseToInt(); + BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nick_name"); + BaseClass.UserName = BaseRegex.GetStringJson(ref html, "user_name"); + BaseClass.ParentUserName = BaseRegex.GetStringJson(ref html, "parent_user_name"); + BaseClass.SaLevel = BaseRegex.GetIntJson(ref html, "sa_level").ParseToInt(); + BaseClass.UserAuthority = BaseRegex.GetStringJson(ref html, "authority").ParseToString(); + BaseClass.ParentAuthority = BaseRegex.GetStringJson(ref html, "parent_authority").ParseToString(); + BaseClass.ForbiddenPage = BaseRegex.GetStringJson(ref html, "forbidden_page").ParseToString(); + BaseClass.Mobile = BaseRegex.GetStringJson(ref html, "mobile"); + BaseClass.UserVersion = BaseRegex.GetStringJson(ref html, "version").ParseToInt(); + BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "version_s"); + BaseClass.CompanyId = BaseRegex.GetStringJson(ref html, "company_Id").ParseToInt(); + BaseClass.GroupId = BaseRegex.GetStringJson(ref html, "group_id").ParseToInt(); + //BaseClass.AuthorizedAmount = BaseRegex.GetNullableDecimalJson(ref html, "authorized_amount"); + BaseClass.Points = BaseRegex.GetStringJson(ref html, "points").ParseToInt(); + BaseClass.ShopPointsPerMonth = BaseRegex.GetStringJson(ref html, "shop_points_per_month").ParseToInt(); + BaseClass.Balance = BaseRegex.GetDecimalJson(ref html, "balance"); BaseClass.PostagePerOrder = Math.Max(2.2m, BaseRegex.GetDecimalJson(ref html, "postage_per_order")); BaseClass.RefundPostagePerOrder = Math.Max(2.5m, BaseRegex.GetDecimalJson(ref html, "refund_postage_per_order")); BaseClass.RechargeAmountTotal = BaseRegex.GetDecimalJson(ref html, "recharge_amount_total"); BaseClass.OemGiftAmount = BaseRegex.GetDecimalJson(ref html, "gift_oem_amount_per_order"); BaseClass.OemId = BaseRegex.GetStringJson(ref html, "oem_id"); - BaseClass.OemName = BaseRegex.GetStringJson(ref html, "oem_name"); - BaseClass.IsOemOwner = BaseRegex.GetBoolJson(ref html, "is_oem_owner"); + BaseClass.OemName = BaseRegex.GetStringJson(ref html, "oem_name"); + BaseClass.IsOemOwner = BaseRegex.GetBoolJson(ref html, "is_oem_owner"); - if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11) - { - message = "该账户禁止登录订单管理"; - BaseClass.UserId = 0; - BaseClass.UserKey = 0; - return false; - } + if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11) + { + message = "该账户禁止登录订单管理"; + BaseClass.UserId = 0; + BaseClass.UserKey = 0; + return false; + } - if (BaseClass.ForbiddenPage.Contains("拍单")) - { - message = "该账户禁止登录订单管理"; - BaseClass.UserId = 0; - BaseClass.UserKey = 0; - return false; - } + if (BaseClass.ForbiddenPage.Contains("拍单")) + { + message = "该账户禁止登录订单管理"; + BaseClass.UserId = 0; + BaseClass.UserKey = 0; + return false; + } - BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end"); - BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company_name"); - if (BaseClass.UserVersion == 3) - { - BaseClass.QqGroupNum = BaseRegex.GetStringJson(ref html, "qq_group_num"); - BaseClass.QqGroupUrl = BaseRegex.GetStringJson(ref html, "qq_group_url"); - BaseClass.WechatUrl = BaseRegex.GetStringJson(ref html, "wechat_url"); - } - if (BaseClass.UserVersion == 3 || BaseClass.UserVersion == 4 || BaseClass.UserVersion == 5 || BaseClass.UserVersion == 10 || BaseClass.UserVersion == 9) - { - BaseClass.IsPinduoduo = BaseRegex.GetStringJson(ref html, "pinduoduo") == "1"; - BaseClass.AlimamaDomain = BaseRegex.GetStringJson(ref html, "alimama_domain"); - BaseClass.AlimamaPid = BaseRegex.GetStringJson(ref html, "alimama_pid"); - } - if (!BaseClass.UserApi && BaseClass.UserVersion != 110) - BaseClass.UserVersion = 100; - //if (BaseClass.UserVersion == 110) - // BaseClass.ClientId = BaseSpecialConfig.ToolClientId; // 特别版本,使用指定ClientId + BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end"); + BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company_name"); + if (BaseClass.UserVersion == 3) + { + BaseClass.QqGroupNum = BaseRegex.GetStringJson(ref html, "qq_group_num"); + BaseClass.QqGroupUrl = BaseRegex.GetStringJson(ref html, "qq_group_url"); + BaseClass.WechatUrl = BaseRegex.GetStringJson(ref html, "wechat_url"); + } + if (BaseClass.UserVersion == 3 || BaseClass.UserVersion == 4 || BaseClass.UserVersion == 5 || BaseClass.UserVersion == 10 || BaseClass.UserVersion == 9) + { + BaseClass.IsPinduoduo = BaseRegex.GetStringJson(ref html, "pinduoduo") == "1"; + BaseClass.AlimamaDomain = BaseRegex.GetStringJson(ref html, "alimama_domain"); + BaseClass.AlimamaPid = BaseRegex.GetStringJson(ref html, "alimama_pid"); + } + if (!BaseClass.UserApi && BaseClass.UserVersion != 110) + BaseClass.UserVersion = 100; + //if (BaseClass.UserVersion == 110) + // BaseClass.ClientId = BaseSpecialConfig.ToolClientId; // 特别版本,使用指定ClientId - string islock = BaseRegex.GetStringJson(ref html, "is_lock"); - int.TryParse(islock, out lockUserName); - string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password"); - int.TryParse(isweak, out weakPassword); - messageInfo = BaseRegex.GetStringJson(ref html, "message"); + string islock = BaseRegex.GetStringJson(ref html, "is_lock"); + int.TryParse(islock, out lockUserName); + string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password"); + int.TryParse(isweak, out weakPassword); + messageInfo = BaseRegex.GetStringJson(ref html, "message"); - //// 代理权限列表 - //string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth"); - //if (!string.IsNullOrEmpty(agent_auth) && agent_auth != "0") - //{ - // var strArr = agent_auth.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); - // foreach (var item in strArr) - // { - // var itemArr = item.Split(','); - // if (itemArr.Length == 2) - // { - // BaseClass.AgentAuth[itemArr[0]] = itemArr[1]; - // } - // } - //} + //// 代理权限列表 + //string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth"); + //if (!string.IsNullOrEmpty(agent_auth) && agent_auth != "0") + //{ + // var strArr = agent_auth.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + // foreach (var item in strArr) + // { + // var itemArr = item.Split(','); + // if (itemArr.Length == 2) + // { + // BaseClass.AgentAuth[itemArr[0]] = itemArr[1]; + // } + // } + //} - BaseClass.IsLoginSuccess = true; + BaseClass.IsLoginSuccess = true; - Initialization i = new Initialization(); - i.SaveConfig(); - return true; - } + Initialization i = new Initialization(); + i.SaveConfig(); + return true; + } - /// - /// 注册账户 - /// - /// 手机 - /// 密码 - /// 验证码 - /// 昵称 - /// 邮箱 - /// - /// - public bool Regedit(string mobile, string password, string code, string nickname, string email, out string message) - { - string passwordMd5 = Md5Base.GetMd5(password).ToLower(); - string url = BaseClass.Build29WxObjString("regedit"); - string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&nickname=" + GetHtml.UrlEncodeUtf8(nickname) + - "&email=" + email + "&" + GetSignature(); - string html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) - { - message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" + - "1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" + - "2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" + - "3、请不要使用代理上网,更换为路由或者直接链接\r\n" + - "4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" + - "5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助"; - return false; - } - if (!html.Contains("\"code\":200")) - { - var errMsg = BaseRegex.GetStringJson(ref html, "msg"); - if (string.IsNullOrEmpty(errMsg)) - errMsg = html; - message = errMsg; - if (message.Contains("手机号码已被注册")) - { - message = message.Replace("手机号码已被注册", "手机号码已被注册,请直接登录或找回密码"); - } - if (message.Contains("短信验证码错误")) - { - message = "短信验证码错误,请重新输入\r\n如果接收不到,请联系客服QQ:" + BaseClass.ServiceQQ + ""; - } - return false; - } - message = ""; - return true; - } + /// + /// 注册账户 + /// + /// 手机 + /// 密码 + /// 验证码 + /// 昵称 + /// 邮箱 + /// + /// + public bool Regedit(string mobile, string password, string code, string nickname, string email, out string message) + { + string passwordMd5 = Md5Base.GetMd5(password).ToLower(); + string url = BaseClass.Build29WxObjString("regedit"); + string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&nickname=" + GetHtml.UrlEncodeUtf8(nickname) + + "&email=" + email + "&" + GetSignature(); + string html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) + { + message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" + + "1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" + + "2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" + + "3、请不要使用代理上网,更换为路由或者直接链接\r\n" + + "4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" + + "5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助"; + return false; + } + if (!html.Contains("\"code\":200")) + { + var errMsg = BaseRegex.GetStringJson(ref html, "msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = html; + message = errMsg; + if (message.Contains("手机号码已被注册")) + { + message = message.Replace("手机号码已被注册", "手机号码已被注册,请直接登录或找回密码"); + } + if (message.Contains("短信验证码错误")) + { + message = "短信验证码错误,请重新输入\r\n如果接收不到,请联系客服QQ:" + BaseClass.ServiceQQ + ""; + } + return false; + } + message = ""; + return true; + } - /// - /// 重置密码 - /// - /// - /// - /// - /// - /// - public bool ResetPassword(string mobile, string code, string password, out string message) - { - string passwordMd5 = Md5Base.GetMd5(password).ToLower(); - string url = BaseClass.Build29WxObjString("reset_password"); - string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&" + GetSignature(); - string html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) - { - message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" + - "1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" + - "2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" + - "3、请不要使用代理上网,更换为路由或者直接链接\r\n" + - "4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" + - "5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助"; - return false; - } - if (!html.Contains("\"code\":200")) - { - var errMsg = BaseRegex.GetStringJson(ref html, "msg"); - if (string.IsNullOrEmpty(errMsg)) - errMsg = html; - message = errMsg; - return false; - } - message = ""; - return true; + /// + /// 重置密码 + /// + /// + /// + /// + /// + /// + public bool ResetPassword(string mobile, string code, string password, out string message) + { + string passwordMd5 = Md5Base.GetMd5(password).ToLower(); + string url = BaseClass.Build29WxObjString("reset_password"); + string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&" + GetSignature(); + string html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) + { + message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" + + "1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" + + "2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" + + "3、请不要使用代理上网,更换为路由或者直接链接\r\n" + + "4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" + + "5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助"; + return false; + } + if (!html.Contains("\"code\":200")) + { + var errMsg = BaseRegex.GetStringJson(ref html, "msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = html; + message = errMsg; + return false; + } + message = ""; + return true; - } + } - /// - /// 获取签名字符串 - /// - /// - public static string GetSignature(bool isPhoneOrder = false) - { - 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"; - } + /// + /// 获取签名字符串 + /// + /// + public static string GetSignature() + { + int time = BaseClass.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent; + string code = Encryption(time); - public static bool IsPinduoduo = false; + return "time=" + time + "&code=" + code + "&NbCodeVersion=1"; + } - /// - /// 获取签名字符串,新版 - /// - /// - public static string GetSignaturex(bool isPhoneOrder = false, int posttype = 0) - { - return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName, isPhoneOrder, posttype); - } + public static bool IsPinduoduo = false; - public static string GetSignaturex(string shopId, string shopName, bool isPhoneOrder = false, int posttype=0) - { - if (string.IsNullOrEmpty(shopId)) - shopId = BaseClass.ShopId; - if (string.IsNullOrEmpty(shopName)) - shopName = BaseClass.ShopName; - int time = BaseClass.ConvertDateTimeInt(DateTime.Now) + BaseClass.TimeDifferent; - string time1 = Encryption(time); - if (posttype==1) - { - 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); - } + /// + /// 获取签名字符串,新版 + /// + /// + public static string GetSignaturex() + { + return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName); + } - /// - /// 签名算法 - /// - /// 随机数 - /// 加密签名结果 - public static string Encryptionxx(int s) - { - string ss = s.ToString(); - if (ss.Length > 8) - { - ss = ss.Substring(ss.Length - 8); - s = int.Parse(ss); - if (s < 100000000) - s += 100000000; - } - byte[] kb = Encoding.ASCII.GetBytes(s.ToString()); - if (BaseClass.NewSignatureAuth) - { - double y = s * 1.6081825125; - y += 4582095.48659959; - y += kb[3] * 934579.486548; - y += kb[7] + 4889894.30184; - byte[] k = Encoding.ASCII.GetBytes(y.ToString()); - y -= 478735.48548; - y -= k[6] * 426720.454545; - y -= k[2] * 5667826.96889; - byte[] k1 = Encoding.ASCII.GetBytes(y.ToString()); - y += 56979810.2455; - y -= k1[1] * 58742.0564845; - y -= k1[5] * 1528.487866; - string c = ((int)y).ToString(); - return GetMd5(c); //返回签名的MD5结果 - } - else - { - double y = s * 1.8061825125; - y += 4852095.48659959; - y += kb[3] * 943579.486548; - y += kb[7] + 4889894.30184; - byte[] k = Encoding.ASCII.GetBytes(y.ToString()); - y -= 458735.48548; - y -= k[6] * 458720.454545; - y -= k[2] * 5447826.96889; - byte[] k1 = Encoding.ASCII.GetBytes(y.ToString()); - y += 34779810.2455; - y -= k1[1] * 57942.0564845; - y -= k1[5] * 1548.487866; - string c = ((int)y).ToString(); - return GetMd5(c); //返回签名的MD5结果 - } - //double y = s * 1.8061825125; - //y += 4852095.48659959; - //y += kb[3] * 943579.486548; - //y += kb[7] + 4889894.30184; - //byte[] k = Encoding.ASCII.GetBytes(y.ToString()); - //y -= 458735.48548; - //y -= k[6] * 458720.454545; - //y -= k[2] * 5447826.96889; - //byte[] k1 = Encoding.ASCII.GetBytes(y.ToString()); - //y += 34779810.2455; - //y -= k1[1] * 57942.0564845; - //y -= k1[5] * 1548.487866; - //string c = ((int)y).ToString(); - //return GetMd5(c); //返回签名的MD5结果 - } + 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); - /// - /// 签名算法 - /// - /// 随机数 - /// 加密签名结果 - public static string Encryption(int s) - { - //return GetMd5(s + "sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD"); + var result = new ExpandoObject() as IDictionary; - string sign = $"{s}sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD"; - return GetMd5(sign); + 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; + } - public string Get(string key) - { - if (string.IsNullOrEmpty(key)) - return ""; - byte[] inArray = Convert.FromBase64String(key.Replace("/", "=")); - string html = Encoding.UTF8.GetString(inArray); + return result; + } + private static Dictionary GetSignaturexDict(string shopId, string shopName) + { + if (string.IsNullOrEmpty(shopId)) + shopId = BaseClass.ShopId; + if (string.IsNullOrEmpty(shopName)) + shopName = BaseClass.ShopName; - html = html.Replace("C", "1"); - html = html.Replace("Q", "6"); - html = html.Replace("I", "2"); - html = html.Replace("L", "0"); - html = html.Replace("Z", "9"); - html = html.Replace("O", "5"); - html = html.Replace("P", "8"); - html = html.Replace("D", "7"); - html = html.Replace("R", "b"); - html = html.Replace("S", "c"); - html = html.Replace("J", "a"); - return html; - } - /// - /// MD5加密 - /// - /// - /// - public static string GetMd5(string instring) - { - byte[] result = Encoding.Default.GetBytes(instring.Trim()); - MD5 md5 = new MD5CryptoServiceProvider(); - byte[] output = md5.ComputeHash(result); - return BitConverter.ToString(output).Replace("-", ""); - } - /// - /// 获取验证码 - /// - /// - /// - /// - public static string SendCode(string mobile, out bool success) - { - string url = BaseClass.Build29WxObjString("sms_gate"); - string data = "mobile=" + mobile + "&" + GetSignature(); - string html = GetHtml.PostUtf8(url, data); - success = false; - if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) - { - return "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" + - "1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" + - "2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" + - "3、请不要使用代理上网,更换为路由或者直接链接\r\n" + - "4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" + - "5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助"; - } - if (!html.Contains("\"code\":200")) - { - var errMsg = BaseRegex.GetStringJson(ref html, "msg"); - if (string.IsNullOrEmpty(errMsg)) - errMsg = html; - return errMsg; - } - success = true; - return ""; - } + int time = BaseClass.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent; + string time1 = Encryption(time); + + var dict = new Dictionary + { + { "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; + } + /// + /// 签名算法 + /// + /// 随机数 + /// 加密签名结果 + public static string Encryptionxx(int s) + { + string ss = s.ToString(); + if (ss.Length > 8) + { + ss = ss.Substring(ss.Length - 8); + s = int.Parse(ss); + if (s < 100000000) + s += 100000000; + } + byte[] kb = Encoding.ASCII.GetBytes(s.ToString()); + if (BaseClass.NewSignatureAuth) + { + double y = s * 1.6081825125; + y += 4582095.48659959; + y += kb[3] * 934579.486548; + y += kb[7] + 4889894.30184; + byte[] k = Encoding.ASCII.GetBytes(y.ToString()); + y -= 478735.48548; + y -= k[6] * 426720.454545; + y -= k[2] * 5667826.96889; + byte[] k1 = Encoding.ASCII.GetBytes(y.ToString()); + y += 56979810.2455; + y -= k1[1] * 58742.0564845; + y -= k1[5] * 1528.487866; + string c = ((int)y).ToString(); + return GetMd5(c); //返回签名的MD5结果 + } + else + { + double y = s * 1.8061825125; + y += 4852095.48659959; + y += kb[3] * 943579.486548; + y += kb[7] + 4889894.30184; + byte[] k = Encoding.ASCII.GetBytes(y.ToString()); + y -= 458735.48548; + y -= k[6] * 458720.454545; + y -= k[2] * 5447826.96889; + byte[] k1 = Encoding.ASCII.GetBytes(y.ToString()); + y += 34779810.2455; + y -= k1[1] * 57942.0564845; + y -= k1[5] * 1548.487866; + string c = ((int)y).ToString(); + return GetMd5(c); //返回签名的MD5结果 + } + //double y = s * 1.8061825125; + //y += 4852095.48659959; + //y += kb[3] * 943579.486548; + //y += kb[7] + 4889894.30184; + //byte[] k = Encoding.ASCII.GetBytes(y.ToString()); + //y -= 458735.48548; + //y -= k[6] * 458720.454545; + //y -= k[2] * 5447826.96889; + //byte[] k1 = Encoding.ASCII.GetBytes(y.ToString()); + //y += 34779810.2455; + //y -= k1[1] * 57942.0564845; + //y -= k1[5] * 1548.487866; + //string c = ((int)y).ToString(); + //return GetMd5(c); //返回签名的MD5结果 + } + + /// + /// 签名算法 + /// + /// 随机数 + /// 加密签名结果 + public static string Encryption(int s) + { + //return GetMd5(s + "sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD"); + + string sign = $"{s}sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD"; + return GetMd5(sign); + + } + + public string Get(string key) + { + if (string.IsNullOrEmpty(key)) + return ""; + byte[] inArray = Convert.FromBase64String(key.Replace("/", "=")); + string html = Encoding.UTF8.GetString(inArray); + + html = html.Replace("C", "1"); + html = html.Replace("Q", "6"); + html = html.Replace("I", "2"); + html = html.Replace("L", "0"); + html = html.Replace("Z", "9"); + html = html.Replace("O", "5"); + html = html.Replace("P", "8"); + html = html.Replace("D", "7"); + html = html.Replace("R", "b"); + html = html.Replace("S", "c"); + html = html.Replace("J", "a"); + return html; + } + /// + /// MD5加密 + /// + /// + /// + public static string GetMd5(string instring) + { + byte[] result = Encoding.Default.GetBytes(instring.Trim()); + MD5 md5 = new MD5CryptoServiceProvider(); + byte[] output = md5.ComputeHash(result); + return BitConverter.ToString(output).Replace("-", ""); + } + /// + /// 获取验证码 + /// + /// + /// + /// + public static string SendCode(string mobile, out bool success) + { + string url = BaseClass.Build29WxObjString("sms_gate"); + string data = "mobile=" + mobile + "&" + GetSignature(); + string html = GetHtml.PostUtf8(url, data); + success = false; + if (string.IsNullOrEmpty(html) || html.Contains("Error No File")) + { + return "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" + + "1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" + + "2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" + + "3、请不要使用代理上网,更换为路由或者直接链接\r\n" + + "4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" + + "5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助"; + } + if (!html.Contains("\"code\":200")) + { + var errMsg = BaseRegex.GetStringJson(ref html, "msg"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = html; + return errMsg; + } + success = true; + return ""; + } - public static string JsCode = @"var auth = { + public static string JsCode = @"var auth = { getPublicKey: function() { var _this = this; Helper.get(""earth/api/queryPasswordEncrypt"", {}).then(function(d) { @@ -767,5 +805,5 @@ namespace Work } };auth.init();"; - } + } } diff --git a/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.Designer.cs b/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.Designer.cs index 163e480..99e436c 100644 --- a/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.Designer.cs +++ b/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.Designer.cs @@ -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 // @@ -474,14 +500,14 @@ namespace Work._29Tools.Forms.UserForms this.cmbType.FormattingEnabled = true; this.cmbType.Items.AddRange(new object[] { "", - "充值", - "管理员充值", - "支付宝充值", - "礼物单支出/礼物单退费", - "拍单扣除/作废返还", - "超重扣费支出", - "退货包裹扣费支出", - "云仓退货扣费支出"}); + "充值", + "管理员充值", + "支付宝充值", + "礼物单支出/礼物单退费", + "拍单扣除/作废返还", + "超重扣费支出", + "退货包裹扣费支出", + "云仓退货扣费支出"}); this.cmbType.Location = new System.Drawing.Point(42, 33); this.cmbType.Name = "cmbType"; this.cmbType.Size = new System.Drawing.Size(121, 25); @@ -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(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; diff --git a/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.cs b/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.cs index af9f0fa..d364531 100644 --- a/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.cs +++ b/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.cs @@ -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 types = new List { 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 types = new List { 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>(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 + { + /// + /// 充值总额 + /// + public long RechargeTotal { get; set; } + /// + /// 消费总额 + /// + public long ConsumeTotal { get; set; } + /// + /// 剩余余额 + /// + public long Balance { get; set; } + } } } diff --git a/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.resx b/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.resx index 0570d79..2a9ac61 100644 --- a/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.resx +++ b/Work/_29Tools/Forms/UserForms/WXGetBalanceQrCodeForm.resx @@ -1,17 +1,17 @@  -