Files
KJD/Work/CollectClass/BankWithDraw.cs
T
2025-06-29 19:38:31 +08:00

231 lines
11 KiB
C#

using AllBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Work.Api;
using Work.ManageClass;
namespace Work.CollectClass
{
public class BankWithDraw
{
public static string Name = "账户提现";
public static string Name2 = "账户充值";
public string bankPhone;
public int amount;
public string code;
public ShopChatBase currentShop;
public static List<ShopChatBase> TempShops = new List<ShopChatBase>();
public void GetWithDraw()
{
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
{
var shop = GetShopLoginInfo.Shops[i];
if (!shop.SelectPayOrder || !shop.Showed)
continue;
string url = "https://mms.pinduoduo.com/uranus/api/account/balance/info";
string refere = "https://mms.pinduoduo.com/exp/mallPromotion";
string data = "{}";
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, shop.Cookies);
decimal accountMoney = BaseRegex.GetDecimalJson(ref html, "freeBalance") / 100m;
decimal available= BaseRegex.GetDecimalJson(ref html, "availableBalance") / 100m;
if (available < 0)
available = 0;
url = "https://mms.pinduoduo.com/uranus/api/finance/account/queryBankAccountListV2";
refere = "https://mms.pinduoduo.com/Pdd.html";
data = "{\"statusList\":[1,2]}";
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, shop.Cookies);
string bankName = BaseRegex.GetStringJson(ref html, "bankName");
string bankAccountName = BaseRegex.GetStringJson(ref html, "bankAccountName");
string bankAccountId = BaseRegex.GetStringJson(ref html, "bankAccountId");
string bankPhone = BaseRegex.GetStringJson(ref html, "bankPhone");
string bankCard = bankName + " " + bankAccountName + " " + bankAccountId;
//保证金
url = "https://mms.pinduoduo.com/uranus/api/deposit/mall?p=langlang12";
refere = "https://mms.pinduoduo.com/Pdd.html";
data = "{\"size\":\"5\" }";
//第一页匹配结果
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, shop.Cookies);
//保证金
decimal freeBalance = BaseRegex.GetDecimalJson(ref html, "freeBalance") / 100;
WithDraw w = new WithDraw();
w.bankName = bankName;
w.bankAccountName = bankAccountName;
w.bankAccountId = bankAccountId;
w.bankPhone = bankPhone;
w.accountMoney = available;// available;
w.freeBalance = freeBalance;
if (string.IsNullOrEmpty(bankName))
{
w.status = "没有绑定银行卡";
}
shop.withDraw = w;
TempShops.Add(shop);
LogSave.Add(Name, "商铺" + shop.ShopName + ",获取数据成功");
}
}
public void GetChongZhi()
{
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
{
var shop = GetShopLoginInfo.Shops[i];
if (!shop.SelectPayOrder || !shop.Showed)
continue;
string url = "https://mms.pinduoduo.com/uranus/api/deposit/mallDepositWithPending";
string refere = "https://mms.pinduoduo.com";
string data = "{}";
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, shop.Cookies);
long showDepositBalance = BaseRegex.GetLongJson(ref html, "showDepositBalance");
long thresholdBalance = BaseRegex.GetLongJson(ref html, "thresholdBalance");
long sub = thresholdBalance - showDepositBalance;
if (sub <= 0)
{
LogSave.Add(Name2, "商铺" + shop.ShopName + ",不需要充值,跳过");
continue;
}
url = "https://mms.pinduoduo.com/uranus/cashier/preCharge/shortUrl";
data = "{\"amount\":"+sub+",\"chargeType\":1,\"clientType\":1,\"successUrl\":\"/finance/deposit\",\"failedUrl\":\"/finance /deposit\"}";
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, shop.Cookies);
string shortUrl = BaseRegex.GetStringJson(ref html, "result");
url = "https://mms.pinduoduo.com/uranus/cashier/preCharge/information";
refere = "https://mms.pinduoduo.com/Pdd.html";
data = "{\"shortUrl\":\""+shortUrl+"\"}";
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, shop.Cookies);
long availableBalance = BaseRegex.GetLongJson(ref html, "availableBalance");
if (availableBalance < sub)
{
LogSave.Add(Name2, "商铺" + shop.ShopName + ",货款可用余额小于充值金额,跳过");
continue;
}
url = "https://mms.pinduoduo.com/uranus/api/finance/account/queryBankAccountListV2";
refere = "https://mms.pinduoduo.com/Pdd.html";
data = "{\"statusList\":[1,2]}";
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, shop.Cookies);
string bankPhone = BaseRegex.GetStringJson(ref html, "bankPhone");
if (string.IsNullOrEmpty(bankPhone))
continue;
WithDraw w = new WithDraw();
w.freeBalance = showDepositBalance / 100M;
w.bankPhone = bankPhone;
w.availableBalance = availableBalance;
w.subMoney = sub;
w.shortUrl = shortUrl;
shop.withDraw = w;
TempShops.Add(shop);
LogSave.Add(Name2, "商铺" + shop.ShopName + ",获取数据成功");
}
}
public void GetSingleWithDraw()
{
string url = "https://mms.pinduoduo.com/uranus/api/mall/balance";
string refere = "https://mms.pinduoduo.com/exp/mallPromotion";
string data = "{}";
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, currentShop.Cookies);
decimal accountMoney = BaseRegex.GetDecimalJson(ref html, "result") / 100m;
url = "https://mms.pinduoduo.com/uranus/api/finance/account/queryBankAccountListV2";
refere = "https://mms.pinduoduo.com/Pdd.html";
data = "{\"statusList\":[1,2]}";
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, currentShop.Cookies);
string bankName = BaseRegex.GetStringJson(ref html, "bankName");
string bankAccountName = BaseRegex.GetStringJson(ref html, "bankAccountName");
string bankAccountId = BaseRegex.GetStringJson(ref html, "bankAccountId");
string bankPhone = BaseRegex.GetStringJson(ref html, "bankPhone");
string bankCard = bankName + " " + bankAccountName + " " + bankAccountId;
//保证金
url = "https://mms.pinduoduo.com/uranus/api/deposit/mall?p=langlang12";
refere = "https://mms.pinduoduo.com/Pdd.html";
data = "{\"size\":\"5\" }";
//第一页匹配结果
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, currentShop.Cookies);
//保证金
decimal freeBalance = BaseRegex.GetDecimalJson(ref html, "freeBalance") / 100;
WithDraw w = new WithDraw();
w.bankName = bankName;
w.bankAccountName = bankAccountName;
w.bankAccountId = bankAccountId;
w.bankPhone = bankPhone;
w.accountMoney = accountMoney;
w.freeBalance = freeBalance;
if (!string.IsNullOrEmpty(currentShop.withDraw.status))
{
w.status = currentShop.withDraw.status;
w.datetime = currentShop.withDraw.datetime;
w.amount = currentShop.withDraw.amount;
}
currentShop.withDraw = w;
TempShops.Add(currentShop);
LogSave.Add(Name, "商铺" + currentShop.ShopName + ",获取数据成功");
}
public void GetCode()
{
string url = "https://mms.pinduoduo.com/uranus/api/phoneCodeWithPreCheckV2";
string refere = "https://mms.pinduoduo.com/Pdd.html";
string data = "{\"amount\":" + amount + ",\"withdrawType\":1}";
string html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, currentShop.Cookies, data, CpsSetAllGoods.getAnti0aon());
//string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, currentShop.Cookies);
if (html.Contains("\"success\":true"))
{
LogSave.Add(Name, "商铺"+currentShop.ShopName+",获取验证码成功");
return;
}
else
{
string errorMsg = BaseRegex.GetStringJson(ref html, "errorMsg");
LogSave.Add(Name, "商铺" + currentShop.ShopName + ",获取验证码失败"+errorMsg);
return;
}
}
public void ConformWithDraw()
{
string url = "https://mms.pinduoduo.com/uranus/api/balance/withdrawV2";
string refere = "https://mms.pinduoduo.com/Pdd.html";
string data = "{\"amount\":" + amount + ",\"phoneCode\":\"" + code + "\",\"withdrawType\":1}";
string html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, currentShop.Cookies, data, CpsSetAllGoods.getAnti0aon());
if (html.Contains("\"success\":true"))
{
LogSave.Add(Name, "商铺" + currentShop.ShopName + ",提现成功");
currentShop.withDraw.amount = amount / 100.0M;
currentShop.withDraw.datetime = DateTime.Now;
currentShop.withDraw.status = "提现成功";
}
else
{
string errorMsg = BaseRegex.GetStringJson(ref html, "errorMsg");
LogSave.Add(Name, "商铺" + currentShop.ShopName + ",提现失败,"+ errorMsg);
currentShop.withDraw.amount = amount / 100.0M;
currentShop.withDraw.datetime = DateTime.Now;
currentShop.withDraw.status = "提现失败," + errorMsg;
}
GetSingleWithDraw();
}
}
public class WithDraw
{
public string bankName = "";
public string bankAccountName = "";
public string bankAccountId ="";
public string bankPhone = "";
public decimal freeBalance = 0.0M;
public decimal accountMoney = 0.0M;
public decimal amount = 0.0M;//提现金额
public DateTime datetime = DateTime.MinValue;
public string status = "";
public long availableBalance = 0;//货款可用金额
public long subMoney = 0;//充值金额
public string shortUrl = "";
}
}