优化登录与oem相关操作
This commit is contained in:
1 parent
a0b25ae79c
commit
c0b2719cbc
6 files changed
+156
-49
No files matched your search
@@ -51,7 +51,7 @@ namespace Work
|
||||
//new Thread(new JumpUpProductNew().Ini).Start();
|
||||
new Thread(CheckFiles).Start();
|
||||
//new Thread(UpdateTime).Start();
|
||||
//new Thread(GetMacCode).Start();
|
||||
new Thread(GetMacCode).Start();
|
||||
|
||||
//////new Thread(CheckUpdataFile).Start();
|
||||
CheckHecker r = new CheckHecker();
|
||||
|
||||
+86
-8
@@ -9,6 +9,8 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WxOrder.Framework;
|
||||
|
||||
namespace Work
|
||||
{
|
||||
@@ -148,17 +150,29 @@ namespace Work
|
||||
//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.ParentOemGiftAmount = BaseRegex.GetDecimalJson(ref html, "parent_gift_oem_amount_per_order");
|
||||
BaseClass.Balance = BaseRegex.GetDecimalJson(ref html, "balance"); /* 当前余额 */
|
||||
BaseClass.RechargeAmountTotal = BaseRegex.GetDecimalJson(ref html, "recharge_amount_total"); /* 充值总数 */
|
||||
//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.OemId = BaseRegex.GetStringJson(ref html, "oem_id");
|
||||
BaseClass.OemName = BaseRegex.GetStringJson(ref html, "oem_name");
|
||||
BaseClass.ParentOemId = BaseRegex.GetStringJson(ref html, "parent_oem_id");
|
||||
BaseClass.ParentOemName = BaseRegex.GetStringJson(ref html, "parent_oem_name");
|
||||
//BaseClass.ParentOemId = BaseRegex.GetStringJson(ref html, "parent_oem_id");
|
||||
//BaseClass.ParentOemName = BaseRegex.GetStringJson(ref html, "parent_oem_name");
|
||||
|
||||
|
||||
BaseClass.ParentPostageOemAmount = 0;
|
||||
BaseClass.PostageOemAmount = 0;
|
||||
BaseClass.ParentRefundPostageOemAmount = 0;
|
||||
BaseClass.RefundPostageOemAmount = 0;
|
||||
BaseClass.OemGiftAmount = 0; // BaseRegex.GetDecimalJson(ref html, "gift_oem_amount_per_order");
|
||||
BaseClass.ParentOemGiftAmount = 0; // BaseRegex.GetDecimalJson(ref html, "parent_gift_oem_amount_per_order");
|
||||
BaseClass.IsOemOwner = BaseRegex.GetBoolJson(ref html, "is_oem_owner");
|
||||
|
||||
// 获取加价信息
|
||||
JObject jObj = JsonHelper.JObjectParse(html);
|
||||
var dicMarkUp = JsonHelper.DeserializeJsonToObject<Dictionary<string, object>>(JsonHelper.SerializeObject(jObj["data"]["MakUpRule"]));
|
||||
GetUserOemAmount(dicMarkUp);
|
||||
|
||||
#if DEBUG
|
||||
if (!string.IsNullOrEmpty(BaseRegex.GetStringJson(ref html, "order_api_url")) && !BaseClass.LoginApiUrl.Contains("localhost") && !BaseClass.LoginApiUrl.Contains("127.0.0.1"))
|
||||
{
|
||||
@@ -300,6 +314,70 @@ namespace Work
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetUserOemAmount(Dictionary<string, object> oemMarkUpDic)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!oemMarkUpDic.Keys.Contains("16") || !oemMarkUpDic.Keys.Contains("20") || !oemMarkUpDic.Keys.Contains("26"))
|
||||
{
|
||||
BaseClass.UserId = 0;
|
||||
BaseClass.UserKey = 0;
|
||||
throw new Exception("账户信息获取失败");
|
||||
}
|
||||
|
||||
foreach (var key in oemMarkUpDic.Keys)
|
||||
{
|
||||
var jArr = JArray.Parse(oemMarkUpDic[key].ParseToString());
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
if (key == "16")
|
||||
{
|
||||
if (item["Level"].ParseToInt() == 1)
|
||||
{
|
||||
BaseClass.ParentOemId = item["OemId"].ParseToString();
|
||||
BaseClass.ParentOemGiftAmount = item["Markup"].ParseToInt() * 0.01m;
|
||||
}
|
||||
else if (item["Level"].ParseToInt() == 2)
|
||||
{
|
||||
BaseClass.OemId = item["OemId"].ParseToString();
|
||||
BaseClass.OemGiftAmount = item["Markup"].ParseToInt() * 0.01m;
|
||||
}
|
||||
}
|
||||
else if (key == "20")
|
||||
{
|
||||
if (item["Level"].ParseToInt() == 1)
|
||||
{
|
||||
BaseClass.ParentOemId = item["OemId"].ParseToString();
|
||||
BaseClass.ParentPostageOemAmount = item["Markup"].ParseToInt() * 0.01m;
|
||||
}
|
||||
else if (item["Level"].ParseToInt() == 2)
|
||||
{
|
||||
BaseClass.OemId = item["OemId"].ParseToString();
|
||||
BaseClass.PostageOemAmount = item["Markup"].ParseToInt() * 0.01m;
|
||||
}
|
||||
}
|
||||
else if (key == "26")
|
||||
{
|
||||
if (item["Level"].ParseToInt() == 1)
|
||||
{
|
||||
BaseClass.ParentOemId = item["OemId"].ParseToString();
|
||||
BaseClass.ParentRefundPostageOemAmount = item["Markup"].ParseToInt() * 0.01m;
|
||||
}
|
||||
else if (item["Level"].ParseToInt() == 2)
|
||||
{
|
||||
BaseClass.OemId = item["OemId"].ParseToString();
|
||||
BaseClass.RefundPostageOemAmount = item["Markup"].ParseToInt() * 0.01m;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册账户
|
||||
|
||||
Reference in new issue
Block a user