1拼多多接口上传及相关功能(不含部分功能) 2拼多多选品
This commit is contained in:
1 parent
ff42506091
commit
07b912e9eb
37 files changed
+21117
-206
No files matched your search
@@ -165,6 +165,12 @@
|
||||
<Compile Include="FileBase.cs" />
|
||||
<Compile Include="GetHtml.cs" />
|
||||
<Compile Include="GetProxyHtml.cs" />
|
||||
<Compile Include="HelperXiaoNaimao\DebugHelper.cs" />
|
||||
<Compile Include="HelperXiaoNaimao\FileHelper.cs" />
|
||||
<Compile Include="HelperXiaoNaimao\HtmlHelper.cs" />
|
||||
<Compile Include="HelperXiaoNaimao\HttpHelper.cs" />
|
||||
<Compile Include="HelperXiaoNaimao\LogHelper.cs" />
|
||||
<Compile Include="HelperXiaoNaimao\NaiBaGlobalConfig.cs" />
|
||||
<Compile Include="Helper\CommonSimRequest.cs" />
|
||||
<Compile Include="Helper\DataOpenSSL.cs" />
|
||||
<Compile Include="Helper\FissionDataBaseConfig.cs" />
|
||||
@@ -204,6 +210,7 @@
|
||||
<Compile Include="Model\Result\1688\_1688OneProductListInfo.cs" />
|
||||
<Compile Include="Model\Result\JST\JSTOrderInfo.cs" />
|
||||
<Compile Include="Model\Result\JST\JSTListProductSkuInfo.cs" />
|
||||
<Compile Include="Model\Result\PDDResult\ApiPddGoodsCatRuleInfo.cs" />
|
||||
<Compile Include="Model\Result\WXResult\WXAddressInfo.cs" />
|
||||
<Compile Include="Model\Result\WXResult\WXClientProductInfoLite.cs" />
|
||||
<Compile Include="Model\Result\WXResult\WXFinderTalentInfo.cs" />
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -750,6 +750,61 @@ namespace AllBase
|
||||
{
|
||||
return LoginApiUrl + "/wxxd_" + file + "?obj=" + BaseClass.MainPath + "/wxxd_" + file;
|
||||
}
|
||||
|
||||
private static char[] constant =
|
||||
{
|
||||
'0','1','2','3','4','5','6','7','8','9',
|
||||
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
|
||||
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 随机返回指定位数的字母数字组合
|
||||
/// </summary>
|
||||
/// <param name="iLength"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetRandomAlphanumeric(int iLength)
|
||||
{
|
||||
System.Text.StringBuilder newRandom = new System.Text.StringBuilder(62);
|
||||
for (int i = 0; i < iLength; i++)
|
||||
{
|
||||
newRandom.Append(constant[Randomx.GetId(62)]);
|
||||
}
|
||||
return newRandom.ToString();
|
||||
}
|
||||
|
||||
public static long ConvertDateTimeLong(DateTime time)
|
||||
{
|
||||
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
|
||||
return (long)(time - startTime).TotalMilliseconds;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取Unix毫秒级时间戳
|
||||
/// </summary>
|
||||
/// <returns>当前时间戳</returns>
|
||||
public static long ConvertDateTimeLong()
|
||||
{
|
||||
return (GetServerTimeString().ToUniversalTime().Ticks - 621355968000000000) / 10000;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取两个标题相似度
|
||||
/// </summary>
|
||||
/// <param name="refererTitle">参照标题</param>
|
||||
/// <param name="checkTitle">检测标题</param>
|
||||
/// <returns>相似度</returns>
|
||||
public static double GetSimularityBetween2Text(string refererTitle, string checkTitle)
|
||||
{
|
||||
double sameCnt = 0;
|
||||
for (int i = 0; i < refererTitle.Length; i++)
|
||||
{
|
||||
if (checkTitle.IndexOf(refererTitle.Substring(i, 1)) != -1)
|
||||
{
|
||||
sameCnt += 1;
|
||||
}
|
||||
}
|
||||
return Math.Round(sameCnt / Convert.ToDouble(refererTitle.Length), 2);
|
||||
}
|
||||
}
|
||||
|
||||
public class KeyValueBase
|
||||
|
||||
@@ -33,5 +33,9 @@ namespace AllBase.Helper
|
||||
public static string cAgentIpCode { get; } = "AFZ94w3a";
|
||||
|
||||
public static List<SameProductCheckParam> SameProductCheckParamList { get; set; }
|
||||
|
||||
|
||||
//public static string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36";
|
||||
public static string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Helper
|
||||
{
|
||||
public class DebugHelper
|
||||
{
|
||||
public static void WriteLine(string message, bool all = false)
|
||||
{
|
||||
Debug.WriteLine(message);
|
||||
if (all)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Helper
|
||||
{
|
||||
public class FileHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除文件夹及子文件内文件
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public static void DeleteFolder(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(path)) //如果存在这个文件夹删除之
|
||||
{
|
||||
foreach (string d in Directory.GetFileSystemEntries(path))
|
||||
{
|
||||
if (File.Exists(d))
|
||||
File.Delete(d); //直接删除其中的文件
|
||||
else
|
||||
DeleteFolder(d); //递归删除子文件夹
|
||||
}
|
||||
Directory.Delete(path, true); //删除已空文件夹
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteFile(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyFolder(string sourceFolder, string destFolder)
|
||||
{
|
||||
CreateDirectory(destFolder);
|
||||
string[] files = Directory.GetFiles(sourceFolder);
|
||||
foreach (string file in files)
|
||||
{
|
||||
string name = Path.GetFileName(file);
|
||||
string dest = Path.Combine(destFolder, name);
|
||||
File.Copy(file, dest);
|
||||
}
|
||||
string[] folders = Directory.GetDirectories(sourceFolder);
|
||||
foreach (string folder in folders)
|
||||
{
|
||||
string name = Path.GetFileName(folder);
|
||||
string dest = Path.Combine(destFolder, name);
|
||||
CopyFolder(folder, dest);
|
||||
}
|
||||
}
|
||||
|
||||
public static void MoveFolder(string sourceFolder, string destFolder)
|
||||
{
|
||||
CreateDirectory(destFolder);
|
||||
string[] files = Directory.GetFiles(sourceFolder);
|
||||
foreach (string file in files)
|
||||
{
|
||||
string name = Path.GetFileName(file);
|
||||
string dest = Path.Combine(destFolder, name);
|
||||
if (File.Exists(dest))
|
||||
{
|
||||
File.Delete(dest);
|
||||
}
|
||||
File.Move(file, dest);
|
||||
}
|
||||
string[] folders = Directory.GetDirectories(sourceFolder);
|
||||
foreach (string folder in folders)
|
||||
{
|
||||
string name = Path.GetFileName(folder);
|
||||
string dest = Path.Combine(destFolder, name);
|
||||
if (File.Exists(dest))
|
||||
{
|
||||
File.Delete(dest);
|
||||
}
|
||||
MoveFolder(folder, dest);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Execute(string command, int seconds)
|
||||
{
|
||||
string output = string.Empty; //输出字符串
|
||||
if (command != null && !command.Equals(string.Empty))
|
||||
{
|
||||
Process process = new Process();//创建进程对象
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = "cmd.exe";//设定需要执行的命令
|
||||
startInfo.Arguments = "/C " + command;//“/C”表示执行完命令后马上退出
|
||||
startInfo.UseShellExecute = false;//不使用系统外壳程序启动
|
||||
startInfo.RedirectStandardInput = false;//不重定向输入
|
||||
startInfo.RedirectStandardOutput = true; //重定向输出
|
||||
startInfo.CreateNoWindow = true;//不创建窗口
|
||||
process.StartInfo = startInfo;
|
||||
try
|
||||
{
|
||||
if (process.Start())//开始进程
|
||||
{
|
||||
if (seconds == 0)
|
||||
{
|
||||
process.WaitForExit();//这里无限等待进程结束
|
||||
}
|
||||
else
|
||||
{
|
||||
process.WaitForExit(seconds); //等待进程结束,等待时间为指定的毫秒
|
||||
}
|
||||
output = process.StandardOutput.ReadToEnd();//读取进程的输出
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);//捕获异常,输出异常信息
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (process != null)
|
||||
{
|
||||
process.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static void CreateDirectory(string dir)
|
||||
{
|
||||
if (Path.HasExtension(dir))
|
||||
{
|
||||
dir = Path.GetDirectoryName(dir);
|
||||
}
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ReadAllText(string filePath, Encoding encoding = null)
|
||||
{
|
||||
if (encoding == null)
|
||||
{
|
||||
return File.ReadAllText(filePath, Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
return File.ReadAllText(filePath, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteAllText(string filePathOrName, string content, Encoding encoding = null)
|
||||
{
|
||||
string path = Path.Combine(GetApplicationDir(), filePathOrName);
|
||||
CreateDirectory(path);
|
||||
if (encoding == null)
|
||||
{
|
||||
File.WriteAllText(path, content, Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.WriteAllText(path, content, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
public static void AppendAllText(string filePathOrName, string content, Encoding encoding = null)
|
||||
{
|
||||
string path = Path.Combine(GetApplicationDir(), filePathOrName);
|
||||
CreateDirectory(path);
|
||||
List<string> contentList = new List<string> { content };
|
||||
if (encoding == null)
|
||||
{
|
||||
File.AppendAllLines(path, contentList, Encoding.UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.AppendAllLines(path, contentList, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
#region 获取软件所在目录
|
||||
public static string GetApplicationDir()
|
||||
{
|
||||
return AppDomain.CurrentDomain.BaseDirectory;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string GetParentDir(string dir)
|
||||
{
|
||||
dir = dir.Trim(Path.DirectorySeparatorChar);
|
||||
int last = dir.LastIndexOf(Path.DirectorySeparatorChar);
|
||||
if (last > 0)
|
||||
{
|
||||
return dir.Substring(0, last);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
public static string GetResourceFileContent(Assembly assembly, string resourceName)
|
||||
{
|
||||
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
string result = reader.ReadToEnd();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Stream GetResourceFileStream(Assembly assembly, string resourceName)
|
||||
{
|
||||
// 调用之后要释放 stream
|
||||
Stream stream = assembly.GetManifestResourceStream(assembly.GetCustomAttribute<AssemblyTitleAttribute>().Title + "." + resourceName);
|
||||
return stream;
|
||||
}
|
||||
|
||||
public static void SaveStream(Stream stream, string destPath)
|
||||
{
|
||||
CreateDirectory(destPath);
|
||||
using (var fileStream = new FileStream(destPath, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
stream.CopyTo(fileStream);
|
||||
}
|
||||
}
|
||||
|
||||
public static long GetDirectorySize(string folderPath)
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(folderPath);
|
||||
if (!di.Exists)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return di.EnumerateFiles("*", SearchOption.AllDirectories).Sum(fi => fi.Length);
|
||||
}
|
||||
|
||||
public static void OpenUrl(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(url);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OpenDirectory(string dir)
|
||||
{
|
||||
Process.Start("explorer.exe", dir);
|
||||
}
|
||||
|
||||
public static string GetFileName(string dir)
|
||||
{
|
||||
string fileName = Path.GetFileName(dir);
|
||||
int questionMark = fileName.IndexOf("?");
|
||||
if (questionMark > 0)
|
||||
{
|
||||
fileName = fileName.Substring(0, questionMark);
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Helper
|
||||
{
|
||||
public class HtmlHelper
|
||||
{
|
||||
public static string HtmlEncode(string html)
|
||||
{
|
||||
if (string.IsNullOrEmpty(html))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return HttpUtility.HtmlEncode(html);
|
||||
}
|
||||
}
|
||||
|
||||
public static string HtmlDecode(string url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return HttpUtility.HtmlDecode(url);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unicode解码
|
||||
/// </summary>
|
||||
/// <param name="html"></param>
|
||||
/// <returns></returns>
|
||||
public static string UnicodeDecode(string html)
|
||||
{
|
||||
html = WebUtility.HtmlDecode(html);
|
||||
|
||||
Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled);
|
||||
return reUnicode.Replace(html, m =>
|
||||
{
|
||||
short c;
|
||||
if (short.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c))
|
||||
{
|
||||
return "" + (char)c;
|
||||
}
|
||||
return m.Value;
|
||||
});
|
||||
}
|
||||
|
||||
#region Resove
|
||||
public static string Resove(string html, string prefix, string subfix)
|
||||
{
|
||||
int inl = html.IndexOf(prefix);
|
||||
if (inl == -1)
|
||||
{
|
||||
prefix = prefix.Replace("\"", "'");
|
||||
subfix = subfix.Replace("\"", "'");
|
||||
inl = html.IndexOf(prefix);
|
||||
}
|
||||
if (inl == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
inl += prefix.Length;
|
||||
if (!string.IsNullOrEmpty(subfix))
|
||||
{
|
||||
int inl2 = html.IndexOf(subfix, inl);
|
||||
if (inl2 == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string result = html.Substring(inl, inl2 - inl);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
string result = html.Substring(inl);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ResoveReverse
|
||||
public static string ResoveReverse(string html, string subfix, string prefix)
|
||||
{
|
||||
int inl = html.IndexOf(subfix);
|
||||
if (inl == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string subString = html.Substring(0, inl);
|
||||
int inl2 = subString.LastIndexOf(prefix);
|
||||
if (inl2 == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string s = subString.Substring(inl2 + prefix.Length, subString.Length - inl2 - prefix.Length);
|
||||
return s;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ResoveList
|
||||
public static List<string> ResoveList(string html, string prefix, string subfix)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
int index = 0;
|
||||
do
|
||||
{
|
||||
index = html.IndexOf(prefix, index);
|
||||
if (index == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
index += prefix.Length;
|
||||
int indexEnd = html.IndexOf(subfix, index);
|
||||
if (indexEnd > 0)
|
||||
{
|
||||
string content = html.Substring(index, indexEnd - index);
|
||||
list.Add(content);
|
||||
}
|
||||
index = indexEnd;
|
||||
}
|
||||
while (index > -1);
|
||||
return list;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ResoveListByAT
|
||||
public static List<string> ResoveListByAT(string html)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
|
||||
int index = html.IndexOf('@');
|
||||
while (index > 0)
|
||||
{
|
||||
int indexx = html.LastIndexOf("'", index); //向前一个单引号
|
||||
int indexy = html.IndexOf("'", index + 1); //向后一个单引号
|
||||
string s78 = html.Substring(indexx, indexy - indexx);
|
||||
s78 = s78.Replace("'", "");
|
||||
list.Add(s78);
|
||||
index = html.IndexOf('@', indexy);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 清除HTML代码
|
||||
/// </summary>
|
||||
/// <param name="html"></param>
|
||||
public static string ClearHtml(string html)
|
||||
{
|
||||
html = html.ParseToString();
|
||||
html = Regex.Replace(html, @"(<head[\w\W]*?</head>|<script[\w\W]*?</script>|<style[\w\W]*?</style>|<!--[\w\W]*?-->)", string.Empty);
|
||||
html = Regex.Replace(html, @"(<span[\w\W]*?</span>)", string.Empty);
|
||||
html = Regex.Replace(html, "(<[^>]*?>)", string.Empty);
|
||||
return html;
|
||||
}
|
||||
|
||||
public static string GetHtmlText(string html)
|
||||
{
|
||||
html = html.ParseToString();
|
||||
html = Regex.Replace(html, "<.*?>", string.Empty);
|
||||
return html;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除HTML代码A标签
|
||||
/// </summary>
|
||||
/// <param name="html"></param>
|
||||
/// <returns></returns>
|
||||
public static string ClearHtmlA(string html)
|
||||
{
|
||||
html = html.ParseToString();
|
||||
html = Regex.Replace(html, "(</?a[^>]*>)", "", RegexOptions.IgnoreCase);
|
||||
return html.Trim();
|
||||
}
|
||||
|
||||
public static string AddEscapeCharacter(string html)
|
||||
{
|
||||
html = html.ParseToString();
|
||||
html = html.Replace("\"", "\\\"");
|
||||
html = html.Replace("'", "\\'");
|
||||
return html;
|
||||
}
|
||||
|
||||
public static string TrimBOM(string html)
|
||||
{
|
||||
html = html.Trim(new char[] { '\uFEFF' });
|
||||
return html;
|
||||
}
|
||||
|
||||
public static string TrimJsonp(string json)
|
||||
{
|
||||
int start = json.IndexOf("{");
|
||||
int end = json.LastIndexOf("}");
|
||||
if (start > 0 && end > 0)
|
||||
{
|
||||
return json.Substring(start, end - start + 1);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,145 @@
|
||||
using AllBase.Extension;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Helper
|
||||
{
|
||||
public class LogHelper
|
||||
{
|
||||
private static object lockHelper = new object();
|
||||
|
||||
#region 写文本日志
|
||||
/// <summary>
|
||||
/// 写日志 异步
|
||||
/// 默认路径:根目录/Log/yyyy-MM/
|
||||
/// 默认文件:yyyy-MM-dd.log
|
||||
/// </summary>
|
||||
/// <param name="logContent">日志内容 自动附加时间</param>
|
||||
public static void Write(string logContent)
|
||||
{
|
||||
string logPath = DateTime.Now.ToString("yyyy-MM");
|
||||
Write(logPath, logContent);
|
||||
}
|
||||
|
||||
public static void WriteWithTime(string logContent)
|
||||
{
|
||||
string logPath = DateTime.Now.ToString("yyyy-MM");
|
||||
logContent = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + Environment.NewLine + logContent;
|
||||
Write(logPath, logContent);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 写异常日志
|
||||
/// <summary>
|
||||
/// 写异常日志
|
||||
/// </summary>
|
||||
/// <param name="ex"></param>
|
||||
public static void Write(Exception ex)
|
||||
{
|
||||
string logContent = string.Empty;
|
||||
string logPath = DateTime.Now.ToString("yyyy-MM");
|
||||
logContent += GetExceptionMessage(ex);
|
||||
Write(logPath, logContent);
|
||||
}
|
||||
|
||||
public static void WriteWithTime(Exception ex, string messageExtend = "")
|
||||
{
|
||||
string logContent = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + Environment.NewLine;
|
||||
string logPath = DateTime.Now.ToString("yyyy-MM");
|
||||
logContent += GetExceptionMessage(ex, messageExtend);
|
||||
Write(logPath, logContent);
|
||||
}
|
||||
|
||||
private static string GetExceptionMessage(Exception ex, string messageExtend = "")
|
||||
{
|
||||
string message = string.Empty;
|
||||
if (ex != null)
|
||||
{
|
||||
message += ex.Message;
|
||||
message += Environment.NewLine;
|
||||
if (!string.IsNullOrEmpty(messageExtend))
|
||||
{
|
||||
message += messageExtend;
|
||||
message += Environment.NewLine;
|
||||
}
|
||||
Exception originalException = ex.GetOriginalException();
|
||||
if (originalException != null)
|
||||
{
|
||||
if (originalException.Message != ex.Message)
|
||||
{
|
||||
message += originalException.Message;
|
||||
message += Environment.NewLine;
|
||||
}
|
||||
}
|
||||
message += ex.StackTrace;
|
||||
message += Environment.NewLine;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 写日志到指定路径
|
||||
/// <summary>
|
||||
/// 写日志 异步
|
||||
/// 默认文件:yyyy-MM-dd.log
|
||||
/// </summary>
|
||||
/// <param name="logPath">日志目录[默认程序根目录\Log\下添加,故使用相对路径,如:营销任务]</param>
|
||||
/// <param name="logContent">日志内容 自动附加时间</param>
|
||||
public static void Write(string logPath, string logContent)
|
||||
{
|
||||
string logFileName = DateTime.Now.ToString("yyyy-MM-dd") + ".log";
|
||||
Write(logPath, logFileName, logContent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写日志 异步
|
||||
/// </summary>
|
||||
/// <param name="logPath">日志目录</param>
|
||||
/// <param name="logFileName">日志文件名</param>
|
||||
/// <param name="logContent">日志内容 自动附加时间</param>
|
||||
public static void Write(string logPath, string logFileName, string logContent)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(logContent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(logPath))
|
||||
{
|
||||
logPath = Path.Combine(FileHelper.GetApplicationDir(), NaiBaGlobalConfig.Log, DateTime.Now.ToString("yyyy-MM"));
|
||||
}
|
||||
else
|
||||
{
|
||||
logPath = Path.Combine(FileHelper.GetApplicationDir(), NaiBaGlobalConfig.Log, logPath.Trim('\\'));
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(logFileName))
|
||||
{
|
||||
logFileName = DateTime.Now.ToString("yyyy-MM-dd") + ".log";
|
||||
}
|
||||
if (!Directory.Exists(logPath))
|
||||
{
|
||||
Directory.CreateDirectory(logPath);
|
||||
}
|
||||
string fileName = Path.Combine(logPath, logFileName);
|
||||
Action taskAction = () =>
|
||||
{
|
||||
lock (lockHelper)
|
||||
{
|
||||
using (StreamWriter sw = File.AppendText(fileName))
|
||||
{
|
||||
sw.WriteLine(logContent + Environment.NewLine);
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
}
|
||||
};
|
||||
Task task = new Task(taskAction);
|
||||
task.Start();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Helper
|
||||
{
|
||||
public class NaiBaGlobalConfig
|
||||
{
|
||||
public static bool IsDevelopment { get; set; } // 判断是否是开发环境
|
||||
public static bool IsNewFeature { get; set; }
|
||||
public static bool IsNotNeedLogin = false;
|
||||
public static DateTime DefaultDateTime = "2000-01-01 00:00:00".ParseToDateTime();
|
||||
public static string Proxy = "127.0.0.1:8888"; // 请求Fiddler代理,仅做开发测试使用
|
||||
public static string VersionUrl = "https://update.qixiaoke.com/updatex/kingdragorse.php";
|
||||
public static string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36";
|
||||
public static List<string> NoProxyDomainList = new List<string>(); // 不走系统代理的域名
|
||||
public static string ResourcesFileRelativeDir = @"Resources\file\";
|
||||
public static string ResourcesFileAbsolutePath = Path.Combine(FileHelper.GetApplicationDir(), ResourcesFileRelativeDir);
|
||||
|
||||
public const string Data = "data"; // data 文件目录
|
||||
public const string Config = "config"; // config 文件目录
|
||||
public const string Image = "image"; // image 文件目录
|
||||
public const string Log = "log";
|
||||
public const string Cache = "cache"; // cache 文件目录
|
||||
public const int MillisecondsClose = 3000; // 默认3秒钟自动关闭信息弹出框
|
||||
public const string DefaultDateFormat = "yyyy-MM-dd";
|
||||
public const string DefaultTimeFormat = "HH:mm:ss";
|
||||
public const string DefaultDateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
public const string NoYearDateTimeFormat = "MM-dd HH:mm:ss";
|
||||
public const string HtmlBR = "<br>";
|
||||
|
||||
public const string ConfirmDeleteText = "确认删除[{0}]条数据吗?";
|
||||
public const string ConfirmClearText = "确认清空吗?";
|
||||
public const string NoSelectDataText = "您还未选择任何数据";
|
||||
public const string NoDataText = "没有需要处理的数据";
|
||||
public const string ProcessingText = "正在{0}...";
|
||||
|
||||
public const string ChinaCountryCode = "cn";
|
||||
|
||||
public const char NumberSignSplitChar = '#';
|
||||
public const char SplitChar = '♯';
|
||||
public const char Tab = '\t';
|
||||
|
||||
public static List<string> UserAgentList { get; set; } // https://developers.whatismybrowser.com/useragents/explore/software_name/chrome/ $(".useragent").each(function(){console.log($(this).text()+'\r\n')});
|
||||
|
||||
#region 全局委托
|
||||
public static Func<string, string> EvaluateScript; // 执行 JavaScript
|
||||
#endregion
|
||||
|
||||
|
||||
#region 开发代理
|
||||
public static IWebProxy GetDevelopProxy(string url = "")
|
||||
{
|
||||
// 请求Fiddler代理,仅做开发测试使用
|
||||
if (IsDevelopment && !string.IsNullOrEmpty(Proxy) && Process.GetProcessesByName("FF").Length > 0)
|
||||
{
|
||||
var proxyArr = Proxy.Split(':');
|
||||
return new WebProxy(proxyArr[0], proxyArr[1].ParseToInt());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
string host = new Uri(url).Host;
|
||||
if (NoProxyDomainList.Contains(host))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return WebRequest.DefaultWebProxy;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 计算软件版本
|
||||
public static string GetVersionString(int major, int minor)
|
||||
{
|
||||
string versionNo = major + "." + minor.ToString().PadLeft(2, '0');
|
||||
return versionNo;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Param.ToolsManage
|
||||
{
|
||||
public class ADSLAccountParam
|
||||
{
|
||||
public bool IsUseAdsl { get; set; }
|
||||
public string Account { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Param.ToolsManage
|
||||
{
|
||||
public class ProductMappingExportInfo : ProductMappingImportParam
|
||||
{
|
||||
/// <summary>
|
||||
/// 虚拟上家来源,淘宝,京东,苏宁
|
||||
/// </summary>
|
||||
public string FakeMappingFrom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 找到的真实的虚假上家商品ID
|
||||
/// </summary>
|
||||
public string FakeMappingProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品真实上家数据Json
|
||||
/// </summary>
|
||||
public string ProductDataJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 虚拟上家产品价格
|
||||
/// </summary>
|
||||
public int FakeMappingProductPrice { get; set; }
|
||||
|
||||
public string FakeMappingProductMaxPrice { get; set; }
|
||||
|
||||
public string FakeMappingProductMinPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 苏宁上家时的商家ID(搜索价格用)
|
||||
/// </summary>
|
||||
public string FakeMappingVendorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 运费
|
||||
/// </summary>
|
||||
public string PostFee { get; set; }
|
||||
|
||||
public string MappingQuery {get;set;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Param.ToolsManage
|
||||
{
|
||||
public class ProductMappingImportParam
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品来源,目前支持淘宝,拼多多(搜款网),阿里巴巴
|
||||
/// </summary>
|
||||
public string From { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品ID
|
||||
/// </summary>
|
||||
public string ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 记录当商品来源为搜款网(实际为拼多多)时对应的真实Id
|
||||
/// </summary>
|
||||
public string RealProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品标题
|
||||
/// </summary>
|
||||
public string ProductTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上家类目
|
||||
/// </summary>
|
||||
public string CatId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类目4
|
||||
/// </summary>
|
||||
public string CatId4 { get; set; }
|
||||
/// <summary>
|
||||
/// 类目3
|
||||
/// </summary>
|
||||
public string CatId3 { get; set; }
|
||||
/// <summary>
|
||||
/// 类目2
|
||||
/// </summary>
|
||||
public string CatId2 { get; set; }
|
||||
/// <summary>
|
||||
/// 类目1
|
||||
/// </summary>
|
||||
public string CatId1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品主类目
|
||||
/// </summary>
|
||||
public string MainCid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用来搜索同款的图片网址
|
||||
/// </summary>
|
||||
public string Image { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射关系建立的结果
|
||||
/// </summary>
|
||||
public string MappingResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微店分成推广金设置结果
|
||||
/// </summary>
|
||||
public string CPSResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最低价格
|
||||
/// </summary>
|
||||
public int MinPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最高价格
|
||||
/// </summary>
|
||||
public int MaxPrice { get; set; }
|
||||
/// <summary>
|
||||
/// 数据来源0 是其他 1是净化数据
|
||||
/// </summary>
|
||||
public int dataSoure { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 转换成功来源 未知,Api,模拟,缓存等 统计用
|
||||
/// </summary>
|
||||
public string MappingResourceType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Result.PDDResult
|
||||
{
|
||||
public class ApiPddGoodsCatRuleInfo
|
||||
{
|
||||
public int? input_max_spec_num { get; set; } // 0,
|
||||
public List<ApiPddProperty> properties { get; set; }
|
||||
public bool? choose_all_qualify_spec { get; set; } // false
|
||||
}
|
||||
|
||||
public class ApiPddProperty
|
||||
{
|
||||
public bool? is_sale { get; set; } // false,
|
||||
public bool? is_important { get; set; } // true,
|
||||
public bool? is_sku { get; set; } // false,
|
||||
public List<ApiPddPropertyValue> values { get; set; } // Array[11],
|
||||
public int? value_precision { get; set; } // 0,
|
||||
public int? input_max_num { get; set; } // 0,
|
||||
public bool? required { get; set; } // false,
|
||||
public object required_rule { get; set; }
|
||||
public int? required_rule_type { get; set; } // 0,
|
||||
public int? choose_max_num { get; set; } // 1,
|
||||
public string min_value { get; set; } // "",
|
||||
public bool? can_note { get; set; } // false,
|
||||
public long? ref_pid { get; set; } // 1366,
|
||||
public string name { get; set; } // "穿耳材质",
|
||||
public List<string> value_unit { get; set; } // [ "" ],
|
||||
public string max_value { get; set; } // "",
|
||||
public int? property_value_type { get; set; } // 0
|
||||
|
||||
}
|
||||
|
||||
public class ApiPddPropertyValue
|
||||
{
|
||||
public long? vid { get; set; } // 10629, // 12854,
|
||||
public string value { get; set; } // "其它", // "塑料",
|
||||
|
||||
}
|
||||
}
|
||||
@@ -99,9 +99,10 @@ namespace AllBase.Model.Result
|
||||
public string GroupName { get; set; }
|
||||
public DateTime AddTime { get; set; }
|
||||
public string LastRefreshDate { get; set; }
|
||||
public string AccessToken { get { return CurrentAuthInfo?.AccessToken; } }
|
||||
public string RefreshToken { get { return CurrentAuthInfo?.RefreshToken; } }
|
||||
public string AppKey { get { return CurrentAuthInfo?.AppKey; } }
|
||||
public string AccessToken { get { return (CurrentAuthInfo?.AccessToken).ParseToString(); } }
|
||||
public string RefreshToken { get { return (CurrentAuthInfo?.RefreshToken).ParseToString(); } }
|
||||
public string AppKey { get { return (CurrentAuthInfo?.AppKey).ParseToString(); } }
|
||||
public string AppSecret { get { return (CurrentAuthInfo?.AppSecret).ParseToString(); } }
|
||||
public DateTime AuthAddTime { get { return CurrentAuthInfo?.AddTime == null ? new DateTime() : CurrentAuthInfo.AddTime; } }
|
||||
public DateTime AuthExpiresTime { get { return CurrentAuthInfo?.ExpiresTime == null ? new DateTime() : CurrentAuthInfo.ExpiresTime; } }
|
||||
/// <summary>
|
||||
@@ -206,6 +207,7 @@ namespace AllBase.Model.Result
|
||||
public string AccessToken { get; set; } = "";
|
||||
public string RefreshToken { get; set; } = "";
|
||||
public string AppKey { get; set; } = "";
|
||||
public string AppSecret { get; set; } = "";
|
||||
public DateTime ExpiresTime { get; set; }
|
||||
public DateTime AddTime { get; set; } = DateTime.MinValue;
|
||||
public string ApiAuthStatus { get; set; } = "未授权";
|
||||
|
||||
@@ -1323,8 +1323,8 @@ namespace KJD_Web.BLL.BXX
|
||||
sql += where;
|
||||
|
||||
int count = prod_count;
|
||||
if (product_get_type == "厂商直采" && count > 1500)
|
||||
count /= 3;
|
||||
if (product_get_type == "厂商直采" && count > 1250)
|
||||
count = (count / 2.5).ParseToInt();
|
||||
if (!is_not_count)
|
||||
{
|
||||
count = mySql.ExecuteRowCount(sql);
|
||||
@@ -1416,7 +1416,7 @@ namespace KJD_Web.BLL.BXX
|
||||
var data = JsonUtils.SerializeObjectToString(productLst, jsonSetting);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
if (product_get_type == "厂商直采" && count > 500)
|
||||
count *= 3;
|
||||
count = (count * 2.5).ParseToInt();
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -19,6 +19,11 @@ namespace TemuKJD.BLL.PddApi
|
||||
|
||||
public PddApi(ShopLoginInfo shop)
|
||||
{
|
||||
if (shop.CurrentAuthInfo == null)
|
||||
{
|
||||
PddApiHelper.RefreshApi(shop);
|
||||
}
|
||||
|
||||
Data["access_token"] = shop.AccessToken;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Result;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
@@ -12,6 +13,25 @@ namespace TemuKJD.BLL.PddApi
|
||||
{
|
||||
public class PddApiHelper
|
||||
{
|
||||
public static void RefreshApi(ShopLoginInfo shop, bool isForceRefresh = false)
|
||||
{
|
||||
if (isForceRefresh || shop.AuthAddTime <= DateTime.Now.AddDays(-1))
|
||||
{
|
||||
shop.ApiAuthInfoList.Clear();
|
||||
|
||||
var authInfo = PddApiHelper.GetShopPddToken(shop);
|
||||
shop.ApiAuthInfoList.Add(authInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RefreshApi(List<ShopLoginInfo> shops, bool isForceRefresh = false)
|
||||
{
|
||||
foreach (var shop in shops)
|
||||
{
|
||||
RefreshApi(shop, isForceRefresh);
|
||||
}
|
||||
}
|
||||
|
||||
public static AuthInfo GetShopPddToken(ShopLoginInfo shop)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("shop/e57_get_pdd_shop_token");
|
||||
@@ -26,13 +46,31 @@ namespace TemuKJD.BLL.PddApi
|
||||
var token = new AuthInfo()
|
||||
{
|
||||
ShopId = shop.ShopId,
|
||||
AppKey = BaseClass.GetFileMd5(BaseRegex.GetStringJson(ref html, "appKey").ParseToString()),
|
||||
AddTime = DateTime.Now,
|
||||
AppKey = BaseRegex.GetStringJson(ref html, "appKey").ParseToString(),
|
||||
AccessToken = BaseRegex.GetStringJson(ref html, "accessToken"),
|
||||
ExpiresTime = BaseClass.StampToDateTime(BaseRegex.GetIntJson(ref html, "tokenExpiresTime")),
|
||||
ApiAuthStatus = "授权成功",
|
||||
};
|
||||
return token;
|
||||
}
|
||||
return new AuthInfo() { ShopId = shop.ShopId, AccessToken = "", ExpiresTime = DateTime.Now };
|
||||
return new AuthInfo() { ShopId = shop.ShopId, AddTime = DateTime.Now, ExpiresTime = DateTime.Now };
|
||||
}
|
||||
|
||||
public static void PddGetLocalTokens()
|
||||
{
|
||||
if (BaseClass.MainPath == "binxixi")
|
||||
{
|
||||
List<List<AuthInfo>> lsts = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<List<AuthInfo>>>("pdd_shop_api_auth_info_lists");
|
||||
if (lsts == null)
|
||||
lsts = new List<List<AuthInfo>>();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
shop.ApiAuthInfoList = lsts.FirstOrDefault(l => l.FirstOrDefault()?.ShopId == shop.ShopId);
|
||||
if (shop.ApiAuthInfoList == null)
|
||||
shop.ApiAuthInfoList = new List<AuthInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void UpdateShopTokens(List<ShopLoginInfo> shops)
|
||||
public static void UpdateDyShopTokens(List<ShopLoginInfo> shops)
|
||||
{
|
||||
string shopIds = "";
|
||||
foreach (var shop in shops)
|
||||
@@ -1233,7 +1233,7 @@ namespace TemuKJD.KJDForms.ShopForms
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateShopTokens(GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopAccount)).ToList());
|
||||
UpdateDyShopTokens(GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopAccount)).ToList());
|
||||
Task.Run(() =>
|
||||
{
|
||||
CheckShopListLogin(shopNameList.ToArray());
|
||||
|
||||
+214
-102
@@ -30,14 +30,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
|
||||
this.txtAddShippingFeeTimes = new System.Windows.Forms.TextBox();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.btnApiUpload = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnUpload = new DevComponents.DotNetBar.PanelEx();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
@@ -69,14 +72,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.chkAddMorePriceFirst = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.btnClearDgv = new DevComponents.DotNetBar.PanelEx();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.txtSinglePriceAdd = new System.Windows.Forms.TextBox();
|
||||
this.panel4 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.fPnlPriceRule = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.ucAddPrice1 = new TemuKJD.PDDForms.ProductSelectForms.UcAddPrice();
|
||||
this.ucAddPrice3 = new TemuKJD.PDDForms.ProductSelectForms.UcAddPrice();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.lblNewAddPrice = new System.Windows.Forms.Label();
|
||||
this.txtAddMorePrice = new System.Windows.Forms.TextBox();
|
||||
this.txtAddTimes = new System.Windows.Forms.TextBox();
|
||||
@@ -88,7 +89,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.chkChance = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.chkLowPriceSku = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.lblLowPriceSkuImg = new System.Windows.Forms.Label();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
|
||||
this.btnProdDb = new DevComponents.DotNetBar.PanelEx();
|
||||
this.chkSkipQualification = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.cmbSourceType = new System.Windows.Forms.ComboBox();
|
||||
@@ -108,9 +112,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.lblGoodsCount = new System.Windows.Forms.Label();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
|
||||
this.btnRefreshApi = new DevComponents.DotNetBar.PanelEx();
|
||||
this.btnRefreshShop = new DevComponents.DotNetBar.PanelEx();
|
||||
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.pbShopLoading = new System.Windows.Forms.PictureBox();
|
||||
this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
|
||||
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -119,6 +125,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSelectProduct = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colApiStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -174,6 +181,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.splitContainer2.Panel1.SuspendLayout();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbShopLoading)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).BeginInit();
|
||||
@@ -210,6 +218,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
|
||||
this.ucGroupBoxEx2.Controls.Add(this.txtAddShippingFeeTimes);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label12);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.btnApiUpload);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.btnUpload);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label7);
|
||||
@@ -241,10 +251,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucGroupBoxEx2.Controls.Add(this.chkAddMorePriceFirst);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.btnClearDgv);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label14);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label15);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.txtSinglePriceAdd);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.panel4);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label11);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.lblNewAddPrice);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.txtAddMorePrice);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.txtAddTimes);
|
||||
@@ -256,6 +264,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucGroupBoxEx2.Controls.Add(this.chkChance);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.chkLowPriceSku);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.lblLowPriceSkuImg);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label15);
|
||||
this.ucGroupBoxEx2.Controls.Add(this.label11);
|
||||
this.ucGroupBoxEx2.Location = new System.Drawing.Point(459, 2);
|
||||
this.ucGroupBoxEx2.Name = "ucGroupBoxEx2";
|
||||
this.ucGroupBoxEx2.Size = new System.Drawing.Size(1062, 140);
|
||||
@@ -263,6 +273,28 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucGroupBoxEx2.TabStop = false;
|
||||
this.ucGroupBoxEx2.Text = "商品上传";
|
||||
//
|
||||
// txtAddShippingFeeTimes
|
||||
//
|
||||
this.txtAddShippingFeeTimes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtAddShippingFeeTimes.Location = new System.Drawing.Point(421, 110);
|
||||
this.txtAddShippingFeeTimes.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtAddShippingFeeTimes.Name = "txtAddShippingFeeTimes";
|
||||
this.txtAddShippingFeeTimes.Size = new System.Drawing.Size(31, 23);
|
||||
this.txtAddShippingFeeTimes.TabIndex = 756;
|
||||
this.txtAddShippingFeeTimes.Text = "1.0";
|
||||
this.txtAddShippingFeeTimes.TextChanged += new System.EventHandler(this.txtAddPrice_TextChanged);
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(384, 113);
|
||||
this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(41, 17);
|
||||
this.label12.TabIndex = 755;
|
||||
this.label12.Text = "运费×";
|
||||
//
|
||||
// btnApiUpload
|
||||
//
|
||||
this.btnApiUpload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -286,7 +318,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.btnApiUpload.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnApiUpload.TabIndex = 742;
|
||||
this.btnApiUpload.Text = "批量上传";
|
||||
this.btnApiUpload.Visible = false;
|
||||
this.btnApiUpload.Click += new System.EventHandler(this.btnApiUpload_Click);
|
||||
//
|
||||
// btnUpload
|
||||
@@ -626,11 +657,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
// chkAddMorePriceFirst
|
||||
//
|
||||
this.chkAddMorePriceFirst.AutoSize = true;
|
||||
this.chkAddMorePriceFirst.Location = new System.Drawing.Point(306, 111);
|
||||
this.chkAddMorePriceFirst.Location = new System.Drawing.Point(291, 111);
|
||||
this.chkAddMorePriceFirst.Name = "chkAddMorePriceFirst";
|
||||
this.chkAddMorePriceFirst.Size = new System.Drawing.Size(111, 21);
|
||||
this.chkAddMorePriceFirst.Size = new System.Drawing.Size(99, 21);
|
||||
this.chkAddMorePriceFirst.TabIndex = 625;
|
||||
this.chkAddMorePriceFirst.Text = "加价时先加再乘";
|
||||
this.chkAddMorePriceFirst.Text = "加价先加再乘";
|
||||
this.chkAddMorePriceFirst.UseVisualStyleBackColor = true;
|
||||
this.chkAddMorePriceFirst.CheckedChanged += new System.EventHandler(this.chkAddMorePriceFirst_CheckedChanged);
|
||||
//
|
||||
@@ -672,21 +703,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.label14.TabIndex = 599;
|
||||
this.label14.Text = "阶梯加价未\r\n勾选或条件\r\n不满足,按";
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(283, 113);
|
||||
this.label15.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(20, 17);
|
||||
this.label15.TabIndex = 588;
|
||||
this.label15.Text = "元";
|
||||
//
|
||||
// txtSinglePriceAdd
|
||||
//
|
||||
this.txtSinglePriceAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtSinglePriceAdd.Location = new System.Drawing.Point(252, 110);
|
||||
this.txtSinglePriceAdd.Location = new System.Drawing.Point(241, 110);
|
||||
this.txtSinglePriceAdd.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtSinglePriceAdd.Name = "txtSinglePriceAdd";
|
||||
this.txtSinglePriceAdd.Size = new System.Drawing.Size(31, 23);
|
||||
@@ -804,17 +824,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucAddPrice3.Size = new System.Drawing.Size(420, 23);
|
||||
this.ucAddPrice3.TabIndex = 13;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(184, 113);
|
||||
this.label11.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(68, 17);
|
||||
this.label11.TabIndex = 536;
|
||||
this.label11.Text = "元,单买加";
|
||||
//
|
||||
// lblNewAddPrice
|
||||
//
|
||||
this.lblNewAddPrice.AutoSize = true;
|
||||
@@ -831,7 +840,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
// txtAddMorePrice
|
||||
//
|
||||
this.txtAddMorePrice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtAddMorePrice.Location = new System.Drawing.Point(153, 110);
|
||||
this.txtAddMorePrice.Location = new System.Drawing.Point(145, 110);
|
||||
this.txtAddMorePrice.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtAddMorePrice.Name = "txtAddMorePrice";
|
||||
this.txtAddMorePrice.Size = new System.Drawing.Size(31, 23);
|
||||
@@ -842,7 +851,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
// txtAddTimes
|
||||
//
|
||||
this.txtAddTimes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtAddTimes.Location = new System.Drawing.Point(78, 110);
|
||||
this.txtAddTimes.Location = new System.Drawing.Point(73, 110);
|
||||
this.txtAddTimes.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtAddTimes.Name = "txtAddTimes";
|
||||
this.txtAddTimes.Size = new System.Drawing.Size(31, 23);
|
||||
@@ -854,7 +863,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(109, 113);
|
||||
this.label10.Location = new System.Drawing.Point(103, 113);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(44, 17);
|
||||
@@ -863,10 +872,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// txtStockNum
|
||||
//
|
||||
this.txtStockNum.Location = new System.Drawing.Point(486, 110);
|
||||
this.txtStockNum.Location = new System.Drawing.Point(496, 110);
|
||||
this.txtStockNum.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtStockNum.Name = "txtStockNum";
|
||||
this.txtStockNum.Size = new System.Drawing.Size(32, 23);
|
||||
this.txtStockNum.Size = new System.Drawing.Size(30, 23);
|
||||
this.txtStockNum.TabIndex = 530;
|
||||
this.txtStockNum.Text = "99";
|
||||
this.txtStockNum.TextChanged += new System.EventHandler(this.txtAddPrice_TextChanged);
|
||||
@@ -874,12 +883,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(430, 113);
|
||||
this.label4.Location = new System.Drawing.Point(455, 113);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(56, 17);
|
||||
this.label4.Size = new System.Drawing.Size(44, 17);
|
||||
this.label4.TabIndex = 531;
|
||||
this.label4.Text = "库存数量";
|
||||
this.label4.Text = "库存数";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
@@ -941,12 +950,35 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.lblLowPriceSkuImg.Text = "传sku图";
|
||||
this.lblLowPriceSkuImg.Click += new System.EventHandler(this.lblLowPriceSkuImg_Click);
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(271, 113);
|
||||
this.label15.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(20, 17);
|
||||
this.label15.TabIndex = 588;
|
||||
this.label15.Text = "元";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(175, 113);
|
||||
this.label11.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(68, 17);
|
||||
this.label11.TabIndex = 536;
|
||||
this.label11.Text = "元,单买加";
|
||||
//
|
||||
// ucGroupBoxEx4
|
||||
//
|
||||
this.ucGroupBoxEx4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ucGroupBoxEx4.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.ucGroupBoxEx4.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
|
||||
this.ucGroupBoxEx4.Controls.Add(this.btnProdDb);
|
||||
this.ucGroupBoxEx4.Controls.Add(this.chkSkipQualification);
|
||||
this.ucGroupBoxEx4.Controls.Add(this.pictureBox1);
|
||||
this.ucGroupBoxEx4.Controls.Add(this.cmbSourceType);
|
||||
@@ -972,6 +1004,30 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucGroupBoxEx4.TabStop = false;
|
||||
this.ucGroupBoxEx4.Text = "待传商品";
|
||||
//
|
||||
// btnProdDb
|
||||
//
|
||||
this.btnProdDb.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnProdDb.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnProdDb.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnProdDb.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnProdDb.Location = new System.Drawing.Point(264, 105);
|
||||
this.btnProdDb.Name = "btnProdDb";
|
||||
this.btnProdDb.Size = new System.Drawing.Size(38, 23);
|
||||
this.btnProdDb.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnProdDb.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnProdDb.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnProdDb.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.btnProdDb.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.btnProdDb.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.btnProdDb.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.btnProdDb.Style.GradientAngle = 90;
|
||||
this.btnProdDb.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnProdDb.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnProdDb.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnProdDb.TabIndex = 824;
|
||||
this.btnProdDb.Text = "选品";
|
||||
this.btnProdDb.Click += new System.EventHandler(this.btnProdDb_Click);
|
||||
//
|
||||
// chkSkipQualification
|
||||
//
|
||||
this.chkSkipQualification.Checked = true;
|
||||
@@ -1049,7 +1105,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// txtAddCount
|
||||
//
|
||||
this.txtAddCount.Location = new System.Drawing.Point(172, 105);
|
||||
this.txtAddCount.Location = new System.Drawing.Point(158, 105);
|
||||
this.txtAddCount.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtAddCount.Name = "txtAddCount";
|
||||
this.txtAddCount.Size = new System.Drawing.Size(35, 23);
|
||||
@@ -1088,9 +1144,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.panelEx2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.panelEx2.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.panelEx2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.panelEx2.Location = new System.Drawing.Point(209, 105);
|
||||
this.panelEx2.Location = new System.Drawing.Point(196, 105);
|
||||
this.panelEx2.Name = "panelEx2";
|
||||
this.panelEx2.Size = new System.Drawing.Size(93, 23);
|
||||
this.panelEx2.Size = new System.Drawing.Size(65, 23);
|
||||
this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.panelEx2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.panelEx2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
@@ -1103,7 +1159,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.panelEx2.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.panelEx2.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.panelEx2.TabIndex = 431;
|
||||
this.panelEx2.Text = "随机添加商品";
|
||||
this.panelEx2.Text = "随机添加";
|
||||
this.panelEx2.Click += new System.EventHandler(this.btnRandomAdd_Click);
|
||||
//
|
||||
// label2
|
||||
@@ -1209,6 +1265,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ucGroupBoxEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.ucGroupBoxEx1.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
|
||||
this.ucGroupBoxEx1.Controls.Add(this.btnRefreshApi);
|
||||
this.ucGroupBoxEx1.Controls.Add(this.btnRefreshShop);
|
||||
this.ucGroupBoxEx1.Location = new System.Drawing.Point(3, 2);
|
||||
this.ucGroupBoxEx1.Name = "ucGroupBoxEx1";
|
||||
@@ -1217,6 +1274,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucGroupBoxEx1.TabStop = false;
|
||||
this.ucGroupBoxEx1.Text = "基础";
|
||||
//
|
||||
// btnRefreshApi
|
||||
//
|
||||
this.btnRefreshApi.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnRefreshApi.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnRefreshApi.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnRefreshApi.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnRefreshApi.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnRefreshApi.Location = new System.Drawing.Point(74, 21);
|
||||
this.btnRefreshApi.Name = "btnRefreshApi";
|
||||
this.btnRefreshApi.Size = new System.Drawing.Size(64, 24);
|
||||
this.btnRefreshApi.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnRefreshApi.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnRefreshApi.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnRefreshApi.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.btnRefreshApi.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.btnRefreshApi.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.btnRefreshApi.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.btnRefreshApi.Style.GradientAngle = 90;
|
||||
this.btnRefreshApi.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnRefreshApi.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnRefreshApi.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnRefreshApi.TabIndex = 438;
|
||||
this.btnRefreshApi.Text = "刷新授权";
|
||||
this.btnRefreshApi.Click += new System.EventHandler(this.btnRefreshApi_Click);
|
||||
//
|
||||
// btnRefreshShop
|
||||
//
|
||||
this.btnRefreshShop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -1224,9 +1306,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.btnRefreshShop.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnRefreshShop.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnRefreshShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnRefreshShop.Location = new System.Drawing.Point(17, 31);
|
||||
this.btnRefreshShop.Location = new System.Drawing.Point(8, 21);
|
||||
this.btnRefreshShop.Name = "btnRefreshShop";
|
||||
this.btnRefreshShop.Size = new System.Drawing.Size(110, 24);
|
||||
this.btnRefreshShop.Size = new System.Drawing.Size(64, 24);
|
||||
this.btnRefreshShop.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnRefreshShop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnRefreshShop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
@@ -1270,6 +1352,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
this.splitContainer2.Panel1.Controls.Add(this.pbShopLoading);
|
||||
this.splitContainer2.Panel1.Controls.Add(this.dgvShop);
|
||||
this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 0, 0);
|
||||
//
|
||||
@@ -1281,26 +1364,38 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct);
|
||||
this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(1523, 372);
|
||||
this.splitContainer2.SplitterDistance = 300;
|
||||
this.splitContainer2.SplitterDistance = 326;
|
||||
this.splitContainer2.TabIndex = 0;
|
||||
//
|
||||
// pbShopLoading
|
||||
//
|
||||
this.pbShopLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.pbShopLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
|
||||
this.pbShopLoading.Location = new System.Drawing.Point(138, 161);
|
||||
this.pbShopLoading.Name = "pbShopLoading";
|
||||
this.pbShopLoading.Size = new System.Drawing.Size(50, 50);
|
||||
this.pbShopLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pbShopLoading.TabIndex = 189;
|
||||
this.pbShopLoading.TabStop = false;
|
||||
this.pbShopLoading.Visible = false;
|
||||
//
|
||||
// dgvShop
|
||||
//
|
||||
this.dgvShop.AllowUserToAddRows = false;
|
||||
this.dgvShop.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle13.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
|
||||
dataGridViewCellStyle22.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22;
|
||||
this.dgvShop.AutoRowNumber = true;
|
||||
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
|
||||
dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle23.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23;
|
||||
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colSelect,
|
||||
@@ -1310,6 +1405,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.colShopNotes,
|
||||
this.colSelectProduct,
|
||||
this.colLoginStatus,
|
||||
this.colApiStatus,
|
||||
this.colCanUse,
|
||||
this.colRemaining,
|
||||
this.colMessage});
|
||||
@@ -1320,7 +1416,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.dgvShop.ReadOnly = true;
|
||||
this.dgvShop.RowHeadersWidth = 25;
|
||||
this.dgvShop.RowTemplate.Height = 23;
|
||||
this.dgvShop.Size = new System.Drawing.Size(296, 372);
|
||||
this.dgvShop.Size = new System.Drawing.Size(322, 372);
|
||||
this.dgvShop.TabIndex = 6;
|
||||
this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
|
||||
//
|
||||
@@ -1381,7 +1477,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.colLoginStatus.ReadOnly = true;
|
||||
this.colLoginStatus.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colLoginStatus.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colLoginStatus.Width = 40;
|
||||
this.colLoginStatus.Width = 38;
|
||||
//
|
||||
// colApiStatus
|
||||
//
|
||||
this.colApiStatus.HeaderText = "授权";
|
||||
this.colApiStatus.Name = "colApiStatus";
|
||||
this.colApiStatus.ReadOnly = true;
|
||||
this.colApiStatus.Width = 38;
|
||||
//
|
||||
// colCanUse
|
||||
//
|
||||
@@ -1409,7 +1512,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
// txtTest20981
|
||||
//
|
||||
this.txtTest20981.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtTest20981.Location = new System.Drawing.Point(996, 30);
|
||||
this.txtTest20981.Location = new System.Drawing.Point(970, 30);
|
||||
this.txtTest20981.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtTest20981.Name = "txtTest20981";
|
||||
this.txtTest20981.Size = new System.Drawing.Size(127, 23);
|
||||
@@ -1422,7 +1525,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.btnTest20981.CanvasColor = System.Drawing.SystemColors.Control;
|
||||
this.btnTest20981.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnTest20981.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnTest20981.Location = new System.Drawing.Point(1127, 30);
|
||||
this.btnTest20981.Location = new System.Drawing.Point(1101, 30);
|
||||
this.btnTest20981.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2);
|
||||
this.btnTest20981.Name = "btnTest20981";
|
||||
this.btnTest20981.Size = new System.Drawing.Size(84, 23);
|
||||
@@ -1447,7 +1550,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
|
||||
this.pbLoading.Location = new System.Drawing.Point(584, 161);
|
||||
this.pbLoading.Location = new System.Drawing.Point(571, 161);
|
||||
this.pbLoading.Name = "pbLoading";
|
||||
this.pbLoading.Size = new System.Drawing.Size(50, 50);
|
||||
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
@@ -1459,19 +1562,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
this.dgvSelectProduct.AllowUserToAddRows = false;
|
||||
this.dgvSelectProduct.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle15.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle15;
|
||||
dataGridViewCellStyle24.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle24;
|
||||
this.dgvSelectProduct.AutoRowNumber = true;
|
||||
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle16.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle16.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle16.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
|
||||
dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle25.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle25.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle25.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle25.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle25.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle25.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle25;
|
||||
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colCheck,
|
||||
@@ -1502,7 +1605,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.dgvSelectProduct.Name = "dgvSelectProduct";
|
||||
this.dgvSelectProduct.ReadOnly = true;
|
||||
this.dgvSelectProduct.RowTemplate.Height = 23;
|
||||
this.dgvSelectProduct.Size = new System.Drawing.Size(1215, 372);
|
||||
this.dgvSelectProduct.Size = new System.Drawing.Size(1189, 372);
|
||||
this.dgvSelectProduct.TabIndex = 187;
|
||||
this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick);
|
||||
this.dgvSelectProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll);
|
||||
@@ -1533,8 +1636,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// colSupplierName
|
||||
//
|
||||
dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle17;
|
||||
dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle26;
|
||||
this.colSupplierName.Frozen = true;
|
||||
this.colSupplierName.HeaderText = "店铺名称";
|
||||
this.colSupplierName.Name = "colSupplierName";
|
||||
@@ -1612,12 +1715,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// colProductName
|
||||
//
|
||||
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colProductName.DefaultCellStyle = dataGridViewCellStyle18;
|
||||
dataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colProductName.DefaultCellStyle = dataGridViewCellStyle27;
|
||||
this.colProductName.HeaderText = "商品标题";
|
||||
this.colProductName.Name = "colProductName";
|
||||
this.colProductName.ReadOnly = true;
|
||||
this.colProductName.Width = 150;
|
||||
this.colProductName.Width = 140;
|
||||
//
|
||||
// colProductCat
|
||||
//
|
||||
@@ -1673,7 +1776,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
//
|
||||
// colAddTime
|
||||
//
|
||||
this.colAddTime.FillWeight = 110F;
|
||||
dataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle28;
|
||||
this.colAddTime.FillWeight = 80F;
|
||||
this.colAddTime.HeaderText = "上传时间";
|
||||
this.colAddTime.Name = "colAddTime";
|
||||
this.colAddTime.ReadOnly = true;
|
||||
@@ -1815,6 +1920,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.splitContainer2.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbShopLoading)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).EndInit();
|
||||
@@ -1862,16 +1968,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private UserComponent.UcCheckBox chkStepAddPrice;
|
||||
private DevComponents.DotNetBar.PanelEx btnClearDgv;
|
||||
private UserComponent.UcCheckBox chkAddMorePriceFirst;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn colSelectProduct;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn colLoginStatus;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
|
||||
private System.Windows.Forms.FlowLayoutPanel fPnlPriceRule;
|
||||
private UcAddPrice ucAddPrice1;
|
||||
private UcAddPrice ucAddPrice3;
|
||||
@@ -1915,6 +2011,26 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private System.Windows.Forms.PictureBox pbUpgradeVersion;
|
||||
private System.Windows.Forms.Label lblUpgradeVersion;
|
||||
private UserComponent.UcCheckBox chkUseExtCodePrice;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox txtWaitSeconds;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.ComboBox cmbSourceType;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private UserComponent.UcCheckBox chkSkipQualification;
|
||||
private DevComponents.DotNetBar.PanelEx btnApiUpload;
|
||||
private DevComponents.DotNetBar.PanelEx btnRefreshApi;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn colSelectProduct;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn colLoginStatus;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colApiStatus;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
|
||||
@@ -1937,13 +2053,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox txtWaitSeconds;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.ComboBox cmbSourceType;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private UserComponent.UcCheckBox chkSkipQualification;
|
||||
private DevComponents.DotNetBar.PanelEx btnApiUpload;
|
||||
private System.Windows.Forms.TextBox txtAddShippingFeeTimes;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.PictureBox pbShopLoading;
|
||||
private DevComponents.DotNetBar.PanelEx btnProdDb;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ using AllBase.Model.Result.PDDResult;
|
||||
using AllBase.Model.Param.PDDProdParam;
|
||||
using CefSharp;
|
||||
using TemuKJD.BLL.PddApi;
|
||||
using TemuKJD.WXForms.ProductForms;
|
||||
|
||||
namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
{
|
||||
@@ -68,7 +69,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
|
||||
private void UserSelectDbProductForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Task.Run(() => { InitPddToken(); });
|
||||
//Task.Run(() => { InitPddToken(); });
|
||||
RefreshApi();
|
||||
|
||||
this.splitContainer1.Dock = DockStyle.Fill;
|
||||
this.panel1.Location = new Point(40, 30);
|
||||
@@ -119,6 +121,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.txtAddMorePrice.Text = defaultAddPriceRule.AddMorePrice.ToString();
|
||||
this.txtSinglePriceAdd.Text = defaultAddPriceRule.SinglePriceAdd.ToString();
|
||||
this.txtStockNum.Text = defaultAddPriceRule.StockNum.ToString();
|
||||
this.txtAddShippingFeeTimes.Text = defaultAddPriceRule.AddShippingFeeTimes.ToString();
|
||||
this.chkAddMorePriceFirst.Checked = defaultAddPriceRule.AddMorePriceFirst;
|
||||
|
||||
pddUploadRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<PddUploadRule>("pdd_upload_rule");
|
||||
@@ -143,9 +146,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
|
||||
this.lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
|
||||
|
||||
int prodCount = 0;
|
||||
var list = GetRandomProductList(out prodCount, 1, 1);
|
||||
lblGoodsCount.Text = "产品库 " + prodCount + " 件";
|
||||
pictureBox1.Visible = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
int prodCount = 0;
|
||||
var list = GetRandomProductList(out prodCount, 1, 1);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
lblGoodsCount.Text = "产品库 " + prodCount + " 件";
|
||||
pictureBox1.Visible = false;
|
||||
}));
|
||||
});
|
||||
|
||||
this.panel1.SendToBack();
|
||||
chkSelectAll = dgvShop.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false);
|
||||
@@ -176,8 +187,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
IsLoadComplate = true;
|
||||
}
|
||||
|
||||
// 测试全局access_token
|
||||
void InitPddToken()
|
||||
{
|
||||
return;
|
||||
|
||||
var url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=pdd用户";
|
||||
//var rst = WXHttpResponseBLL.e57PostResponse(url, "&warehouseNum=123456&shopId=46568955", "");
|
||||
var rst = WXHttpResponseBLL.e57GetResponse(url, "");
|
||||
@@ -199,9 +213,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
}
|
||||
|
||||
// 测试写死
|
||||
var shop1 = GlobalConfig.ShopLoginList.First(s => s.ShopAccount == "阿杰小铺浦哈哈");
|
||||
shop1.ApiAuthInfoList = new List<AuthInfo>();
|
||||
shop1.ApiAuthInfoList.Add(new AuthInfo { AccessToken = "269a0baaca9b42abb443756fac90f88b0836f610" });
|
||||
//var shop1 = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopAccount == "阿杰小铺浦哈哈");
|
||||
//shop1.ApiAuthInfoList = new List<AuthInfo>();
|
||||
//shop1.ApiAuthInfoList.Add(new AuthInfo { AccessToken = "269a0baaca9b42abb443756fac90f88b0836f610" });
|
||||
|
||||
// 临时刷新token
|
||||
//var rst1 = pddApi.PddPopAuthTokenCreate();
|
||||
}
|
||||
|
||||
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
|
||||
@@ -235,7 +252,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
if (Visible == true)
|
||||
{
|
||||
RefreshShop();
|
||||
RefreshDbProd();
|
||||
if (!isInit)
|
||||
RefreshDbProd();
|
||||
|
||||
isInit = true;
|
||||
}
|
||||
@@ -315,18 +333,20 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId);
|
||||
if (row == null)
|
||||
{
|
||||
this.dgvShop.Rows.Add(
|
||||
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
|
||||
var index = this.dgvShop.Rows.Add(
|
||||
false, //!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
|
||||
shopEntity.LoginName,
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.Notes,
|
||||
"选择商品",
|
||||
canUse ? "在线" : "掉线",
|
||||
shopEntity.AuthExpiresTime > DateTime.Now ? "有效" : "过期",
|
||||
canUse,
|
||||
shopEntity.AddProductRemaining,
|
||||
string.Empty
|
||||
shopEntity.Message
|
||||
);
|
||||
row = dgvShop.Rows[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -335,9 +355,29 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colShopNotes"].Value = shopEntity.Notes;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
row.Cells["colApiStatus"].Value = shopEntity.AuthExpiresTime > DateTime.Now ? "有效" : "过期";
|
||||
row.Cells["colLoginStatus"].Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining;
|
||||
row.Cells["colMessage"].Value = shopEntity.Message;
|
||||
}
|
||||
displayShopStatus(shopEntity);
|
||||
}
|
||||
|
||||
void displayShopStatus(ShopLoginInfo shop)
|
||||
{
|
||||
bool canUse = shop.LoginStatus == "登录成功";
|
||||
bool apiAuth = shop.AuthExpiresTime > DateTime.Now;
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ParseToString() == shop?.ShopId);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Blue : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Blue : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightBlue : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkBlue : Color.DarkRed;
|
||||
row.Cells["colApiStatus"].Style.ForeColor = apiAuth ? Color.Green : Color.OrangeRed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2091,34 +2131,38 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
foreach (var skuParamInfo in baseSkuParamLst)
|
||||
{
|
||||
var skuParam = JsonHelper.DeserializeJsonToObject<sku_param>(JsonHelper.SerializeObject(skuParamInfo));
|
||||
skuParam.multi_price = (skuParamInfo.multi_price * this.txtAddTimes.Text.Trim().ParseToDecimal() + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
skuParam.price = (skuParamInfo.price * this.txtAddTimes.Text.Trim().ParseToDecimal() + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
//上面已经给过值了,且厂商直采的上家缺货则保持缺货。
|
||||
// 库存上面已经给过值了,且厂商直采的上家缺货则保持缺货。
|
||||
//skuParam.quantity_delta = txtStockNum.Text.Trim().ParseToInt();
|
||||
|
||||
skuParam.multi_price += shipPrice;
|
||||
skuParam.price += shipPrice;
|
||||
var new_multi_price = skuParamInfo.multi_price + (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
|
||||
// 普通加价
|
||||
skuParam.multi_price = (new_multi_price * this.txtAddTimes.Text.Trim().ParseToDecimal() + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
if (isAddMorePriceFirst) // 先加后乘
|
||||
skuParam.multi_price = ((skuParamInfo.multi_price + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100) * this.txtAddTimes.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
skuParam.multi_price = ((new_multi_price + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100) * this.txtAddTimes.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
skuParam.price = skuParam.multi_price + Math.Max(100, this.txtSinglePriceAdd.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
|
||||
//阶梯式加价,如果命中则按阶梯式加价进行
|
||||
if (isStepAddPrice)
|
||||
{
|
||||
foreach (var addPrice in lstAddPriceRule)
|
||||
{
|
||||
if (skuParamInfo.multi_price > addPrice.MoreThanPrice * 100 && skuParamInfo.multi_price <= addPrice.LessThanPrice * 100)
|
||||
if (new_multi_price > addPrice.MoreThanPrice * 100 && new_multi_price <= addPrice.LessThanPrice * 100)
|
||||
{
|
||||
if (isAddMorePriceFirst) // 先加后乘
|
||||
skuParam.multi_price = ((skuParamInfo.multi_price + addPrice.AddMorePrice * 100) * addPrice.AddPriceTimes).ParseToInt();
|
||||
skuParam.multi_price = ((new_multi_price + addPrice.AddMorePrice * 100) * addPrice.AddPriceTimes).ParseToInt();
|
||||
else
|
||||
skuParam.multi_price = (skuParamInfo.multi_price * addPrice.AddPriceTimes + addPrice.AddMorePrice * 100).ParseToInt();
|
||||
skuParam.price = skuParam.multi_price + Math.Max(100, addPrice.SinglePriceAdd * 100).ParseToInt(); ;
|
||||
skuParam.multi_price = (new_multi_price * addPrice.AddPriceTimes + addPrice.AddMorePrice * 100).ParseToInt();
|
||||
skuParam.price = skuParam.multi_price + Math.Max(100, addPrice.SinglePriceAdd * 100).ParseToInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 加邮费×倍率 放前面加
|
||||
//skuParam.multi_price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
//skuParam.price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
|
||||
if (prodParam.market_price < skuParam.price + 1000)
|
||||
{
|
||||
prodParam.market_price = skuParam.price + 1000;
|
||||
@@ -2674,19 +2718,21 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
foreach (var skuParamInfo in baseSkuParamLst)
|
||||
{
|
||||
var skuParam = JsonHelper.DeserializeJsonToObject<sku_param>(JsonHelper.SerializeObject(skuParamInfo));
|
||||
|
||||
skuParam.multi_price += shipPrice;
|
||||
skuParam.price += shipPrice;
|
||||
|
||||
skuParam.multi_price = (skuParamInfo.multi_price * this.txtAddTimesFake.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
skuParam.price = (skuParamInfo.price * this.txtAddTimesFake.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
//上面已经给过值了,且厂商直采的上家缺货则保持缺货。
|
||||
// 库存上面已经给过值了,且厂商直采的上家缺货则保持缺货。
|
||||
//skuParam.quantity_delta = txtStockNum.Text.Trim().ParseToInt(); // 库存
|
||||
|
||||
var new_multi_price = skuParamInfo.multi_price + (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
|
||||
// 虚拟加价3倍
|
||||
skuParam.multi_price = (new_multi_price * this.txtAddTimesFake.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
if (isAddMorePriceFirst) // 先加后乘
|
||||
skuParam.multi_price = ((skuParamInfo.multi_price) * this.txtAddTimesFake.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
skuParam.multi_price = (new_multi_price * this.txtAddTimesFake.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
skuParam.price = skuParam.multi_price + Math.Max(100, this.txtSinglePriceAdd.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
|
||||
//// 加邮费×倍率 放前面
|
||||
//skuParam.multi_price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
//skuParam.price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
|
||||
if (prodParamHighPrice.market_price < skuParam.price + 1000)
|
||||
{
|
||||
prodParamHighPrice.market_price = skuParam.price + 1000;
|
||||
@@ -6085,6 +6131,7 @@ Content-Type: image/jpeg
|
||||
defaultAddPriceRule.AddMorePrice = txtAddMorePrice.Text.Trim().ParseToDecimal();
|
||||
defaultAddPriceRule.SinglePriceAdd = txtSinglePriceAdd.Text.Trim().ParseToDecimal();
|
||||
defaultAddPriceRule.StockNum = txtStockNum.Text.Trim().ParseToInt();
|
||||
defaultAddPriceRule.AddShippingFeeTimes = txtAddShippingFeeTimes.Text.Trim().ParseToDecimal();
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig<AddPriceRule>("pdd_default_add_price_rule", defaultAddPriceRule);
|
||||
}
|
||||
}
|
||||
@@ -6663,7 +6710,7 @@ Content-Type: image/jpeg
|
||||
Invoke(new Action(() => { statusBar.lblTaskStatus.Text = "正在上传!"; }));
|
||||
|
||||
// 指定店铺数量同时上货
|
||||
if(currentUpShopLst.Count >= 10)
|
||||
if (currentUpShopLst.Count >= 10)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
continue;
|
||||
@@ -6746,6 +6793,8 @@ Content-Type: image/jpeg
|
||||
{
|
||||
result = "{\"success\":false,\"status\":\"未上传\",\"errMsg\":\"" + ex.Message + "\"}";
|
||||
}
|
||||
var timeSpan = DateTime.Now - startTime;
|
||||
duration = timeSpan.TotalSeconds;
|
||||
|
||||
var error = "";
|
||||
// 上传失败
|
||||
@@ -6758,9 +6807,6 @@ Content-Type: image/jpeg
|
||||
{
|
||||
if (row.Index >= 0)
|
||||
{
|
||||
var endTime = DateTime.Now;
|
||||
var timeSpan = endTime - startTime;
|
||||
duration = timeSpan.TotalSeconds;
|
||||
row.Cells["colOpResult"].Value = error + " " + duration.ParseToInt() + "秒";
|
||||
}
|
||||
}));
|
||||
@@ -6801,6 +6847,14 @@ Content-Type: image/jpeg
|
||||
string ApiUploadProduct(ShopLoginInfo shop, TemuDBProductSelect selectProd, DataGridViewRow row)
|
||||
{
|
||||
DataGridViewCell cell = row.Cells["colOpResult"];
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "正在初始化商品";
|
||||
}));
|
||||
|
||||
// 模拟多线程一起上货
|
||||
//Thread.Sleep(Randomx.GetId(500, 5000));
|
||||
//return "{\"success\":true,\"goods_id\":" + 1000000 + ",\"status\":\"已上传\",\"msg\":\"上传成功\"}";
|
||||
|
||||
KJDDBProduct dbProd = selectProd.kjdDbProduct;
|
||||
if (dbProd == null)
|
||||
@@ -6833,24 +6887,23 @@ Content-Type: image/jpeg
|
||||
prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
|
||||
|
||||
var pddApi = new PddApi(shop);
|
||||
pddApi.Data["cat_id"] = prodInfo.detail.cat_id;
|
||||
var carRuleGetRst = pddApi.PddGoodsCatRuleGet();
|
||||
|
||||
// 临时刷新token
|
||||
//var rst1 = pddApi.PddPopAuthTokenCreate();
|
||||
|
||||
//满两件折扣,todo通过pdd.goods.cat.rule.get查询具体规则
|
||||
//{"cat_rule_get_response":{"goods_properties_rule":{"input_max_spec_num":0,"properties":[{"is_sale":false,"is_important":false,"is_sku":false,"values":[{"vid":4643510,"value":"无品牌/无注册商标"},{"vid":1280848,"value":"画南头"},{"vid":30601,"value":"固竹匠"},{"vid":220778,"value":"浪漫喜事"},{"vid":334660,"value":"梦瑾"},{"vid":130470,"value":"朋意"},{"vid":12034,"value":"THEBEAST/野兽派"},{"vid":1942,"value":"Uchino/内野"},{"vid":34231,"value":"NITORI/宜得利家居"},{"vid":6439,"value":"Brother/兄弟"},{"vid":8553,"value":"Zara Home"},{"vid":8554,"value":"MUJI/无印良品"},{"vid":14223,"value":"VERSACE/范思哲"},{"vid":18534,"value":"Mtg"},{"vid":19991,"value":"SINGER/胜家"},{"vid":196848,"value":"Hoyo"},{"vid":224544,"value":"亚朵星球"},{"vid":280,"value":"KING SHORE/金号"},{"vid":327,"value":"SEMIR/森马"},{"vid":68,"value":"MERCURY/水星家纺"},{"vid":44617,"value":"LUOLAI/罗莱"},{"vid":386,"value":"Xiaomi/小米"},{"vid":394,"value":"Lock&Lock/乐扣乐扣"},{"vid":53109,"value":"CHRISTY"},{"vid":5702,"value":"东升"},{"vid":5727,"value":"DOHIA/多喜爱"},{"vid":561,"value":"Purcotton/全棉时代"},{"vid":6159,"value":"金蝉"},{"vid":6770,"value":"MENDALE/梦洁"},{"vid":8882,"value":"HLA/海澜之家"},{"vid":9570,"value":"MINISO/名创优品"},{"vid":119495,"value":"AUSTTBABY"},{"vid":119914,"value":"棉森"},{"vid":12031,"value":"大朴"},{"vid":128592,"value":"亿恩忆"},{"vid":12598,"value":"怡沁园"},{"vid":134564,"value":"茱莉亚"},{"vid":14220,"value":"JEANSWEST/真维斯"},{"vid":16898,"value":"奥帝罗"},{"vid":16900,"value":"德奇力"},{"vid":17523,"value":"Bravo/馨而乐"},{"vid":17529,"value":"Grace·orchid/洁丽雅·兰"},{"vid":165321,"value":"孩子王"},{"vid":17819,"value":"EverShine/永亮"},{"vid":172186,"value":"BULULOM/布鲁罗曼"},{"vid":173,"value":"南极人"},{"vid":192015,"value":"Mionsoo/棉上"},{"vid":192617,"value":"Lovhome/乐巢家居"},{"vid":193562,"value":"Tumei Home Collection/图美寝饰"},{"vid":195662,"value":"Jrb/嘉瑞宝"},{"vid":197759,"value":"Gafuhome"},{"vid":202708,"value":"LATEX SYSTEMS CO.,LTD."},{"vid":1746,"value":"梦雅莉"},{"vid":1747,"value":"虹原风尚"},{"vid":1748,"value":"LUOLANNI/罗兰妮"},{"vid":1749,"value":"梓晨"},{"vid":1752,"value":"LORiCA/骆易家"},{"vid":1769,"value":"BLISS/百丽丝"},{"vid":215899,"value":"竹月阁"},{"vid":216546,"value":"荣邦"},{"vid":200,"value":"GRACE/洁丽雅"},{"vid":1957,"value":"黄古林"},{"vid":245780,"value":"yesland雅熙莱帝"},{"vid":2105,"value":"SANLI/三利"},{"vid":2106,"value":"CARESEEN/康尔馨"},{"vid":262384,"value":"爱络"},{"vid":27838,"value":"ABS/爱彼此"},{"vid":275849,"value":"伊丝绮"},{"vid":280996,"value":"Qisilove/前世有约"},{"vid":281160,"value":"Ppw"},{"vid":252,"value":"BEJIROG/北极绒"},{"vid":283511,"value":"梦蝶莎"},{"vid":2675,"value":"芳华"},{"vid":32611,"value":"TY LIVE/田园生活"},{"vid":302922,"value":"一米"},{"vid":32853,"value":"温恋"},{"vid":32879,"value":"WS/伟殳家居"},{"vid":32881,"value":"港龙"},{"vid":32882,"value":"亚亨"},{"vid":273,"value":"Disney/迪士尼"},{"vid":33880,"value":"Aqara"},{"vid":294,"value":"洁玉"},{"vid":303,"value":"网易严选"},{"vid":3274,"value":"A-LIFE/最生活"},{"vid":369086,"value":"山花"},{"vid":373614,"value":"五洲"},{"vid":329,"value":"BOBDOG/巴布豆"},{"vid":382380,"value":"SouthLife/南方生活"},{"vid":330,"value":"Montagut/梦特娇"},{"vid":69,"value":"LOVO/乐蜗"},{"vid":3602,"value":"Curbblan/卡伴"},{"vid":3897,"value":"知梦人"},{"vid":45598,"value":"SAINTMARC/尚玛可"},{"vid":45746,"value":"SINOMAX/赛诺"},{"vid":45808,"value":"SOMERELLE/安睡宝"},{"vid":45938,"value":"SUNVIM/孚日"},{"vid":397,"value":"童泰"},{"vid":464223,"value":"Yuniku/优尼可"},{"vid":4602,"value":"Jago/佳奥"},{"vid":4657,"value":"四季帘华"},{"vid":517644,"value":"家顿"},{"vid":519506,"value":"MENBORY/梦宝莉"},{"vid":532306,"value":"MENDALE HOME"},{"vid":781538,"value":"4monster"},{"vid":5240,"value":"春天十字绣"},{"vid":5247,"value":"HD/惠多"},{"vid":65402,"value":"梦雯"},{"vid":842952,"value":"赛勒"},{"vid":846015,"value":"墨斗鱼"},{"vid":5832,"value":"8H"},{"vid":923181,"value":"大江(地垫)"},{"vid":950059,"value":"甄简良品"},{"vid":79195,"value":"伊佳仁"},{"vid":79198,"value":"雅熙莱帝"},{"vid":6958,"value":"轻生活"},{"vid":7347,"value":"TANGY/天意"},{"vid":7351,"value":"FREETEX"},{"vid":94190,"value":"冬阳"},{"vid":96868,"value":"硕木"},{"vid":97393,"value":"LOFTEX/亚光"},{"vid":97771,"value":"彩朵朵"},{"vid":9254,"value":"AiSleep/睡眠博士"},{"vid":9709,"value":"HD/华德"},{"vid":9780,"value":"欧意"},{"vid":9942,"value":"百思寒"},{"vid":107350,"value":"布蝶轩"},{"vid":108166,"value":"夕姿"},{"vid":12165,"value":"一朵"},{"vid":12549,"value":"金柒"},{"vid":1286,"value":"BONAS/宝娜斯"},{"vid":17569,"value":"恩兴"},{"vid":18231,Line truncated
|
||||
|
||||
// 主图
|
||||
int cnt = 0;
|
||||
string carousel_gallery = "";
|
||||
foreach (var img in prodInfo.detail.galleries.Where(g => g.type ==1).ToList())
|
||||
{
|
||||
cnt++;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "正在上传主图 " + cnt + "/" + prodInfo.detail.galleries.Where(g => g.type == 1).ToList().Count;
|
||||
}));
|
||||
|
||||
string errMsg = "";
|
||||
var imgBase64 = WXForms.ProductForms.WXDBProdUploadForm.GetImgBase64ForApi(out errMsg, img.url, false, false);
|
||||
if (!string.IsNullOrEmpty(errMsg))
|
||||
{
|
||||
return errMsg;
|
||||
return "主图初始化失败 " + errMsg;
|
||||
}
|
||||
|
||||
var pddUpImgApi = new PddApi(shop);
|
||||
@@ -6861,7 +6914,7 @@ Content-Type: image/jpeg
|
||||
errMsg = BaseRegex.GetStringJson(ref pddUpImgApiRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = pddUpImgApiRst;
|
||||
return errMsg;
|
||||
return "主图上传失败 " + errMsg;
|
||||
}
|
||||
carousel_gallery += "\"" + BaseRegex.GetStringJson(ref pddUpImgApiRst, "image_url") + "\",";
|
||||
}
|
||||
@@ -6869,6 +6922,11 @@ Content-Type: image/jpeg
|
||||
|
||||
pddApi.Data["cat_id"] = prodInfo.detail.cat_id;
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "正在选取运费模板";
|
||||
}));
|
||||
// 运费模板
|
||||
var pddAddressApi = new PddApi(shop);
|
||||
pddAddressApi.Data["page"] = 1;
|
||||
var pddAddressApiRst = pddAddressApi.PddGoodsLogisticsTemplateGet();
|
||||
@@ -6877,7 +6935,7 @@ Content-Type: image/jpeg
|
||||
var errMsg = BaseRegex.GetStringJson(ref pddAddressApiRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = pddAddressApiRst;
|
||||
return errMsg;
|
||||
return "运费模板获取失败 " + errMsg;
|
||||
}
|
||||
var template_id = BaseRegex.GetStringJson(ref pddAddressApiRst, "template_id");
|
||||
if (template_id == null)
|
||||
@@ -6886,18 +6944,25 @@ Content-Type: image/jpeg
|
||||
}
|
||||
pddApi.Data["cost_template_id"] = template_id;
|
||||
|
||||
pddApi.Data["country_id"] = 0;
|
||||
pddApi.Data["country_id"] = 0; // 国内商品默认填0
|
||||
//pddApi.Data["delivery_type"] = 1; // delivery_type INTEGER 非必填 发货方式。0:无物流发货;1:有物流发货。
|
||||
|
||||
// 详情图
|
||||
cnt = 0;
|
||||
string detail_gallery = "";
|
||||
foreach (var img in prodInfo.detail.galleries.Where(g => g.type == 2).ToList())
|
||||
{
|
||||
cnt++;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "正在上传详情图 " + cnt + "/" + prodInfo.detail.galleries.Where(g => g.type == 2).ToList().Count;
|
||||
}));
|
||||
|
||||
string errMsg = "";
|
||||
var imgBase64 = WXForms.ProductForms.WXDBProdUploadForm.GetImgBase64ForApi(out errMsg, img.url, false, false);
|
||||
if (!string.IsNullOrEmpty(errMsg))
|
||||
{
|
||||
return errMsg;
|
||||
return "详情图初始化失败 " + errMsg;
|
||||
}
|
||||
|
||||
var pddUpImgApi = new PddApi(shop);
|
||||
@@ -6908,7 +6973,7 @@ Content-Type: image/jpeg
|
||||
errMsg = BaseRegex.GetStringJson(ref pddUpImgApiRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = pddUpImgApiRst;
|
||||
return errMsg;
|
||||
return "详情图上传失败 " + errMsg;
|
||||
}
|
||||
detail_gallery += "\"" + BaseRegex.GetStringJson(ref pddUpImgApiRst, "image_url") + "\",";
|
||||
}
|
||||
@@ -6918,8 +6983,118 @@ Content-Type: image/jpeg
|
||||
pddApi.Data["goods_desc"] = prodInfo.detail.goods_desc;
|
||||
pddApi.Data["goods_name"] = prodInfo.detail.goods_name;
|
||||
|
||||
//todo 非必填
|
||||
pddApi.Data["goods_properties"] = "[]";
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "正在生成属性";
|
||||
}));
|
||||
// 获取类目属性模板
|
||||
var pddApiCatRule = new PddApi(shop);
|
||||
pddApiCatRule.Data["cat_id"] = prodInfo.detail.cat_id;
|
||||
var catRuleGetRst = pddApiCatRule.PddGoodsCatRuleGet();
|
||||
if (!catRuleGetRst.Contains("\"cat_rule_get_response\""))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref catRuleGetRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = catRuleGetRst;
|
||||
return "类目属性初始化失败 " + errMsg;
|
||||
}
|
||||
//{"cat_rule_get_response":{"goods_properties_rule":{"input_max_spec_num":0,"properties":[{"is_sale":false,"is_important":false,"is_sku":false,"values":[{"vid":4643510,"value":"无品牌/无注册商标"},{"vid":1280848,"value":"画南头"},{"vid":30601,"value":"固竹匠"},{"vid":220778,"value":"浪漫喜事"},{"vid":334660,"value":"梦瑾"},{"vid":130470,"value":"朋意"},{"vid":12034,"value":"THEBEAST/野兽派"},{"vid":1942,"value":"Uchino/内野"},{"vid":34231,"value":"NITORI/宜得利家居"},{"vid":6439,"value":"Brother/兄弟"},{"vid":8553,"value":"Zara Home"},{"vid":8554,"value":"MUJI/无印良品"},{"vid":14223,"value":"VERSACE/范思哲"},{"vid":18534,"value":"Mtg"},{"vid":19991,"value":"SINGER/胜家"},{"vid":196848,"value":"Hoyo"},{"vid":224544,"value":"亚朵星球"},{"vid":280,"value":"KING SHORE/金号"},{"vid":327,"value":"SEMIR/森马"},{"vid":68,"value":"MERCURY/水星家纺"},{"vid":44617,"value":"LUOLAI/罗莱"},{"vid":386,"value":"Xiaomi/小米"},{"vid":394,"value":"Lock&Lock/乐扣乐扣"},{"vid":53109,"value":"CHRISTY"},{"vid":5702,"value":"东升"},{"vid":5727,"value":"DOHIA/多喜爱"},{"vid":561,"value":"Purcotton/全棉时代"},{"vid":6159,"value":"金蝉"},{"vid":6770,"value":"MENDALE/梦洁"},{"vid":8882,"value":"HLA/海澜之家"},{"vid":9570,"value":"MINISO/名创优品"},{"vid":119495,"value":"AUSTTBABY"},{"vid":119914,"value":"棉森"},{"vid":12031,"value":"大朴"},{"vid":128592,"value":"亿恩忆"},{"vid":12598,"value":"怡沁园"},{"vid":134564,"value":"茱莉亚"},{"vid":14220,"value":"JEANSWEST/真维斯"},{"vid":16898,"value":"奥帝罗"},{"vid":16900,"value":"德奇力"},{"vid":17523,"value":"Bravo/馨而乐"},{"vid":17529,"value":"Grace·orchid/洁丽雅·兰"},{"vid":165321,"value":"孩子王"},{"vid":17819,"value":"EverShine/永亮"},{"vid":172186,"value":"BULULOM/布鲁罗曼"},{"vid":173,"value":"南极人"},{"vid":192015,"value":"Mionsoo/棉上"},{"vid":192617,"value":"Lovhome/乐巢家居"},{"vid":193562,"value":"Tumei Home Collection/图美寝饰"},{"vid":195662,"value":"Jrb/嘉瑞宝"},{"vid":197759,"value":"Gafuhome"},{"vid":202708,"value":"LATEX SYSTEMS CO.,LTD."},{"vid":1746,"value":"梦雅莉"},{"vid":1747,"value":"虹原风尚"},{"vid":1748,"value":"LUOLANNI/罗兰妮"},{"vid":1749,"value":"梓晨"},{"vid":1752,"value":"LORiCA/骆易家"},{"vid":1769,"value":"BLISS/百丽丝"},{"vid":215899,"value":"竹月阁"},{"vid":216546,"value":"荣邦"},{"vid":200,"value":"GRACE/洁丽雅"},{"vid":1957,"value":"黄古林"},{"vid":245780,"value":"yesland雅熙莱帝"},{"vid":2105,"value":"SANLI/三利"},{"vid":2106,"value":"CARESEEN/康尔馨"},{"vid":262384,"value":"爱络"},{"vid":27838,"value":"ABS/爱彼此"},{"vid":275849,"value":"伊丝绮"},{"vid":280996,"value":"Qisilove/前世有约"},{"vid":281160,"value":"Ppw"},{"vid":252,"value":"BEJIROG/北极绒"},{"vid":283511,"value":"梦蝶莎"},{"vid":2675,"value":"芳华"},{"vid":32611,"value":"TY LIVE/田园生活"},{"vid":302922,"value":"一米"},{"vid":32853,"value":"温恋"},{"vid":32879,"value":"WS/伟殳家居"},{"vid":32881,"value":"港龙"},{"vid":32882,"value":"亚亨"},{"vid":273,"value":"Disney/迪士尼"},{"vid":33880,"value":"Aqara"},{"vid":294,"value":"洁玉"},{"vid":303,"value":"网易严选"},{"vid":3274,"value":"A-LIFE/最生活"},{"vid":369086,"value":"山花"},{"vid":373614,"value":"五洲"},{"vid":329,"value":"BOBDOG/巴布豆"},{"vid":382380,"value":"SouthLife/南方生活"},{"vid":330,"value":"Montagut/梦特娇"},{"vid":69,"value":"LOVO/乐蜗"},{"vid":3602,"value":"Curbblan/卡伴"},{"vid":3897,"value":"知梦人"},{"vid":45598,"value":"SAINTMARC/尚玛可"},{"vid":45746,"value":"SINOMAX/赛诺"},{"vid":45808,"value":"SOMERELLE/安睡宝"},{"vid":45938,"value":"SUNVIM/孚日"},{"vid":397,"value":"童泰"},{"vid":464223,"value":"Yuniku/优尼可"},{"vid":4602,"value":"Jago/佳奥"},{"vid":4657,"value":"四季帘华"},{"vid":517644,"value":"家顿"},{"vid":519506,"value":"MENBORY/梦宝莉"},{"vid":532306,"value":"MENDALE HOME"},{"vid":781538,"value":"4monster"},{"vid":5240,"value":"春天十字绣"},{"vid":5247,"value":"HD/惠多"},{"vid":65402,"value":"梦雯"},{"vid":842952,"value":"赛勒"},{"vid":846015,"value":"墨斗鱼"},{"vid":5832,"value":"8H"},{"vid":923181,"value":"大江(地垫)"},{"vid":950059,"value":"甄简良品"},{"vid":79195,"value":"伊佳仁"},{"vid":79198,"value":"雅熙莱帝"},{"vid":6958,"value":"轻生活"},{"vid":7347,"value":"TANGY/天意"},{"vid":7351,"value":"FREETEX"},{"vid":94190,"value":"冬阳"},{"vid":96868,"value":"硕木"},{"vid":97393,"value":"LOFTEX/亚光"},{"vid":97771,"value":"彩朵朵"},{"vid":9254,"value":"AiSleep/睡眠博士"},{"vid":9709,"value":"HD/华德"},{"vid":9780,"value":"欧意"},{"vid":9942,"value":"百思寒"},{"vid":107350,"value":"布蝶轩"},{"vid":108166,"value":"夕姿"},{"vid":12165,"value":"一朵"},{"vid":12549,"value":"金柒"},{"vid":1286,"value":"BONAS/宝娜斯"},{"vid":17569,"value":"恩兴"},{"vid":18231,Line truncated
|
||||
var catTemplateInfoObj = JsonHelper.JObjectParse(catRuleGetRst)["cat_rule_get_response"]["goods_properties_rule"];
|
||||
var catTemplateInfoStr = JsonHelper.SerializeObject(catTemplateInfoObj);
|
||||
var apiCatRuleInfo = JsonHelper.DeserializeJsonToObject<ApiPddGoodsCatRuleInfo>(catTemplateInfoStr);
|
||||
|
||||
List<ApiPddProperty> propParamLst = new List<ApiPddProperty>();
|
||||
foreach (var propInfo in prodInfo.property.goods_properties)
|
||||
{
|
||||
var propApiInfo = apiCatRuleInfo.properties.FirstOrDefault(p => p.name == propInfo.name || p.ref_pid == propInfo.ref_pid);
|
||||
if (propApiInfo != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var propParam = JsonHelper.DeserializeJsonToObject<ApiPddProperty>(JsonHelper.SerializeObject(propApiInfo));
|
||||
|
||||
ApiPddPropertyValue value = null;
|
||||
if (propParam.name == "品牌")
|
||||
{
|
||||
if (propInfo.values.FirstOrDefault()?.value == "其他家")
|
||||
value = propParam.values.FirstOrDefault(v => v.value == "无品牌/无注册商标");
|
||||
else
|
||||
{
|
||||
//value = propParam.values.FirstOrDefault(v => v.value == propInfo.values.FirstOrDefault().value);
|
||||
// 统一使用无品牌
|
||||
value = propParam.values.FirstOrDefault(v => v.value == "无品牌/无注册商标");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (propParam.values == null && propInfo.values.FirstOrDefault()?.value != null)
|
||||
value = new ApiPddPropertyValue() { value = propInfo.values.FirstOrDefault()?.value, vid = 0 };
|
||||
else
|
||||
value = propParam.values?.FirstOrDefault(v => v.value == propInfo.values.FirstOrDefault()?.value);
|
||||
if (value == null)
|
||||
value = propParam.values?.FirstOrDefault(v => v.value == "其他");
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
propParam.values = new List<ApiPddPropertyValue>() { value };
|
||||
if (!string.IsNullOrEmpty(propInfo.values.FirstOrDefault()?.unit))
|
||||
{
|
||||
var unit = propParam.value_unit.FirstOrDefault(v => v == propInfo.values.FirstOrDefault().unit);
|
||||
if (!string.IsNullOrEmpty(unit))
|
||||
propParam.value_unit = new List<string>() { unit };
|
||||
}
|
||||
propParamLst.Add(propParam);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "类目属性转换失败 " + ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var propApiInfo in apiCatRuleInfo.properties)
|
||||
{
|
||||
if (propApiInfo.required == true && !propParamLst.Any(p => p.ref_pid == propApiInfo.ref_pid))
|
||||
{
|
||||
var contentOther = propApiInfo.values?.FirstOrDefault(c => c.value == "其他");
|
||||
if (contentOther != null)
|
||||
{
|
||||
//var prop = new goods_property_param()
|
||||
var propParam = JsonHelper.DeserializeJsonToObject<ApiPddProperty>(JsonHelper.SerializeObject(propApiInfo));
|
||||
propParam.values = new List<ApiPddPropertyValue>() { contentOther };
|
||||
propParamLst.Add(propParam);
|
||||
}
|
||||
else if (propApiInfo.name == "成分含量")
|
||||
{
|
||||
var contentValue = propApiInfo.values?.FirstOrDefault(v => v.value.Contains("以下"));
|
||||
if (contentValue != null)
|
||||
{
|
||||
var propParam = JsonHelper.DeserializeJsonToObject<ApiPddProperty>(JsonHelper.SerializeObject(propApiInfo));
|
||||
propParam.values = new List<ApiPddPropertyValue>() { contentOther };
|
||||
propParamLst.Add(propParam);
|
||||
}
|
||||
}
|
||||
else if (propApiInfo.required_rule_type == 1 && propApiInfo.values?.Count == 1) // 二级关联属性
|
||||
{
|
||||
var propParam = JsonHelper.DeserializeJsonToObject<ApiPddProperty>(JsonHelper.SerializeObject(propApiInfo));
|
||||
propParamLst.Add(propParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string goods_properties = "";
|
||||
foreach (var pp in propParamLst)
|
||||
{
|
||||
var pv = pp.values.FirstOrDefault();
|
||||
var value_unit = pp.value_unit.FirstOrDefault().ParseToString();
|
||||
var str = "{\"ref_pid\":" + pp.ref_pid + ",\"vid\":" + pv.vid + ",\"value\":\"" + pv.value + "\",\"value_unit\":\"" + value_unit + "\"},";
|
||||
string temp = BaseRegex.GetMatchRegexString(ref str, @"(\d{2,4}-\d{1,2}-\d{1,2})"); // 如果有时间替换成最新的
|
||||
if (!string.IsNullOrEmpty(temp))
|
||||
str = "{\"ref_pid\":" + pp.ref_pid + ",\"vid\":" + pv.vid + ",\"value\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"value_unit\":\"" + value_unit + "\"},";
|
||||
goods_properties += str;
|
||||
}
|
||||
pddApi.Data["goods_properties"] = "[" + goods_properties.Trim(',') + "]";
|
||||
|
||||
pddApi.Data["goods_type"] = 1;
|
||||
if (!string.IsNullOrEmpty(prodInfo.detail.image_url))
|
||||
@@ -6937,10 +7112,7 @@ Content-Type: image/jpeg
|
||||
#region 厂商直采获取推单运费模板,计算运费加价。
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (cell != null)
|
||||
{
|
||||
cell.Value = "正在选取运费模板";
|
||||
}
|
||||
//cell.Value = "正在选取运费模板";
|
||||
}));
|
||||
|
||||
var shippingTemplateJson = "";
|
||||
@@ -7049,41 +7221,47 @@ Content-Type: image/jpeg
|
||||
var skuInfo = JsonHelper.DeserializeJsonToObject<sku_item>(JsonHelper.SerializeObject(sku));
|
||||
skuInfo.is_onsale = skuInfo.is_onsale != null ? skuInfo.is_onsale : 1;
|
||||
skuInfo.limit_quantity = 999; // 只入参999
|
||||
skuInfo.multi_price = (sku.multi_price * this.txtAddTimes.Text.Trim().ParseToDecimal() + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
skuInfo.price = (sku.price * this.txtAddTimes.Text.Trim().ParseToDecimal() + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
//厂商直采的上家缺货则保持缺货。
|
||||
|
||||
// 厂商直采的上家缺货则保持缺货。
|
||||
if (skuInfo.quantity != 0)
|
||||
skuInfo.quantity = txtStockNum.Text.Trim().ParseToInt();
|
||||
|
||||
skuInfo.multi_price += shipPrice;
|
||||
skuInfo.price += shipPrice;
|
||||
var new_multi_price = sku.multi_price + (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
|
||||
skuInfo.multi_price = (new_multi_price * this.txtAddTimes.Text.Trim().ParseToDecimal() + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
//skuInfo.price = (sku.price * this.txtAddTimes.Text.Trim().ParseToDecimal() + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
if (isAddMorePriceFirst) // 先加后乘
|
||||
skuInfo.multi_price = ((sku.multi_price + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100) * this.txtAddTimes.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
skuInfo.multi_price = ((new_multi_price + this.txtAddMorePrice.Text.Trim().ParseToDecimal() * 100) * this.txtAddTimes.Text.Trim().ParseToDecimal()).ParseToInt();
|
||||
skuInfo.price = skuInfo.multi_price + Math.Max(100, this.txtSinglePriceAdd.Text.Trim().ParseToDecimal() * 100).ParseToInt();
|
||||
//阶梯式加价,如果命中则按阶梯式加价进行
|
||||
|
||||
// 阶梯式加价,如果命中则按阶梯式加价进行
|
||||
if (isStepAddPrice)
|
||||
{
|
||||
foreach (var addPrice in lstAddPriceRule)
|
||||
{
|
||||
if (sku.multi_price > addPrice.MoreThanPrice * 100 && sku.multi_price <= addPrice.LessThanPrice * 100)
|
||||
if (new_multi_price > addPrice.MoreThanPrice * 100 && new_multi_price <= addPrice.LessThanPrice * 100)
|
||||
{
|
||||
if (isAddMorePriceFirst) // 先加后乘
|
||||
skuInfo.multi_price = ((sku.multi_price + addPrice.AddMorePrice * 100) * addPrice.AddPriceTimes).ParseToInt();
|
||||
skuInfo.multi_price = ((new_multi_price + addPrice.AddMorePrice * 100) * addPrice.AddPriceTimes).ParseToInt();
|
||||
else
|
||||
skuInfo.multi_price = (sku.multi_price * addPrice.AddPriceTimes + addPrice.AddMorePrice * 100).ParseToInt();
|
||||
skuInfo.multi_price = (new_multi_price * addPrice.AddPriceTimes + addPrice.AddMorePrice * 100).ParseToInt();
|
||||
skuInfo.price = skuInfo.multi_price + Math.Max(100, addPrice.SinglePriceAdd * 100).ParseToInt(); ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
addPriceSkuInfoLst.Add(skuInfo);
|
||||
// 聚水潭商品 加邮费×倍率 放前面
|
||||
//skuInfo.multi_price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
//skuInfo.price += (shipPrice * defaultAddPriceRule.AddShippingFeeTimes).ParseToInt();
|
||||
|
||||
if (marketPrice < skuInfo.price + 1000)
|
||||
{
|
||||
marketPrice = skuInfo.price.ParseToInt() + 1000;
|
||||
pddApi.Data["market_price"] = marketPrice;
|
||||
}
|
||||
|
||||
addPriceSkuInfoLst.Add(skuInfo);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -7097,7 +7275,7 @@ Content-Type: image/jpeg
|
||||
var errMsg = BaseRegex.GetStringJson(ref PddGoodsSpecGetApiRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = PddGoodsSpecGetApiRst;
|
||||
return errMsg;
|
||||
return "初始化Sku属性失败 " + errMsg;
|
||||
}
|
||||
|
||||
Dictionary<long, string> specNameDic = new Dictionary<long, string>();
|
||||
@@ -7136,16 +7314,22 @@ Content-Type: image/jpeg
|
||||
var errMsg = BaseRegex.GetStringJson(ref PddGoodsSpecIdGetApiRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = PddGoodsSpecIdGetApiRst;
|
||||
return errMsg;
|
||||
return "Sku属性生成失败 " + errMsg;
|
||||
}
|
||||
specInfo.spec_id = BaseRegex.GetLongJson(ref PddGoodsSpecIdGetApiRst, "spec_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<string, string> skuImgDic = new Dictionary<string, string>();
|
||||
// 拼接sku,计算最高价格和最低价格
|
||||
for (int i = 0; i < addPriceSkuInfoLst.Count; i++)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "正在生成Sku " + (i + 1) + "/" + addPriceSkuInfoLst.Count;
|
||||
}));
|
||||
|
||||
string spec = "";
|
||||
for (int j = 0; j < addPriceSkuInfoLst[i].spec.Count; j++)
|
||||
{
|
||||
@@ -7153,38 +7337,48 @@ Content-Type: image/jpeg
|
||||
}
|
||||
spec = spec.Trim(',');
|
||||
|
||||
string errMsg = "";
|
||||
var imgBase64 = WXForms.ProductForms.WXDBProdUploadForm.GetImgBase64ForApi(out errMsg, addPriceSkuInfoLst[i].thumb_url, false, false);
|
||||
if (!string.IsNullOrEmpty(errMsg))
|
||||
string thumb_url = "";
|
||||
if (skuImgDic.ContainsKey(addPriceSkuInfoLst[i].thumb_url))
|
||||
{
|
||||
return errMsg;
|
||||
thumb_url = skuImgDic[addPriceSkuInfoLst[i].thumb_url];
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMsg = "";
|
||||
var imgBase64 = WXForms.ProductForms.WXDBProdUploadForm.GetImgBase64ForApi(out errMsg, addPriceSkuInfoLst[i].thumb_url, false, false);
|
||||
if (!string.IsNullOrEmpty(errMsg))
|
||||
{
|
||||
return "初始化Sku图片错误 " + errMsg;
|
||||
}
|
||||
|
||||
var pddUpImgApi = new PddApi(shop);
|
||||
pddUpImgApi.Data["image"] = "data:image/jpeg;base64," + imgBase64;
|
||||
var pddUpImgApiRst = pddUpImgApi.PddGoodsImageUpload();
|
||||
if (!pddUpImgApiRst.Contains("\"goods_image_upload_response\""))
|
||||
{
|
||||
errMsg = BaseRegex.GetStringJson(ref pddUpImgApiRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = pddUpImgApiRst;
|
||||
return "生成Sku图片错误 " + errMsg;
|
||||
}
|
||||
thumb_url = BaseRegex.GetStringJson(ref pddUpImgApiRst, "image_url");
|
||||
skuImgDic[addPriceSkuInfoLst[i].thumb_url] = thumb_url;
|
||||
}
|
||||
|
||||
var pddUpImgApi = new PddApi(shop);
|
||||
pddUpImgApi.Data["image"] = "data:image/jpeg;base64," + imgBase64;
|
||||
var pddUpImgApiRst = pddUpImgApi.PddGoodsImageUpload();
|
||||
if (!pddUpImgApiRst.Contains("\"goods_image_upload_response\""))
|
||||
{
|
||||
errMsg = BaseRegex.GetStringJson(ref pddUpImgApiRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = pddUpImgApiRst;
|
||||
return errMsg;
|
||||
}
|
||||
addPriceSkuInfoLst[i].thumb_url = BaseRegex.GetStringJson(ref pddUpImgApiRst, "image_url");
|
||||
int weight = addPriceSkuInfoLst[i].weight.IsNullOrZero() ? 1000 : addPriceSkuInfoLst[i].weight.ParseToInt();
|
||||
|
||||
skuApiString += ",{\"is_onsale\":" + addPriceSkuInfoLst[i].is_onsale + ",\"limit_quantity\":" + addPriceSkuInfoLst[i].limit_quantity +
|
||||
",\"price\":\"" + addPriceSkuInfoLst[i].price + "\",\"weight\":1000,\"multi_price\":\"" + addPriceSkuInfoLst[i].multi_price +
|
||||
"\",\"thumb_url\":\"" + addPriceSkuInfoLst[i].thumb_url + "\",\"out_sku_sn\":\"" + addPriceSkuInfoLst[i].out_sku_sn +
|
||||
",\"price\":\"" + addPriceSkuInfoLst[i].price + "\",\"weight\":" + weight + ",\"multi_price\":\"" + addPriceSkuInfoLst[i].multi_price +
|
||||
"\",\"thumb_url\":\"" + thumb_url + "\",\"out_sku_sn\":\"" + addPriceSkuInfoLst[i].out_sku_sn +
|
||||
"\",\"quantity\":" + addPriceSkuInfoLst[i].quantity + ",\"spec_id_list\":\"[" + spec + "]\"}";
|
||||
if (addPriceSkuInfoLst[i].multi_price > maxPrice)
|
||||
maxPrice = addPriceSkuInfoLst[i].multi_price;
|
||||
if (addPriceSkuInfoLst[i].multi_price < minPrice)
|
||||
minPrice = addPriceSkuInfoLst[i].multi_price;
|
||||
}
|
||||
pddApi.Data.Remove("goods_properties");
|
||||
pddApi.Data["sku_list"] = "[" + skuApiString.Trim(',') + "]";
|
||||
|
||||
//满两件折扣,todo通过pdd.goods.cat.rule.get查询具体规则
|
||||
//满两件折扣,todo可通过pdd.goods.cat.rule.get查询具体规则
|
||||
pddApi.Data["two_pieces_discount"] = 99;
|
||||
|
||||
int retryTimes = 20;
|
||||
@@ -7196,6 +7390,13 @@ Content-Type: image/jpeg
|
||||
pddApi.Data["is_refundable"] = true;
|
||||
goto retry;
|
||||
}
|
||||
if (!upLoadRst.Contains("goods_add_response"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref upLoadRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = upLoadRst;
|
||||
return "商品提交失败 " + errMsg;
|
||||
}
|
||||
|
||||
var goods_id = BaseRegex.GetStringJson(ref upLoadRst, "goods_id");
|
||||
return "{\"success\":true,\"goods_id\":" + goods_id + ",\"status\":\"已上传\",\"msg\":\"上传成功\"}";
|
||||
@@ -7514,6 +7715,64 @@ Content-Type: image/jpeg
|
||||
{
|
||||
WaitUploadTime = txtWaitSeconds.Text.ParseToInt();
|
||||
}
|
||||
|
||||
private void btnRefreshApi_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshApi(true);
|
||||
}
|
||||
|
||||
void RefreshApi(bool isForceRefresh = false)
|
||||
{
|
||||
pbShopLoading.Visible = true;
|
||||
// 选中的店铺Id
|
||||
Task.Run(() =>
|
||||
{
|
||||
while (!StartUp.IsShopInit)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
shop.Message = "";
|
||||
BindShop(shop, selectIds);
|
||||
}));
|
||||
PddApiHelper.RefreshApi(shop, isForceRefresh);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
shop.Message = "授权更新完成";
|
||||
BindShop(shop, selectIds);
|
||||
}));
|
||||
}
|
||||
List<List<AuthInfo>> lsts = GlobalConfig.ShopLoginList.Select(s => s.ApiAuthInfoList).ToList();
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_shop_api_auth_info_lists", lsts);
|
||||
Invoke(new Action(() => { pbShopLoading.Visible = false; }));
|
||||
});
|
||||
}
|
||||
|
||||
private void btnProdDb_Click(object sender, EventArgs e)
|
||||
{
|
||||
WXUserProdListForm.Instance.lstTemuDBProductSelect = this.lstTemuDBProductSelect;
|
||||
WXUserProdListForm.Instance.cmbSourceType.Items.Clear();
|
||||
WXUserProdListForm.Instance.cmbSourceType.Items.AddRange(this.cmbSourceType.Items.Cast<Object>().ToArray());
|
||||
WXUserProdListForm.Instance.SaveComplete -= dbProdList_SaveComplete;
|
||||
WXUserProdListForm.Instance.SaveComplete += dbProdList_SaveComplete;
|
||||
WXUserProdListForm.Instance.Show();
|
||||
WXUserProdListForm.Instance.BringToFront();
|
||||
}
|
||||
|
||||
private void dbProdList_SaveComplete(object obj)
|
||||
{
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_db_prod_upload_list", this.lstTemuDBProductSelect);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public class AddPriceRule
|
||||
@@ -7546,6 +7805,7 @@ Content-Type: image/jpeg
|
||||
/// 上货库存量设置
|
||||
/// </summary>
|
||||
public int StockNum { get; set; } = 0;
|
||||
public decimal AddShippingFeeTimes { get; set; } = 1;
|
||||
}
|
||||
|
||||
public class PddUploadRule
|
||||
|
||||
@@ -135,6 +135,9 @@
|
||||
<metadata name="colLoginStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colApiStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colCanUse.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
||||
+4
-1
@@ -22,6 +22,7 @@ using Work;
|
||||
using AllBase.Model.Param.TemuProductManage;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
using TemuKJD.KJDForms.AdminForms;
|
||||
using TemuKJD.BLL.PddApi;
|
||||
|
||||
namespace TemuKJD
|
||||
{
|
||||
@@ -78,15 +79,17 @@ namespace TemuKJD
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Temu店铺登录信息
|
||||
#region 店铺登录信息
|
||||
Task.Run((Action)(() =>
|
||||
{
|
||||
while (!BaseClass.IsLoginSuccess)
|
||||
Thread.Sleep(200);
|
||||
|
||||
ShopListForm.UpdateShop();
|
||||
PddApiHelper.PddGetLocalTokens();
|
||||
IsShopInit = true;
|
||||
}));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Temu店铺登录设置参数
|
||||
|
||||
+6
-6
@@ -404,7 +404,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.cmbCat3.DropDownWidth = 1;
|
||||
this.cmbCat3.FormattingEnabled = true;
|
||||
this.cmbCat3.IntegralHeight = false;
|
||||
this.cmbCat3.Location = new System.Drawing.Point(883, 7);
|
||||
this.cmbCat3.Location = new System.Drawing.Point(883, 5);
|
||||
this.cmbCat3.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbCat3.Name = "cmbCat3";
|
||||
this.cmbCat3.Size = new System.Drawing.Size(201, 25);
|
||||
@@ -432,7 +432,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.cmbCat2.DropDownWidth = 1;
|
||||
this.cmbCat2.FormattingEnabled = true;
|
||||
this.cmbCat2.IntegralHeight = false;
|
||||
this.cmbCat2.Location = new System.Drawing.Point(625, 7);
|
||||
this.cmbCat2.Location = new System.Drawing.Point(625, 5);
|
||||
this.cmbCat2.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbCat2.Name = "cmbCat2";
|
||||
this.cmbCat2.Size = new System.Drawing.Size(201, 25);
|
||||
@@ -460,7 +460,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.cmbCat1.DropDownWidth = 1;
|
||||
this.cmbCat1.FormattingEnabled = true;
|
||||
this.cmbCat1.IntegralHeight = false;
|
||||
this.cmbCat1.Location = new System.Drawing.Point(348, 7);
|
||||
this.cmbCat1.Location = new System.Drawing.Point(348, 5);
|
||||
this.cmbCat1.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbCat1.Name = "cmbCat1";
|
||||
this.cmbCat1.Size = new System.Drawing.Size(201, 25);
|
||||
@@ -520,7 +520,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
"安全+未校验",
|
||||
"安全商品",
|
||||
"未校验"});
|
||||
this.cmbWxSafe.Location = new System.Drawing.Point(71, 42);
|
||||
this.cmbWxSafe.Location = new System.Drawing.Point(71, 40);
|
||||
this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbWxSafe.Name = "cmbWxSafe";
|
||||
this.cmbWxSafe.Size = new System.Drawing.Size(201, 25);
|
||||
@@ -541,7 +541,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
"机会商品",
|
||||
"以图搜品",
|
||||
"外部数据"});
|
||||
this.cmbSourceType.Location = new System.Drawing.Point(883, 42);
|
||||
this.cmbSourceType.Location = new System.Drawing.Point(883, 40);
|
||||
this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.cmbSourceType.Name = "cmbSourceType";
|
||||
this.cmbSourceType.Size = new System.Drawing.Size(201, 25);
|
||||
@@ -1604,7 +1604,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
private DevComponents.DotNetBar.PanelEx btnSelect;
|
||||
private System.Windows.Forms.ComboBox cmbGroupFilter;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.ComboBox cmbSourceType;
|
||||
private System.Windows.Forms.Label lblSourceType;
|
||||
private System.Windows.Forms.Label lblWxSafe;
|
||||
private System.Windows.Forms.ComboBox cmbWxSafe;
|
||||
@@ -1683,5 +1682,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
private System.Windows.Forms.TextBox txtCatBoundLessThan;
|
||||
private System.Windows.Forms.TextBox txtCatBoundMoreThan;
|
||||
private UserComponent.UcCheckBox chkCatBoundLessThan;
|
||||
public System.Windows.Forms.ComboBox cmbSourceType;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ namespace Work.Api
|
||||
public ProductCollectBase Product;
|
||||
public bool IsPinduoduo = false;
|
||||
public bool OnSale = true;
|
||||
public bool IsOnSale { get { return OnSale; } set { OnSale = value; } }
|
||||
public AlibabaProductGet(ProductCollectBase p)
|
||||
{
|
||||
Product = p;
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Work.Api
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public static Dictionary<long, List<Tuple<string, int, int, string>>> goodCacheContent = new Dictionary<long, List<Tuple<string, int, int, string>>>();
|
||||
|
||||
public static bool isUseCache = true;
|
||||
public static Dictionary<long, DateTime> EditDayTemp = new Dictionary<long, DateTime>();
|
||||
public static Dictionary<long, DateTime> CatDayTemp = new Dictionary<long, DateTime>();
|
||||
@@ -126,6 +128,9 @@ namespace Work.Api
|
||||
public static bool isUseTaoBaoCache = true;
|
||||
public static bool isUseDouYinCache = true;
|
||||
public static List<PriceRangeModel> PriceModelList = new List<PriceRangeModel>();
|
||||
|
||||
public static bool CheckSearch = false;
|
||||
|
||||
public void Get()
|
||||
{
|
||||
upRunning = true;
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
using AllBase;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Work.Api;
|
||||
|
||||
namespace Work.Business
|
||||
{
|
||||
public class CatBLL
|
||||
{
|
||||
Dictionary<string, List<int>> dicCat = new Dictionary<string, List<int>>();
|
||||
public static List<CatInfo> lstCatInfo = new List<CatInfo>();
|
||||
public void GetCat1()
|
||||
{
|
||||
var Shop = GetShopLoginInfo.Shops.Find(s => s.ShopName == "pdd49094313446");
|
||||
string url = "https://mms.pinduoduo.com/vodka/v2/mms/cat1List";
|
||||
string refere = "https://mms.pinduoduo.com/goods/category";
|
||||
string htmlx = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, "", Shop.Cookies);
|
||||
var mc = BaseRegex.GetMatchRegex(ref htmlx, @"\{[^}]+?""stapleName"":\[([\w\W]+?)\]\}");
|
||||
dicCat.Clear();
|
||||
for (int i = 0; mc != null && i < mc.Count; i++)
|
||||
{
|
||||
var item = mc[i].Groups[0].Value;
|
||||
int catid = BaseRegex.GetIntJson(ref item, "id");//商品ID
|
||||
string stapleName = mc[i].Groups[1].Value;//商品ID
|
||||
if (dicCat.ContainsKey(stapleName))
|
||||
{
|
||||
dicCat[stapleName].Add(catid);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<int> lst = new List<int>();
|
||||
lst.Add(catid);
|
||||
dicCat.Add(stapleName, lst);
|
||||
}
|
||||
string name = BaseRegex.GetStringJson(ref item, "name");//商品ID
|
||||
CatInfo cat = new CatInfo();
|
||||
cat.CatId = catid;
|
||||
cat.CatName = name;
|
||||
lstCatInfo.Add(cat);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetAllCat()
|
||||
{
|
||||
var Shop = GetShopLoginInfo.Shops.Find(s => s.ShopName == "pdd49094313446");
|
||||
if (Shop == null)
|
||||
return;
|
||||
|
||||
lstCatInfo.Clear();
|
||||
if (File.Exists("full_cat_json.txt"))
|
||||
{
|
||||
lstCatInfo = JsonHelper.DeserializeJsonToObject<List<CatInfo>>(FileBase.ReadAllText("full_cat_json.txt"));
|
||||
}
|
||||
|
||||
var catNotGetChild = new CatInfo { CatId = 0, CatLevel = 0, CatName = "", ParentCatId = 0 };
|
||||
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
||||
while (catNotGetChild != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Threading.Thread.Sleep(2000 + Randomx.GetId(2000));
|
||||
string url = "https://mms.pinduoduo.com/vodka/v2/mms/categories?parentId=" + catNotGetChild.CatId;
|
||||
string html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, "", Shop.Cookies);
|
||||
|
||||
JObject jObj = JObject.Parse(html);
|
||||
JArray jArr = jObj["result"] as JArray;
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
var itemStr = item.ToString();
|
||||
int level = BaseRegex.GetIntJson(ref itemStr, "level");
|
||||
int catId = BaseRegex.GetIntJson(ref itemStr, "id");
|
||||
bool isLeaf = BaseRegex.GetIntJson(ref itemStr, "leaf") == 1;
|
||||
int parentCatId = BaseRegex.GetIntJson(ref itemStr, "parent_id");
|
||||
string catName = BaseRegex.GetStringJson(ref itemStr, "cat_name");
|
||||
CatInfo c = new CatInfo
|
||||
{
|
||||
CatId = catId,
|
||||
CatLevel = level,
|
||||
CatName = catName,
|
||||
ParentCatId = parentCatId,
|
||||
IsLeaf = isLeaf,
|
||||
cat_id_1 = BaseRegex.GetIntJson(ref itemStr, "cat_id_1"),
|
||||
cat_id_2 = BaseRegex.GetIntJson(ref itemStr, "cat_id_2"),
|
||||
cat_id_3 = BaseRegex.GetIntJson(ref itemStr, "cat_id_3"),
|
||||
cat_id_4 = BaseRegex.GetIntJson(ref itemStr, "cat_id_4"),
|
||||
};
|
||||
if (!lstCatInfo.Any(lc => lc.CatId == c.CatId))
|
||||
lstCatInfo.Add(c);
|
||||
}
|
||||
catNotGetChild.IsGet = true;
|
||||
FileBase.WriteAllText("full_cat_json.txt", JsonHelper.SerializeObject(lstCatInfo));
|
||||
catNotGetChild = lstCatInfo.FirstOrDefault(lc => lc.IsGet == false && lc.CatLevel < 4 && !lc.IsLeaf);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (lstCatInfo.Count > 0)
|
||||
{
|
||||
string catstr = "";
|
||||
foreach (var item in lstCatInfo)
|
||||
{
|
||||
catstr += item.CatId + "," + item.cat_id_1 + "," + item.cat_id_2 + "," + item.cat_id_3 + "," + item.cat_id_4 + "\r\n";
|
||||
}
|
||||
FileBase.WriteAllText("full_cat.txt", catstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CatInfo
|
||||
{
|
||||
public int CatId { get; set; }
|
||||
public int CatLevel { get; set; }
|
||||
public int ParentCatId { get; set; }
|
||||
public string CatName { get; set; }
|
||||
public bool IsGet { get; set; }
|
||||
public bool IsLeaf { get; set; }
|
||||
public int cat_id_1 { get; set; }
|
||||
public int cat_id_2 { get; set; }
|
||||
public int cat_id_3 { get; set; }
|
||||
public int cat_id_4 { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using AllBase;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Work.Api;
|
||||
|
||||
namespace Work.Business
|
||||
{
|
||||
public class CpsApiBLL
|
||||
{
|
||||
public string Name = "";
|
||||
|
||||
public CpsApiBLL(string name = "")
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public void GetCpsMall(List<ShopChatBase> shops)
|
||||
{
|
||||
foreach (var shop in shops)
|
||||
{
|
||||
Thread.Sleep(250 + Randomx.GetId(500));
|
||||
GetCpsMallRate(shop);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetCpsMallRate(ShopChatBase shop)
|
||||
{
|
||||
PinduoduoApiGetProduct api = new PinduoduoApiGetProduct(shop);
|
||||
string html = api.GetCpsShopSet();
|
||||
if (html.Contains("goods_cps_mall_unit_query_response"))
|
||||
{
|
||||
int rate = BaseRegex.GetIntJson(ref html, "rate");
|
||||
int status = BaseRegex.GetIntJson(ref html, "status");
|
||||
shop.CpsShop.Percent = (rate / 10m) + "%";
|
||||
shop.CpsShop.Message = status == 1 ? "全店推广中" + shop.CpsShop.Percent : "未开启全店推广";
|
||||
}
|
||||
else
|
||||
{
|
||||
LogSave.Add(Name, "店铺" + shop.ShopName + "(" + shop.Name + ")" + "读取推广数据失败。");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Work.Business.ProductMappingBLL
|
||||
{
|
||||
public class MappingTaoBaoBLL
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="prodList"></param>
|
||||
/// <param name="minPrice"></param>
|
||||
/// <param name="maxPrice"></param>
|
||||
/// <param name="isGetTitle">如果是标题搜索,则放宽限制</param>
|
||||
/// <returns></returns>
|
||||
public static List<Tuple<string, int, int,string>> FilterItems(List<Tuple<string, int, int,string>> prodList, int minPrice, int maxPrice = 0, bool isGetTitle = false, decimal multiple = 20M)
|
||||
{
|
||||
if (prodList == null || prodList.Count == 0)
|
||||
return new List<Tuple<string, int, int,string>>();
|
||||
|
||||
var result = prodList.Where(p => !string.IsNullOrEmpty(p.Item1) && p.Item2 >= minPrice && p.Item3 >= maxPrice && p.Item3 < (maxPrice * 3.5M + 3000)).ToList();
|
||||
var resultx = result.Where(r => r.Item2 != r.Item3).ToList();
|
||||
if (resultx.Count > 0)
|
||||
return resultx;
|
||||
if (result.Count > 0)
|
||||
return result;
|
||||
|
||||
if (isGetTitle)
|
||||
{
|
||||
result = prodList.Where(p => !string.IsNullOrEmpty(p.Item1) && p.Item2 >= minPrice && p.Item3 < (maxPrice * multiple + 3000)).ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using AllBase;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Work.Business.ProductMappingBLL
|
||||
{
|
||||
public class MappingVDianApiBLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 0上货缓存 1标题缓存 2标题搜索 3接口上货 4接口上货失败 5模拟上货 6微店群控接口上货 7标题分词缓存 8标题分词搜索 9类目搜索 10随机数据 11全文检索成功 12全文检索无满足条件 13全文检索失败 14淘宝搜索 15阿里图片搜索 16京喜搜索
|
||||
/// </summary>
|
||||
/// <param name="resultNumber">0上货缓存 1标题缓存 2标题搜索 3接口上货 4接口上货失败 5模拟上货 6微店群控接口上货 7标题分词缓存 8标题分词搜索 9类目搜索 10随机数据 11全文检索成功 12全文检索无满足条件 13全文检索失败</param>
|
||||
public static void UpDateMappingResultToStatistics(string resultNumber)
|
||||
{
|
||||
|
||||
var html = GetHtml.GetUtf8("http://cache.aigio.cn/?type=" + resultNumber, "", 6);
|
||||
if (html != "ok")
|
||||
{
|
||||
html = GetHtml.GetUtf8("http://cache.aigio.cn/?type=" + resultNumber, "", 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
using AllBase;
|
||||
using AllBase.Model.Param.ToolsManage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Work;
|
||||
using Work.Api;
|
||||
|
||||
namespace Work.Business.ProductMappingBLL
|
||||
{
|
||||
public class MappingVDianCacheBLL
|
||||
{
|
||||
public static List<Tuple<string, int, int,string>> GetFakeCacheVDianTitle(string productTitle, ref string mappingFrom, string tid = "")
|
||||
{
|
||||
return GetFakeCacheVDianTitleSub(productTitle, ref mappingFrom, tid);
|
||||
}
|
||||
public static void GetFakeCacheQueueVDianTitle(List<ProductMappingImportParam> prod, ref string mappingFrom, string tid = "")
|
||||
{
|
||||
GetFakeCacheVDianQueueTitleSub(prod, ref mappingFrom, tid);
|
||||
}
|
||||
|
||||
public static List<Tuple<string, int, int,string>> GetFakeCacheVDianFissionTitle(string productTitle, ref string mappingFrom, string tid = "")
|
||||
{
|
||||
return GetFakeCacheVDianTitleSub(productTitle, ref mappingFrom, tid, "get_cache_fission_title");
|
||||
}
|
||||
|
||||
public static List<Tuple<string, int, int,string>> GetFakeCacheVDianFissionTitleList(string productTitle, ref string mappingFrom)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int,string>>();
|
||||
|
||||
if (string.IsNullOrEmpty(productTitle) || productTitle.Length <= 14)
|
||||
return result;
|
||||
|
||||
var title0_14 = productTitle.Substring(0, 14);
|
||||
var title0_7 = productTitle.Substring(0, 7);
|
||||
var title7_7 = productTitle.Substring(7, 7);
|
||||
var title0_5 = productTitle.Substring(0, 5);
|
||||
var title4_5 = productTitle.Substring(4, 5);
|
||||
var title8_5 = productTitle.Substring(8, 5);
|
||||
var title0_3 = productTitle.Substring(0, 3);
|
||||
var title3_3 = productTitle.Substring(3, 3);
|
||||
var title6_3 = productTitle.Substring(6, 3);
|
||||
var title9_3 = productTitle.Substring(9, 3);
|
||||
var title12_3 = productTitle.Substring(12, 3);
|
||||
string[] titleArr = new string[] { title0_14, title0_7, title7_7, title0_5, title4_5, title8_5, title0_3, title3_3, title6_3, title9_3, title12_3 };
|
||||
|
||||
var html = "";
|
||||
string url = BaseClass.BuildObjString("data_change&act=get_cache_fission_title_list");
|
||||
string data = "&data=";
|
||||
foreach (var t in titleArr)
|
||||
{
|
||||
var md5id = Md5Base.GetMd5(t).Substring(8, 16);
|
||||
data += md5id + "," + Math.Abs(BaseClass.GetLong(md5id)) % 1024 + ";";
|
||||
}
|
||||
data += "&" + UserLogin.GetSignaturex();
|
||||
// 根据商品标题查找缓存
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
|
||||
// 读取缓存成功
|
||||
if (!string.IsNullOrEmpty(html) && !html.ToLower().Contains("error"))
|
||||
{
|
||||
mappingFrom = "微店";
|
||||
var contents = BaseRegex.GetMatchRegex(html, "\"content\":\"([\\s\\S]+?)\"");
|
||||
|
||||
foreach (System.Text.RegularExpressions.Match m in contents)
|
||||
{
|
||||
var content = m.Groups[1]?.ToString();
|
||||
if (content == null)
|
||||
content = "";
|
||||
try
|
||||
{
|
||||
var tupleItems = content.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var tupleItem in tupleItems)
|
||||
{
|
||||
var items = tupleItem.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (items.Length >= 2 && items[0].Length > 5)
|
||||
{
|
||||
try
|
||||
{
|
||||
var item1 = items[0];
|
||||
var item2 = items[1];
|
||||
var item3 = items.Length >= 3 ? items[2] : items[1];
|
||||
var item4 = items.Length >= 4 ? items[3] : "";
|
||||
result.Add(new Tuple<string, int, int,string>(item1, Convert.ToInt32(item2), Convert.ToInt32(item3),item4));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据商品标题寻找微店商品缓存
|
||||
/// </summary>
|
||||
/// <param name="prod">导入商品</param>
|
||||
/// <param name="mappingFrom"></param>
|
||||
/// <param name="isVDian"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Tuple<string, int, int,string>> GetFakeCacheVDianTitleSub(string productTitle, ref string mappingFrom, string tid = "", string act = "get_cache_title")
|
||||
{
|
||||
var result = new List<Tuple<string, int, int,string>>();
|
||||
var html = "";
|
||||
|
||||
if (string.IsNullOrEmpty(productTitle))
|
||||
return result;
|
||||
|
||||
string url = BaseClass.BuildObjString("data_change&act=" + act);
|
||||
string data = "";
|
||||
// 根据商品标题查找缓存
|
||||
if (string.IsNullOrEmpty(html) || html.ToLower().Contains("error"))
|
||||
{
|
||||
if (tid == "")
|
||||
tid = Md5Base.GetMd5(productTitle).Substring(8, 16);
|
||||
long suffix = Math.Abs(BaseClass.GetLong(tid)) % 1024;
|
||||
data = "&tid=" + tid
|
||||
+ "&suffix=" + suffix
|
||||
+ "&" + UserLogin.GetSignaturex();
|
||||
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
}
|
||||
// 读取缓存成功
|
||||
if (!string.IsNullOrEmpty(html) && !html.ToLower().Contains("error"))
|
||||
{
|
||||
mappingFrom = "微店";
|
||||
string content = BaseRegex.GetMatchRegexString(html, "\"content\":\"([\\s\\S]+?)(])\"");
|
||||
if (content != null)
|
||||
{
|
||||
content = content.Replace("\\", "") + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
content = BaseRegex.GetMatchRegexString(html, "\"content\":\"([\\s\\S]+?)\"");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var tupleItems = content.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var tupleItem in tupleItems)
|
||||
{
|
||||
var items = tupleItem.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (items.Length >= 2 && items[0].Length > 5)
|
||||
{
|
||||
try
|
||||
{
|
||||
var item1 = items[0];
|
||||
var item2 = items[1];
|
||||
var item3 = items.Length >= 3 ? items[2] : items[1];
|
||||
var item4 = items.Length >= 4? items[3] : "";
|
||||
result.Add(new Tuple<string, int, int,string>(item1, Convert.ToInt32(item2), Convert.ToInt32(item3),item4));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void GetFakeCacheVDianQueueTitleSub(List<ProductMappingImportParam> prods, ref string mappingFrom, string tid = "", string act = "get_cache_title")
|
||||
{
|
||||
//var result = new List<Tuple<string, int, int, string>>();
|
||||
var html = "";
|
||||
string url = BaseClass.BuildObjString("data_change&act=get_cache_title_list");
|
||||
string temp = "";
|
||||
for (int i = 0; i < prods.Count; i++)
|
||||
{
|
||||
var prod = prods[i];
|
||||
|
||||
// 根据商品标题查找缓存
|
||||
if (string.IsNullOrEmpty(html) || html.ToLower().Contains("error"))
|
||||
{
|
||||
|
||||
tid = Md5Base.GetMd5(prod.ProductTitle).Substring(8, 16);
|
||||
long suffix = Math.Abs(BaseClass.GetLong(tid)) % 1024;
|
||||
if (!string.IsNullOrEmpty(temp))
|
||||
temp += ";";
|
||||
temp += suffix + "," + tid;
|
||||
}
|
||||
}
|
||||
string data = "&tids=" + temp+ "&" + UserLogin.GetSignaturex();
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
// 读取缓存成功
|
||||
if (!string.IsNullOrEmpty(html) && !html.ToLower().Contains("error"))
|
||||
{
|
||||
var m = BaseRegex.GetMatchRegex(ref html, @"\{([^\]]+?)\}");
|
||||
for (int i = 0; i < m.Count; i++)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int, string>>();
|
||||
var proStr = m[i].Groups[0].Value;
|
||||
mappingFrom = "微店";
|
||||
string title =GetHtml.UrlDecode(BaseRegex.GetStringJson(ref proStr, @"title"));
|
||||
var prod = prods.Find(s => title.Contains(s.ProductTitle));
|
||||
if (prod == null) continue;
|
||||
string content = BaseRegex.GetMatchRegexString(proStr, "\"content\":\"([\\s\\S]+?)\"");
|
||||
if (content != null)
|
||||
{
|
||||
content = content.Replace("\\", "") ;
|
||||
}
|
||||
else
|
||||
{
|
||||
content = BaseRegex.GetMatchRegexString(proStr, "\"content\":\"([\\s\\S]+?)\"");
|
||||
}
|
||||
try
|
||||
{
|
||||
var tupleItems = content.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var tupleItem in tupleItems)
|
||||
{
|
||||
var items = tupleItem.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (items.Length >= 2 && items[0].Length > 5)
|
||||
{
|
||||
try
|
||||
{
|
||||
var item1 = items[0];
|
||||
var item2 = items[1];
|
||||
var item3 = items.Length >= 3 ? items[2] : items[1];
|
||||
var item4 = items.Length >= 4 ? items[3] : "";
|
||||
result.Add(new Tuple<string, int, int, string>(item1, Convert.ToInt32(item2), Convert.ToInt32(item3), item4));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
UploadPinduoduoMain.goodCacheContent[long.Parse(prod.ProductId)] = result;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < prods.Count; i++)
|
||||
{
|
||||
var prod = prods[i];
|
||||
if (!UploadPinduoduoMain.goodCacheContent.ContainsKey(long.Parse(prod.ProductId)))
|
||||
{
|
||||
var result = new List<Tuple<string, int, int, string>>();
|
||||
UploadPinduoduoMain.goodCacheContent[long.Parse(prod.ProductId)] = result;
|
||||
}
|
||||
//UploadPinduoduoMain.goodCacheContent.Add(long.Parse(prod.ProductId), null);
|
||||
if(UploadPinduoduoMain.goodCacheContent[long.Parse(prod.ProductId)]== null)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int, string>>();
|
||||
UploadPinduoduoMain.goodCacheContent[long.Parse(prod.ProductId)]=result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string SaveFakeCacheVDianTitle(List<Tuple<string, int, int,string>> MappingResult, string productTitle, string mappingFrom, bool isAdd = true)
|
||||
{
|
||||
var content = "";
|
||||
foreach (var item in MappingResult)
|
||||
{
|
||||
content += item.Item1 + "," + item.Item2 + "," + item.Item3 + "," + item.Item4 + ";";
|
||||
}
|
||||
|
||||
string url = BaseClass.BuildObjString("data_change&act=add_cache_title");
|
||||
//if (!isAdd)
|
||||
// url = BaseClass.BuildObjString("data_change&act=update");
|
||||
content = content.Length > 0 ? content.Trim(';') + ";" : content;
|
||||
var tid = Md5Base.GetMd5(productTitle).Substring(8, 16);
|
||||
var suffix = Math.Abs(BaseClass.GetLong(tid)) % 1024;
|
||||
string data = "&tid=" + tid
|
||||
+ "&suffix=" + suffix
|
||||
+ "&content=" + content
|
||||
+ "&title=" + HttpUtility.UrlEncode(productTitle, Encoding.UTF8)
|
||||
+ "&" + UserLogin.GetSignaturex();
|
||||
string result = GetHtml.PostUtf8(url, data);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string SaveFakeCacheVDianFissionTitle(List<Tuple<string, int, int,string>> MappingResult, string productFissionTitle, string mappingFrom, bool isAdd = true)
|
||||
{
|
||||
var content = "";
|
||||
foreach (var item in MappingResult)
|
||||
{
|
||||
content += item.Item1 + "," + item.Item2 + "," + item.Item3 + "," + item.Item4 + ";";
|
||||
}
|
||||
content = content.Length > 0 ? content.Trim(';') + ";" : content;
|
||||
string url = BaseClass.BuildObjString("data_change&act=add_cache_fission_title");
|
||||
|
||||
var tid = Md5Base.GetMd5(productFissionTitle).Substring(8, 16);
|
||||
var suffix = Math.Abs(BaseClass.GetLong(tid)) % 1024;
|
||||
string data = "&tid=" + tid
|
||||
+ "&suffix=" + suffix
|
||||
+ "&content=" + content
|
||||
+ "&title=" + HttpUtility.UrlEncode(productFissionTitle, Encoding.UTF8)
|
||||
+ "&" + UserLogin.GetSignaturex();
|
||||
string result = GetHtml.PostUtf8(url, data);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
using AllBase;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Work.Business.ProductMappingBLL
|
||||
{
|
||||
public class MappingVDianTitleSearchBLL
|
||||
{
|
||||
public static List<Tuple<string, int, int,string>> GetTupleListData(string title,string weidianGetTitleResult)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int,string>>();
|
||||
if (weidianGetTitleResult == null)
|
||||
return result;
|
||||
if (weidianGetTitleResult.Contains("\\\"message\\\":\\\"OK\\\""))
|
||||
{
|
||||
Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
weidianGetTitleResult = jObj["data"].ToString();
|
||||
}
|
||||
Newtonsoft.Json.Linq.JArray jArr = new Newtonsoft.Json.Linq.JArray();
|
||||
if (weidianGetTitleResult.Contains("\"message\":\"OK\""))
|
||||
{
|
||||
Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
jArr = jObj["result"]["viewContainer"] as Newtonsoft.Json.Linq.JArray;
|
||||
}
|
||||
else if (weidianGetTitleResult.Contains("\"data\":["))
|
||||
{
|
||||
Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
jArr = jObj["data"] as Newtonsoft.Json.Linq.JArray;
|
||||
}
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
var str = item.ToString();
|
||||
var id = BaseRegex.GetStringJson(ref str, "itemId");
|
||||
var name = BaseRegex.GetStringJson(ref str, "itemName");
|
||||
if (string.IsNullOrEmpty(name))
|
||||
continue;
|
||||
bool compare = CompareTitle(title, name);
|
||||
if (!compare)
|
||||
continue;
|
||||
var price = BaseRegex.GetIntJson(ref str, "itemPrice");
|
||||
if (!string.IsNullOrEmpty(id) && price > 0)
|
||||
result.Add(new Tuple<string, int, int,string>(id, price, price, DateTime.Now.ToString("yyyy-MM-dd")));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static List<Tuple<string, int, int,string>> GetTupleTaoBaoListData(string weidianGetTitleResult)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int,string>>();
|
||||
if (weidianGetTitleResult == null)
|
||||
return result;
|
||||
//if (weidianGetTitleResult.Contains("\\\"message\\\":\\\"OK\\\""))
|
||||
//{
|
||||
// Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
// weidianGetTitleResult = jObj["data"].ToString();
|
||||
//}
|
||||
Newtonsoft.Json.Linq.JArray jArr = new Newtonsoft.Json.Linq.JArray();
|
||||
//if (weidianGetTitleResult.Contains("\"message\":\"OK\""))
|
||||
//{
|
||||
// Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
// jArr = jObj["result"]["viewContainer"] as Newtonsoft.Json.Linq.JArray;
|
||||
//}
|
||||
if (weidianGetTitleResult.Contains("mtopjsonp2("))
|
||||
weidianGetTitleResult = BaseRegex.GetMatchRegexString(ref weidianGetTitleResult, @"mtopjsonp2\(({[\w\W]+?})\)");
|
||||
if (weidianGetTitleResult.Contains("\"data\":{"))
|
||||
{
|
||||
Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
jArr = jObj["data"]?["recommend"]?["resultList"] as Newtonsoft.Json.Linq.JArray;
|
||||
//var lst = jObj["data"]["resultList"].ToList();
|
||||
//var ss = JArray.Parse(jObj["data"]?["recommend"]?["resultList"]?.ToString())?.ToObject<List<Object>>();
|
||||
}
|
||||
if (jArr == null)
|
||||
return result;
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
var str = item.ToString();
|
||||
var id = BaseRegex.GetStringJson(ref str, "itemId");
|
||||
int price = 0;
|
||||
var pricetemp = BaseRegex.GetDecimalJson(ref str, "promotionPrice");
|
||||
price =(int)(pricetemp * 100);
|
||||
if (!string.IsNullOrEmpty(id) && price > 0)
|
||||
result.Add(new Tuple<string, int, int,string>("tb-"+id, price, price, DateTime.Now.ToString("yyyy-MM-dd")));
|
||||
if (result.Count >= 10)
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Tuple<string, int, int,string>> GetTupleTaoBaoListV2Data(string title,string weidianGetTitleResult)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int,string>>();
|
||||
if (weidianGetTitleResult == null)
|
||||
return result;
|
||||
//if (weidianGetTitleResult.Contains("\\\"message\\\":\\\"OK\\\""))
|
||||
//{
|
||||
// Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
// weidianGetTitleResult = jObj["data"].ToString();
|
||||
//}
|
||||
Newtonsoft.Json.Linq.JArray jArr = new Newtonsoft.Json.Linq.JArray();
|
||||
//if (weidianGetTitleResult.Contains("\"message\":\"OK\""))
|
||||
//{
|
||||
// Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
// jArr = jObj["result"]["viewContainer"] as Newtonsoft.Json.Linq.JArray;
|
||||
//}
|
||||
if (weidianGetTitleResult.Contains("mtopjsonp17("))
|
||||
weidianGetTitleResult = BaseRegex.GetMatchRegexString(ref weidianGetTitleResult, @"mtopjsonp17\(({[\w\W]+?})\)");
|
||||
if (weidianGetTitleResult.Contains("\"data\":{"))
|
||||
{
|
||||
Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
jArr = jObj["data"]?["itemsArray"] as Newtonsoft.Json.Linq.JArray;
|
||||
//var lst = jObj["data"]["resultList"].ToList();
|
||||
//var ss = JArray.Parse(jObj["data"]?["recommend"]?["resultList"]?.ToString())?.ToObject<List<Object>>();
|
||||
}
|
||||
if (jArr == null)
|
||||
return result;
|
||||
var resultx = new List<Tuple<string, int, int, double,string>>();
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
var str = item.ToString();
|
||||
var id = BaseRegex.GetStringJson(ref str, "x_object_id");
|
||||
if (id == null)
|
||||
continue;
|
||||
string name = BaseRegex.GetStringJson(ref str, "title");
|
||||
double simu = BaseClass.GetSimularityBetween2Text(title, name);
|
||||
if (simu < 0.8)
|
||||
continue;
|
||||
bool compare = CompareTitle(title, name);
|
||||
if (!compare)
|
||||
continue;
|
||||
int price = 0;
|
||||
var pricetemp = BaseRegex.GetDecimalJson(ref str, "item_price");
|
||||
price = (int)(pricetemp * 100);
|
||||
if (!string.IsNullOrEmpty(id) && price > 0)
|
||||
resultx.Add(new Tuple<string, int, int, double,string>("tb-" + id, price, price,simu, DateTime.Now.ToString("yyyy-MM-dd")));
|
||||
if (resultx.Count >= 10)
|
||||
break;
|
||||
}
|
||||
resultx = resultx.OrderByDescending(o => o.Item4).ToList();
|
||||
for (int i = 0; i < resultx.Count; i++)
|
||||
{
|
||||
var obj = resultx[i];
|
||||
result.Add(new Tuple<string, int, int, string>(obj.Item1, obj.Item2, obj.Item3, obj.Item5));
|
||||
}
|
||||
//foreach (var item in jArr)
|
||||
//{
|
||||
// var str = item.ToString();
|
||||
// var id = BaseRegex.GetStringJson(ref str, "x_object_id");
|
||||
// if (id == null)
|
||||
// continue;
|
||||
// string name= BaseRegex.GetStringJson(ref str, "title");
|
||||
// double simu= BaseClass.GetSimularityBetween2Text(title, name);
|
||||
// if (simu < 0.85)
|
||||
// continue;
|
||||
// bool compare = CompareTitle(title, name);
|
||||
// if (!compare)
|
||||
// continue;
|
||||
// int price = 0;
|
||||
// var pricetemp = BaseRegex.GetDecimalJson(ref str, "item_price");
|
||||
// price = (int)(pricetemp * 100);
|
||||
// if (!string.IsNullOrEmpty(id) && price > 0)
|
||||
// result.Add(new Tuple<string, int, int,string>("tb-" + id, price, price, DateTime.Now.ToString("yyyy-MM-dd")));
|
||||
// if (result.Count >= 10)
|
||||
// break;
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Tuple<string, int, int, string>> GetTuplejingxiListV2Data(string title, string weidianGetTitleResult)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int, string>>();
|
||||
if (weidianGetTitleResult == null)
|
||||
return result;
|
||||
Newtonsoft.Json.Linq.JArray jArr = new Newtonsoft.Json.Linq.JArray();
|
||||
Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
jArr = jObj["wareInfo"] as Newtonsoft.Json.Linq.JArray;
|
||||
if (jArr == null)
|
||||
return result;
|
||||
var resultx = new List<Tuple<string, int, int, double, string>>();
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
var str = item.ToString();
|
||||
var id = BaseRegex.GetStringJson(ref str, "wareId");
|
||||
if (id == null)
|
||||
continue;
|
||||
string name = BaseRegex.GetStringJson(ref str, "wname");
|
||||
double simu = BaseClass.GetSimularityBetween2Text(title, name);
|
||||
if (simu < 0.8)
|
||||
continue;
|
||||
//bool compare = CompareTitle(title, name);
|
||||
//if (!compare)
|
||||
// continue;
|
||||
int price = 0;
|
||||
var pricetemp = BaseRegex.GetDecimalJson(ref str, "jdPrice");
|
||||
price = (int)(pricetemp * 100);
|
||||
if (!string.IsNullOrEmpty(id) && price > 0)
|
||||
resultx.Add(new Tuple<string, int, int,double,string>("jx-" + id, price, price,simu, DateTime.Now.ToString("yyyy-MM-dd")));
|
||||
if (resultx.Count >= 10)
|
||||
break;
|
||||
}
|
||||
resultx = resultx.OrderByDescending(o => o.Item4).ToList();
|
||||
for (int i = 0; i < resultx.Count; i++)
|
||||
{
|
||||
var obj = resultx[i];
|
||||
result.Add(new Tuple<string, int, int, string>(obj.Item1, obj.Item2, obj.Item3, obj.Item5));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Tuple<string, int, int,string>> GetTuple1688ListData(string title,string weidianGetTitleResult)
|
||||
{
|
||||
var result = new List<Tuple<string, int, int,string>>();
|
||||
if (weidianGetTitleResult == null)
|
||||
return result;
|
||||
//if (weidianGetTitleResult.Contains("\\\"message\\\":\\\"OK\\\""))
|
||||
//{
|
||||
// Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
// weidianGetTitleResult = jObj["data"].ToString();
|
||||
//}
|
||||
Newtonsoft.Json.Linq.JArray jArr = new Newtonsoft.Json.Linq.JArray();
|
||||
//if (weidianGetTitleResult.Contains("\"message\":\"OK\""))
|
||||
//{
|
||||
// Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
// jArr = jObj["result"]["viewContainer"] as Newtonsoft.Json.Linq.JArray;
|
||||
//}
|
||||
if (weidianGetTitleResult.Contains("mtopjsonp17("))
|
||||
weidianGetTitleResult = BaseRegex.GetMatchRegexString(ref weidianGetTitleResult, @"mtopjsonp17\(({[\w\W]+?})\)");
|
||||
if (weidianGetTitleResult.Contains("\"data\":{"))
|
||||
{
|
||||
Newtonsoft.Json.Linq.JObject jObj = Newtonsoft.Json.Linq.JObject.Parse(weidianGetTitleResult);
|
||||
jArr = jObj["data"]?["offerList"] as Newtonsoft.Json.Linq.JArray;
|
||||
//var lst = jObj["data"]["resultList"].ToList();
|
||||
//var ss = JArray.Parse(jObj["data"]?["recommend"]?["resultList"]?.ToString())?.ToObject<List<Object>>();
|
||||
}
|
||||
if (jArr == null)
|
||||
return result;
|
||||
var resultx = new List<Tuple<string, int, int, double, string>>();
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
var str = item.ToString();
|
||||
var id = BaseRegex.GetStringJson(ref str, "infoId");
|
||||
string name = BaseRegex.GetStringJson(ref str, "simpleSubject");
|
||||
double simu = BaseClass.GetSimularityBetween2Text(title, name);
|
||||
if (simu < 0.5)
|
||||
continue;
|
||||
bool compare = CompareTitle(title, name);
|
||||
if (!compare)
|
||||
continue;
|
||||
int price = 0;
|
||||
var pricetemp = BaseRegex.GetDecimalJson(ref str, "price");
|
||||
price = (int)(pricetemp * 100);
|
||||
if (!string.IsNullOrEmpty(id) && price > 0)
|
||||
resultx.Add(new Tuple<string, int, int,double,string>("al-" + id, price, price,simu,DateTime.Now.ToString("yyyy-MM-dd")));
|
||||
if (resultx.Count >= 10)
|
||||
break;
|
||||
}
|
||||
resultx = resultx.OrderByDescending(o => o.Item4).ToList();
|
||||
for (int i = 0; i < resultx.Count; i++)
|
||||
{
|
||||
var obj = resultx[i];
|
||||
result.Add(new Tuple<string, int, int, string>(obj.Item1, obj.Item2, obj.Item3, obj.Item5));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool CompareTitle(string title,string name)
|
||||
{
|
||||
if ((name.Length < title.Length + 10) || name.Length <= 30)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,782 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Work.Api;
|
||||
|
||||
namespace Work.Business.ProductMappingBLL
|
||||
{
|
||||
|
||||
public class WeiDianCollectBLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 微店采集是否进行
|
||||
/// </summary>
|
||||
public static bool WdCollecting { get; set; } = false;
|
||||
|
||||
//伪装成百度蜘蛛访问
|
||||
private static string sUserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36";
|
||||
|
||||
/// <summary>
|
||||
/// 微店采集进行中
|
||||
/// </summary>
|
||||
internal static bool BWDCollecting;
|
||||
|
||||
/// <summary>
|
||||
/// 微店店铺ID
|
||||
/// </summary>
|
||||
private static long lWdShopId;
|
||||
|
||||
/// <summary>
|
||||
/// 同行店铺Ids
|
||||
/// </summary>
|
||||
private static List<string> lstColleagueShopId = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 采集区号
|
||||
/// </summary>
|
||||
private static int SectionNo;
|
||||
|
||||
/// <summary>
|
||||
/// 采集客户端的公网IP
|
||||
/// </summary>
|
||||
private static string PubIp;
|
||||
|
||||
/// <summary>
|
||||
/// 服务调用时间间隔基准(实际时间以此为基本随机上下浮动)
|
||||
/// </summary>
|
||||
private static int iTimeSpan;
|
||||
|
||||
private static readonly object _locker = new object();
|
||||
|
||||
public static void StartWeiDianCollect()
|
||||
{
|
||||
//读取服务端的采集设置 1-功能开关; 2-请求间隔(s)
|
||||
string sServerCfg = ArchiveWdCollectionConfigFromServer();
|
||||
if (string.IsNullOrEmpty(sServerCfg)) return;
|
||||
string[] sConfig = sServerCfg.Split(',');
|
||||
if (sConfig.Length != 2) return;
|
||||
if (sConfig[0].Equals("0")) return;
|
||||
iTimeSpan = int.Parse(sConfig[1]);
|
||||
|
||||
//获取公网IP
|
||||
PubIp = GetPublicIp();
|
||||
if (string.IsNullOrEmpty(PubIp)) return;
|
||||
|
||||
//根据公网IP去服务端取采集区号(1-20亿,分2000段,每段100万笔采集量)
|
||||
string sSecNoAndCollectCount = GetCollectSectionNoFromServer();
|
||||
if (string.IsNullOrEmpty(sSecNoAndCollectCount)) return;
|
||||
string[] sRes = sSecNoAndCollectCount.Split(',');
|
||||
SectionNo = int.Parse(sRes[0]);
|
||||
//如果此公网IP采集状态为1-采集中 2-限制或已经采集完毕,则返回
|
||||
if (SectionNo < 0)
|
||||
{
|
||||
//MessageBox.Show(PubIp + " 不可进行采集!");
|
||||
return;
|
||||
}
|
||||
if (sRes.Length != 2) return;
|
||||
WdCollecting = true;
|
||||
int iCollectedCount = int.Parse(sRes[1]);
|
||||
if (iCollectedCount >= 1000000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
iTimeSpanMin = iTimeSpan;
|
||||
iTimeSpanMax = iTimeSpan + 3;
|
||||
Thread thread = new Thread(AutoUpdateCollectInfo)
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
thread.Start();
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
Random random = new Random();
|
||||
string sWdRes = string.Empty;
|
||||
|
||||
//MessageBox.Show("已开启微店采集,将从" + (SectionNo * 1000000 + iCollectedCount + 1) + "开始");
|
||||
for (lWdShopId = SectionNo * 1000000 + iCollectedCount + 1; lWdShopId <= (SectionNo + 1) * 1000000 && WdCollecting; lWdShopId++)
|
||||
{
|
||||
int iRetryCnt = 0;
|
||||
MakeReq:
|
||||
Thread.Sleep(Randomx.GetId(iTimeSpanMin, iTimeSpanMax) * 100);
|
||||
sWdRes = MakeRequestWd4GetColleagueShops(lWdShopId);
|
||||
if (sWdRes.Length == 0)
|
||||
{
|
||||
//此IP被限制,更新服务端采集状态为2
|
||||
UpdateCollectStatusFromServer(2);
|
||||
WdCollecting = false;
|
||||
return;
|
||||
}
|
||||
if (!sWdRes.Contains("shopItems\""))
|
||||
{
|
||||
if (sWdRes.Contains("请稍后重试"))
|
||||
{
|
||||
sUserAgent = GetHtml.UserAgent.Split('\n')[new Random(Guid.NewGuid().GetHashCode()).Next(GetHtml.UserAgent.Split('\n').Length)].Trim();
|
||||
}
|
||||
iRetryCnt++;
|
||||
if (iRetryCnt > 10)
|
||||
{
|
||||
//此IP被限制,更新服务端采集状态为2
|
||||
UpdateCollectStatusFromServer(2);
|
||||
WdCollecting = false;
|
||||
return;
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(iTimeSpanMin, iTimeSpanMax) * 100);
|
||||
goto MakeReq;
|
||||
}
|
||||
if (!sWdRes.Contains("shopItems\":{\"items\":[{\""))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lock (_locker)
|
||||
{
|
||||
lstColleagueShopId.Add(lWdShopId.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
WdCollecting = false;
|
||||
UpdateCollectStatusFromServer(0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static int iTimeSpanMin;
|
||||
private static int iTimeSpanMax;
|
||||
private static void AutoUpdateCollectInfo()
|
||||
{
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (lstColleagueShopId.Count == 0 && !WdCollecting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (lWdShopId > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
UpdateColleagueShopIdsAndCollectCountFromServer();
|
||||
lock (_locker)
|
||||
{
|
||||
lstColleagueShopId.Clear();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(5, 10) * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新服务端的同行店铺Ids以及已采集数量
|
||||
/// </summary>
|
||||
private static void UpdateColleagueShopIdsAndCollectCountFromServer()
|
||||
{
|
||||
string requestData = "shopIds=" + GetHtml.UrlEncodeUtf8(string.Join(",", lstColleagueShopId)) + "&collect_ip=" + PubIp + "&collect_number=" + (lWdShopId - SectionNo * 1000000);
|
||||
string url = BaseClass.LoginApiUrl + "?obj=product/collect&act=add_collect_data";
|
||||
GoAheadSupportRetry(url, requestData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新服务端的同行店铺Ids以及已采集数量
|
||||
/// </summary>
|
||||
private static string ArchiveWdCollectionConfigFromServer()
|
||||
{
|
||||
string url = BaseClass.LoginApiUrl + "?obj=product/collect&act=get_collect_config";
|
||||
return GoAheadSupportRetry(url, "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定IP的采集状态
|
||||
/// </summary>
|
||||
/// <param name="sPubIp">公网IP</param>
|
||||
/// <param name="iStatus">采集状态</param>
|
||||
public static void UpdateCollectStatusFromServer(int iStatus)
|
||||
{
|
||||
//调用php后台更新指定IP的采集状态
|
||||
string requestData = "collect_ip=" + PubIp + "&collect_status=" + iStatus;
|
||||
string url = BaseClass.LoginApiUrl + "?obj=product/collect&act=update_collect";
|
||||
GoAheadSupportRetry(url, requestData);
|
||||
}
|
||||
|
||||
private static string GetCollectSectionNoFromServer()
|
||||
{
|
||||
//调用php后台获取指定IP的采集区号
|
||||
string requestData = "collect_ip=" + PubIp;
|
||||
string url = BaseClass.LoginApiUrl + "?obj=product/collect&act=get_collect_code";
|
||||
return GoAheadSupportRetry(url, requestData);
|
||||
}
|
||||
|
||||
private static string GoAheadSupportRetry(string sUrl, string sReqData, int iRetryMax = 3)
|
||||
{
|
||||
int iRetryCnt = 0;
|
||||
string result;
|
||||
GoAhead:
|
||||
result = GetHtml.PostUtf8(sUrl, sReqData);
|
||||
if (string.IsNullOrEmpty(result) && iRetryCnt < iRetryMax)
|
||||
{
|
||||
iRetryCnt++;
|
||||
Thread.Sleep(Randomx.GetId(50, 500));
|
||||
goto GoAhead;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取公网IP
|
||||
/// </summary>
|
||||
/// <returns>公网IP地址</returns>
|
||||
private static string GetPublicIp()
|
||||
{
|
||||
HttpWebResponse response;
|
||||
string sRes = string.Empty;
|
||||
if (Request_2000019_ip138_com(out response))
|
||||
{
|
||||
sRes = ReadResponse(response);
|
||||
if (sRes.Length > 0)
|
||||
{
|
||||
Match mh = Regex.Match(sRes, "您的IP地址是:([\\w\\W]+?)</title>");
|
||||
if (mh.Length > 0)
|
||||
{
|
||||
sRes = mh.Groups[1].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
sRes = string.Empty;
|
||||
}
|
||||
}
|
||||
response.Close();
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
|
||||
private 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool Request_2000019_ip138_com(out HttpWebResponse response)
|
||||
{
|
||||
response = null;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://2000019.ip138.com/");
|
||||
|
||||
request.KeepAlive = true;
|
||||
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
|
||||
request.UserAgent = sUserAgent;
|
||||
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
|
||||
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9,en;q=0.8");
|
||||
request.Headers.Set(HttpRequestHeader.Cookie, @"PHPSESSID=gouadr6cgch4h4st8pdi1gavp3; ASPSESSIONIDASBCSTBS=JOPDALEBHONGIBJHJPPJFPDJ");
|
||||
|
||||
response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status == WebExceptionStatus.ProtocolError) response = (HttpWebResponse)e.Response;
|
||||
else return false;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (response != null) response.Close();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string MakeRequestWd4GetColleagueShops(long lShopId)
|
||||
{
|
||||
HttpWebResponse response;
|
||||
var v = "";
|
||||
if (Request_weidian_com(lShopId, out response))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
|
||||
{
|
||||
v = sr.ReadToEnd();
|
||||
}
|
||||
response.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private static bool Request_weidian_com(long lShopId, out HttpWebResponse response)
|
||||
{
|
||||
response = null;
|
||||
MakeRequestWd:
|
||||
try
|
||||
{
|
||||
//获取店铺第1000+商品信息
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://thor.weidian.com/ares/shop.getItemsInShop/1.0?param={\"shopId\":\"" + lShopId + "\",\"page\":11,\"limit\":100}");
|
||||
request.KeepAlive = true;
|
||||
request.Timeout = 15000;
|
||||
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
|
||||
request.UserAgent = sUserAgent;
|
||||
request.Headers.Add("Sec-Fetch-User", @"?1");
|
||||
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
|
||||
request.Headers.Add("Sec-Fetch-Site", @"none");
|
||||
request.Headers.Add("Sec-Fetch-Mode", @"navigate");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "deflate, br");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9,en;q=0.8");
|
||||
//request.Headers.Set(HttpRequestHeader.Cookie, @"__spider__visitorid=99847ca38c8d6d84; vc_fpcookie=d09a621b-a4c6-d905-0177-9da2ce436be1; vc_device_id=d496a1adb4f8b88d65cb30de7264031a; login_token=_EwWqqVIQEOZk3K4Xlw_Jg9LlPshZBhdbAvfITT9_RjRD4NcDyFJyjJbYfnhizpflOAvHfG7PSMovzOj4ejBjwzfzrKMKMUcsDhgsUlZEVouSxvo1LW0VS9eKDZ828OLKQsajaJG78ddJmfGxxrUPHJEU84juJHaEPl_TuzFNJSLgN9_LqOI; is_login=true; login_type=LOGIN_USER_TYPE_MASTER; login_source=LOGIN_USER_SOURCE_MASTER; uid=316846450; sid=316846450; token=; isLogin=; loginUserType=; loginUserSource=; WD_b_wduss=; WD_s_wduss=; WD_b_id=; WD_s_id=; WD_b_country=; WD_b_tele=; WD_s_tele=; WD_seller=; vc_token_id=8903a2e4-00d2-220c-8967-a4acf4fbcce1-16f6563b2b8-3a46; WD_wfr=shop; unreadMsg=0; WD_guid=1577962261222_1977684674589264; v-components/cpn-coupon-dialog@iwdDefault=1; CartreferrerURl=shopid_212239496; __spider__sessionid=455f3f04f7aaf1bb; wdtoken=c511ac4f; is_follow_mp=0; cart_inner_item_count=0");
|
||||
|
||||
response = (HttpWebResponse)request.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Message.Contains("超时"))
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(1, 5) * 1000);
|
||||
goto MakeRequestWd;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Message.Contains("超时"))
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(1, 5) * 1000);
|
||||
goto MakeRequestWd;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Random random = new Random();
|
||||
public static string[] arrSignSvrWeidian;
|
||||
//private static string[] arrSignSvrWeidian = "26t606j345.zicp.vip:48932;2664638a6k.qicp.vip;2664638a6k.qicp.vip:12393".Split(';');
|
||||
|
||||
/// <summary>
|
||||
/// WeiDian Context集合
|
||||
/// </summary>
|
||||
private static string[] arrWeiDianContext = null;
|
||||
/// <summary>
|
||||
/// 微店app接口api版本
|
||||
/// </summary>
|
||||
private static List<string> thorVers = "2.4,2.6".Split(',').ToList();
|
||||
|
||||
/// <summary>
|
||||
/// 通过关键词(或标题)搜索微店商品
|
||||
/// </summary>
|
||||
/// <param name="sSearchKeyword">搜索关键词或标题</param>
|
||||
/// <param name="dPriceMin">价格最低价,不限制传0</param>
|
||||
/// <param name="dPriceMax">价格最高价,不限制传0</param>
|
||||
/// <param name="iPage">搜索页数,从1开始</param>
|
||||
/// <param name="bEncryptResponse">是否调用加密接口</param>
|
||||
/// <param name="bHookMode">是否通过hook方式</param>
|
||||
/// <returns></returns>
|
||||
public static string SearchWdProductsByKeywords(string sSearchKeyword, double dPriceMin = 0, double dPriceMax = 0, int iPage = 1, bool bEncryptResponse = false, bool bHookMode = false)
|
||||
{
|
||||
#region Random params Prevent being restricted
|
||||
long lTimeStampMilli = BaseClass.ConvertDateTimeLong();
|
||||
string sSign = Md5Base.GetMd5(lTimeStampMilli / 1000 + "nbytht");
|
||||
int index = random.Next(0, arrSignSvrWeidian.Length);
|
||||
string sSignSvrWeidian = arrSignSvrWeidian[index];
|
||||
//随机参数全部移至hook App端完成以节省传输带宽
|
||||
//string sAndroidId = BaseClass.GetRandomAlphanumeric(16).ToLower();
|
||||
//string sBrand = "Huawei,HONOR,Xiaomi,Meizu,samsung,Lenovo,zte,htc,nubia".Split(',')[random.Next(0, 9)];
|
||||
string sCuid = Guid.NewGuid().ToString().Replace("-", "");
|
||||
//string sImei = BaseClass.GetRandromNumeral(15);
|
||||
//经纬度随机
|
||||
//string sLat = (random.NextDouble() * (53.550000 - 3.860000) + 3.860000).ToString("f6");
|
||||
//string sLon = (random.NextDouble() * (135.050000 - 73.660000) + 73.660000).ToString("f6");
|
||||
//string sMac = BaseClass.RandomMacAddress().ToUpper();
|
||||
//string sWmac = BaseClass.RandomMacAddress().ToLower();
|
||||
string sFootprintId = sCuid + "_" + lTimeStampMilli;
|
||||
string sChoicePrices = string.Empty;
|
||||
if (dPriceMax > 0 || dPriceMin > 0)
|
||||
{
|
||||
sChoicePrices = (dPriceMin > 0 ? dPriceMin.ToString() : " ") + "-" + (dPriceMax > 0 ? dPriceMax.ToString() : " ");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 构造PostData原文并通过hook得到PostData密文
|
||||
//先从后台获取WdContext集合
|
||||
if (arrWeiDianContext == null)
|
||||
{
|
||||
arrWeiDianContext = GetWdContextService();
|
||||
}
|
||||
int iTryTimes = 0;
|
||||
LbHookPostData:
|
||||
index++;
|
||||
if (index > 2)
|
||||
index = 0;
|
||||
sSignSvrWeidian = arrSignSvrWeidian[index];
|
||||
string sContext = arrWeiDianContext[Randomx.GetId(arrWeiDianContext.Length)];
|
||||
string sParam = @"{""area"":"""",""brands"":[],""chosePoints"":"""",""chosePrices"":""" + sChoicePrices + @""",""coreWord"":"""",""footprintId"":""" + sFootprintId + @""",""id"":""" + sSearchKeyword + @""",""increServices"":[],""keyword"":""" + sSearchKeyword + @""",""limit"":16,""order"":""desc"",""page"":" + iPage + @",""remind"":1,""search_wfr"":""search_input"",""sortKey"":""price"",""source"":""1"",""tab"":""all"",""tags"":[],""wdServices"":[]}";
|
||||
string sPostData = @"v=2.0×tamp=" + lTimeStampMilli + @"&appkey=06475281&context=" + HttpHelper.UrlEncode(sContext) + "¶m=" + HttpHelper.UrlEncode(sParam);
|
||||
|
||||
//不走hook方式,走直调接口方式
|
||||
if (!bHookMode)
|
||||
{
|
||||
string platForm = new string[] { "ios", "android" }.ToList()[random.Next(2)];
|
||||
string thorVer = thorVers[random.Next(thorVers.Count)];
|
||||
string userAgent = $"{platForm.ToUpper()}/{random.Next(5, 8)}.{random.Next(0, 3)}.{random.Next(5)} WDAPP(WDBuyer/{random.Next(5, 8)}.{random.Next(0, 3)}.{random.Next(5)}) Thor/{thorVer}.6.6";
|
||||
return HttpHelper.Post(new AllBase.Helper.HttpParam() { Url = $"http://thor.weidian.com/faith/search.item/{thorVer}", Method = "POST", PostData = sPostData, Referer = $"https://{platForm}.weidian.com", UserAgent = userAgent });
|
||||
}
|
||||
|
||||
//走hook方式
|
||||
AllBase.Helper.HttpParam httpParamRequest = new AllBase.Helper.HttpParam
|
||||
{
|
||||
Url = $"http://{sSignSvrWeidian}/sign/do.json?action=request&nb_timestamp={lTimeStampMilli / 1000}&nb_sign={sSign}&mode=0",
|
||||
PostData = sPostData,
|
||||
Timeout = 10,
|
||||
ContentType = "application/x-www-form-urlencoded; charset=utf-8"
|
||||
};
|
||||
string requestResult = string.Empty;
|
||||
try
|
||||
{
|
||||
Thread.Sleep(random.Next(1, 3) * 1000);
|
||||
requestResult = HttpHelper.Post(httpParamRequest);
|
||||
if (string.IsNullOrEmpty(requestResult) )
|
||||
{
|
||||
if (ProductMapping.ischeck)
|
||||
UploadPinduoduoMain.CheckSearch = false;
|
||||
LogSave.Add("标题搜索sign为空"+ sSignSvrWeidian);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogSave.Add("微店标题搜索接口请求异常:" + ex.Message);
|
||||
}
|
||||
|
||||
if (!requestResult.Contains("data") && iTryTimes < 1)
|
||||
{
|
||||
Thread.Sleep(random.Next(2, 3) * 1000);
|
||||
iTryTimes++;
|
||||
goto LbHookPostData;
|
||||
}
|
||||
if (!requestResult.Contains("data")) return "";
|
||||
#endregion
|
||||
|
||||
#region 发送PostData密文去请求微店接口 可得到ResponseData明文,也可得到ResponseData密文
|
||||
AllBase.Helper.HttpParam httpParamWeiDian = new AllBase.Helper.HttpParam
|
||||
{
|
||||
Url = "http://thor.weidian.com/faith/search.item/2.4",
|
||||
UserAgent = "Android/6.0.1 WDAPP(WDBuyer/6.0.3) Thor/2.3.6.3",
|
||||
Timeout = 6,
|
||||
Referer = "https://android.weidian.com",
|
||||
ContentType = "application/x-www-form-urlencoded; charset=utf-8",
|
||||
Header = new Dictionary<string, string>()
|
||||
};
|
||||
httpParamWeiDian.Header.Add("accept-encoding", bEncryptResponse ? "GLZip" : "Deflate");
|
||||
httpParamWeiDian.Header.Add("x-origin", "thor");
|
||||
httpParamWeiDian.Header.Add("x-schema", "https");
|
||||
httpParamWeiDian.Header.Add("x-encrypt", bEncryptResponse ? "1" : "0");
|
||||
httpParamWeiDian.Header.Add("origin", "android.weidian.com");
|
||||
httpParamWeiDian.PostData = HtmlHelper.Resove(requestResult, "\"data\":\"", "\"");
|
||||
if (!bEncryptResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.Sleep(random.Next(1, 6) * 1000);
|
||||
requestResult = HttpHelper.Post(httpParamWeiDian);
|
||||
if (string.IsNullOrEmpty(requestResult))
|
||||
{
|
||||
if (ProductMapping.ischeck)
|
||||
UploadPinduoduoMain.CheckSearch = false;
|
||||
LogSave.Add("标题搜索返回数据为空");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ProductMapping.ischeck)
|
||||
UploadPinduoduoMain.CheckSearch = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogSave.Add("微店标题搜索接口请求异常:" + ex.Message);
|
||||
return "";
|
||||
}
|
||||
return requestResult;
|
||||
}
|
||||
|
||||
var result = PostByte(httpParamWeiDian);
|
||||
#endregion
|
||||
|
||||
#region 将ResponseData密文通过hook得到ResponseData原文
|
||||
string base64 = Convert.ToBase64String(result);
|
||||
AllBase.Helper.HttpParam httpParamResponse = new AllBase.Helper.HttpParam
|
||||
{
|
||||
Url = $"http://{sSignSvrWeidian}/sign/do.json?action=response&nb_timestamp={lTimeStampMilli / 1000}&nb_sign={sSign}",
|
||||
PostData = "data=" + HttpHelper.UrlEncode(base64),
|
||||
ContentType = "application/x-www-form-urlencoded; charset=utf-8"
|
||||
};
|
||||
try
|
||||
{
|
||||
Thread.Sleep(random.Next(1, 3) * 1000);
|
||||
requestResult = HttpHelper.Post(httpParamResponse);
|
||||
if (string.IsNullOrEmpty(requestResult))
|
||||
LogSave.Add("标题搜索返回数据为空");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogSave.Add("微店标题搜索接口请求异常:" + ex.Message);
|
||||
return "";
|
||||
}
|
||||
return requestResult;
|
||||
#endregion
|
||||
|
||||
//微店不加密接口已失效
|
||||
//return HttpHelper.PostUtf8(new HttpParam() { Url = "http://thor.weidian.com/faith/search.item/2.6", Method = "POST", PostData = sPostData, Referer = "https://android.weidian.com", UserAgent = "Android/6.0.1 WDAPP(WDBuyer/6.0.6) Thor/2.3.6.6"});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取WeiDian Context集合
|
||||
/// </summary>
|
||||
private static string[] GetWdContextService()
|
||||
{
|
||||
string url = BaseClass.LoginApiUrl + "/?obj=api/config&act=wd_context_v2";
|
||||
string res = GetHtml.PostUtf8(url, UserLogin.GetSignaturex());
|
||||
if (!string.IsNullOrEmpty(res))
|
||||
{
|
||||
return res.Split(';');
|
||||
}
|
||||
else //默认值
|
||||
{
|
||||
return "{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQEyZKqM2PZUQcHsBRwE4X41-sxHF1SqJBMKW2-Ep2_ZxzVdoS3mvrvYTCcedcJUxCdAZgIkypkz3F811inqWCXWSaHf0yZytHxQQPF0aHUeF769XwaWw9YTrae-VxRE3RW69O6yqFWrj5qamlgfD3SpACdiOJvjxUfdXWKNPP75I\",\"duid\":\"1315506113\",\"uss\":\"_EwWqqVIQEyZKqM2PZUQcHsBRwE4X41-sxHF1SqJBMKW2-Ep2_ZxzVdoS3mvrvYTCcedcJUxCdAZgIkypkz3F811inqWCXWSaHf0yZytHxQQPF0aHUeF769XwaWw9YTrae-VxRE3RW69O6yqFWrj5qamlgfD3SpACdiOJvjxUfdXWKNPP75I\",\"anonymousId\":\"0b40d738ec8016f5ef0e833bf66b8aa87099dfb6\",\"userID\":\"1315506113\",\"wduserID\":\"1315506113\",\"wxappid\":\"wx4b74228baa15489a\"};{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQImnSvEqukYADvVMSBDbMsIttEmXS8YwnHdmlBEG8kLxGxWInk0EXrYqljlRQ5lp2uJUhT0NPcSWsHqVVElpJmXUqiopvGs2HmBWjtr678V0yprAkS9OP3pVsdutyQgzbmYIUhl6PFs7VUEeFM0pNqHBYf_G7TYDljpjFRRG_Cbc\",\"duid\":\"1613253916\",\"uss\":\"_EwWqqVIQImnSvEqukYADvVMSBDbMsIttEmXS8YwnHdmlBEG8kLxGxWInk0EXrYqljlRQ5lp2uJUhT0NPcSWsHqVVElpJmXUqiopvGs2HmBWjtr678V0yprAkS9OP3pVsdutyQgzbmYIUhl6PFs7VUEeFM0pNqHBYf_G7TYDljpjFRRG_Cbc\",\"anonymousId\":\"1b28adc9e6113131422488e3a97f7d0f6df2c833\",\"userID\":\"1613253916\",\"wduserID\":\"1823050762\",\"wxappid\":\"wx4b74228baa15489a\"};{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQa4fD09LpoVv8vECPm18ebpjpxNzDXTBQV2dzCBTLwDU6B8KhNZFIsNJg2Mi5AZxMWSnQkfQvLaPodjEYfXVnXjwBIjKff_iD4TiuEQF6gObB1Dx12jkBLQ2Ztfuz_Wys_n9m0_gDsBfb_QLJp8f9jd8pbx_-6oxm4kMQkq9vaxs\",\"duid\":\"1590515991\",\"uss\":\"_EwWqqVIQa4fD09LpoVv8vECPm18ebpjpxNzDXTBQV2dzCBTLwDU6B8KhNZFIsNJg2Mi5AZxMWSnQkfQvLaPodjEYfXVnXjwBIjKff_iD4TiuEQF6gObB1Dx12jkBLQ2Ztfuz_Wys_n9m0_gDsBfb_QLJp8f9jd8pbx_-6oxm4kMQkq9vaxs\",\"anonymousId\":\"fe0168956c78bc160aa51cadeab4fbf0e841b88a\",\"userID\":\"1590515991\",\"wduserID\":\"1720909970\",\"wxappid\":\"wx4b74228baa15489a\"};{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQWKgZwEXoPyaPyTxVrRnpBvbA4ub2vlaYOIf3sQutH5kaxt5C-eV-srUxI-hDSV5WjqoZc_hAIy7v6KAWaCr1r0SGB91ysDkKLNdqNao-aP9j0P4IZ4m7kBrc4vr0TCOVUi8L_JpEZ32v-HH6ONT6oHd--aAfOqF6JmJAR3J-OZI\",\"duid\":\"1458041550\",\"uss\":\"_EwWqqVIQWKgZwEXoPyaPyTxVrRnpBvbA4ub2vlaYOIf3sQutH5kaxt5C-eV-srUxI-hDSV5WjqoZc_hAIy7v6KAWaCr1r0SGB91ysDkKLNdqNao-aP9j0P4IZ4m7kBrc4vr0TCOVUi8L_JpEZ32v-HH6ONT6oHd--aAfOqF6JmJAR3J-OZI\",\"anonymousId\":\"9740e2814bdda65f15fe00b6baaa20516a6b9ebb\",\"userID\":\"1458041550\",\"wduserID\":\"1775289160\",\"wxappid\":\"wx4b74228baa15489a\"};{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQAbBHv33Hb8h4BTk6D3xDuZ2xb3M_3Qx9BwNiUgBZD5YU_sN-Z5WxWqifRhJpnIBo02A4a0Gd9BhKGlQXVHrjhlqIzWU3t7gOvfAtTkF6zY7lV_hULG3jZ-XxkgmV8m9jKYQMdGw8jw_XqRvUuHZeTW3o1ZifXyPwEp0w1DIYBjo\",\"duid\":\"1457886926\",\"uss\":\"_EwWqqVIQAbBHv33Hb8h4BTk6D3xDuZ2xb3M_3Qx9BwNiUgBZD5YU_sN-Z5WxWqifRhJpnIBo02A4a0Gd9BhKGlQXVHrjhlqIzWU3t7gOvfAtTkF6zY7lV_hULG3jZ-XxkgmV8m9jKYQMdGw8jw_XqRvUuHZeTW3o1ZifXyPwEp0w1DIYBjo\",\"anonymousId\":\"c946abdbbf6d2b176c5dafc115ccfa4407cc9b96\",\"userID\":\"1457886926\",\"wduserID\":\"1728949064\",\"wxappid\":\"wx4b74228baa15489a\"};{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQW0SLhMjMF--dXY8z4sLNA3i5yMCTOiAPdb8FGVrzqA_AxJ5aE-DtSbMhMEDgz2Pp59KBt26jK9WkaJPGfGtc8kRu8s40RdEhBk2i4rIKIPBAXSl6-jS-4NH0PZe00q3ppBYuvjfFfoeZeBfCdiA4K4G5G4NvExeEm1RXBLeGz8c\",\"duid\":\"1457941037\",\"uss\":\"_EwWqqVIQW0SLhMjMF--dXY8z4sLNA3i5yMCTOiAPdb8FGVrzqA_AxJ5aE-DtSbMhMEDgz2Pp59KBt26jK9WkaJPGfGtc8kRu8s40RdEhBk2i4rIKIPBAXSl6-jS-4NH0PZe00q3ppBYuvjfFfoeZeBfCdiA4K4G5G4NvExeEm1RXBLeGz8c\",\"anonymousId\":\"ef346e978e0e576758509467fadbc4d7a8c3c7d0\",\"userID\":\"1457941037\",\"wduserID\":\"1746010952\",\"wxappid\":\"wx4b74228baa15489a\"};{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQfrm41rMjm-1cmkdyFH2WD0Rd8omOQkZMWyMXqTTIzXPGF_kh1kdAGULBIQn6IM_82tKHzxCpzQvpTpVpNPBY5xBrrc04ZmKq4lgi3f-hs16Nlay9KHB5x4AmHES3zNHL2NrHODzriqgnQrMN-tp1m0k-aU4SzIjjrIrWhvvKx48\",\"duid\":\"1457948637\",\"uss\":\"_EwWqqVIQfrm41rMjm-1cmkdyFH2WD0Rd8omOQkZMWyMXqTTIzXPGF_kh1kdAGULBIQn6IM_82tKHzxCpzQvpTpVpNPBY5xBrrc04ZmKq4lgi3f-hs16Nlay9KHB5x4AmHES3zNHL2NrHODzriqgnQrMN-tp1m0k-aU4SzIjjrIrWhvvKx48\",\"anonymousId\":\"d5e95317c5e65351a64b4cffd9af0d51b60f7102\",\"userID\":\"1457948637\",\"wduserID\":\"1716544328\",\"wxappid\":\"wx4b74228baa15489a\"};{\"appid\":\"wxbuyer\",\"platform\":\"windows\",\"token\":\"_EwWqqVIQIx4ntFzDm50GX5WS1aWQuasH1x-Epv5HAlG60iSG6OdlnxQ_FspOnIq4FFQXgCtMoOCDzuTPFLZ3l0oLQ2ewticmOLLd90KgCkt0cUNELEen2nrrT06kmvij2yjFAWGiHqZRp2aGXAVm_OTW40ktzSFEShdjZIvgM02mS00ZDlI\",\"duid\":\"1613513032\",\"uss\":\"_EwWqqVIQIx4ntFzDm50GX5WS1aWQuasH1x-Epv5HAlG60iSG6OdlnxQ_FspOnIq4FFQXgCtMoOCDzuTPFLZ3l0oLQ2ewticmOLLd90KgCkt0cUNELEen2nrrT06kmvij2yjFAWGiHqZRp2aGXAVm_OTW40ktzSFEShdjZIvgM02mS00ZDlI\",\"anonymousId\":\"f0cd1119c8cf0cecce0fa6af90531a7ffc258e6f\",\"userID\":\"1613513032\",\"wduserID\":\"1794619402\",\"wxappid\":\"wx4b74228baa15489a\"}".Split(';'); ;
|
||||
}
|
||||
}
|
||||
|
||||
private static string userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36";
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定微店商品标题_商品网页获取模式(目前暂未遇到采集限制,故无法确切做限制过滤)
|
||||
/// </summary>
|
||||
/// <param name="itemId">微店商品id</param>
|
||||
/// <param name="iMaxTryTimes">最大重试次数</param>
|
||||
/// <returns>商品标题(为空则表示商品不存在)</returns>
|
||||
public static string GetProductTitleByHtml(string itemId, int iMaxTryTimes = 1)
|
||||
{
|
||||
int iTryTimes = 0;
|
||||
while(iTryTimes++ < iMaxTryTimes)
|
||||
{
|
||||
string wdToken = BaseClass.GetRandomAlphanumeric(8).ToLower(); //随机参数 wdtoken=f1565ee9
|
||||
AllBase.Helper.HttpParam httpParam = new AllBase.Helper.HttpParam
|
||||
{
|
||||
Url = $"https://weidian.com/item.html?itemID={itemId}",
|
||||
Referer = $"https://weidian.com/item.html?itemID={itemId}&spider_token={BaseClass.GetRandomAlphanumeric(4).ToLower()}",
|
||||
UserAgent = GetProxyHtml.UserAgentList?.Count > 0
|
||||
? GetProxyHtml.UserAgentList[Randomx.GetId(GetProxyHtml.UserAgentList.Count)]
|
||||
: userAgent,
|
||||
Timeout = 10,
|
||||
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
||||
Cookie = $"wdtoken={wdToken}; __spider__visitorid={BaseClass.GetRandomAlphanumeric(16).ToLower()}; visitor_id={BaseClass.GetRandomAlphanumeric(8).ToLower()}-{BaseClass.GetRandomAlphanumeric(4).ToLower()}-{BaseClass.GetRandomAlphanumeric(4).ToLower()}-{BaseClass.GetRandomAlphanumeric(4).ToLower()}-{BaseClass.GetRandomAlphanumeric(12).ToLower()}"
|
||||
};
|
||||
string res = HttpHelper.Get(httpParam);
|
||||
string itemTitle = BaseRegex.GetMatchMaxRegexString(ref res, "<span[\\s]*class=\"item-name\">([\\w\\W]+?)</span>");
|
||||
if(!string.IsNullOrEmpty(itemTitle))
|
||||
{
|
||||
return itemTitle;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定微店商品标题_商品Api获取模式(目前暂未遇到采集限制,故无法确切做限制过滤)
|
||||
/// </summary>
|
||||
/// <param name="itemId">微店商品id</param>
|
||||
/// <returns>商品详情数据</returns>
|
||||
public static string GetProductDetailByApi(string itemId)
|
||||
{
|
||||
string wdToken = BaseClass.GetRandomAlphanumeric(8).ToLower(); //随机参数 wdtoken=f1565ee9
|
||||
AllBase.Helper.HttpParam httpParam = new AllBase.Helper.HttpParam
|
||||
{
|
||||
Url = $"https://thor.weidian.com/detail/getItemSkuInfo/1.0?param=%7B%22itemId%22%3A%22{itemId}%22%7D&wdtoken={wdToken}&_={BaseClass.ConvertDateTimeLong()}",
|
||||
Referer = $"https://weidian.com/item.html?itemID={itemId}&spider_token=9d2e",
|
||||
UserAgent = GetProxyHtml.UserAgentList?.Count > 0
|
||||
? GetProxyHtml.UserAgentList[Randomx.GetId(GetProxyHtml.UserAgentList.Count)]
|
||||
: userAgent,
|
||||
Timeout = 10,
|
||||
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
||||
Cookie = $"wdtoken={wdToken}; __spider__visitorid={BaseClass.GetRandomAlphanumeric(16).ToLower()}; visitor_id={BaseClass.GetRandomAlphanumeric(8).ToLower()}-{BaseClass.GetRandomAlphanumeric(4).ToLower()}-{BaseClass.GetRandomAlphanumeric(4).ToLower()}-{BaseClass.GetRandomAlphanumeric(4).ToLower()}-{BaseClass.GetRandomAlphanumeric(12).ToLower()}"
|
||||
};
|
||||
return HttpHelper.Get(httpParam);
|
||||
}
|
||||
|
||||
public static byte[] PostByte(AllBase.Helper.HttpParam httpParam, bool throwException = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty(httpParam.Url))
|
||||
{
|
||||
return default(byte[]);
|
||||
}
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = GetHttpWebRequest(httpParam);
|
||||
request.Method = "Post";
|
||||
SetPostData(request, httpParam.PostData);
|
||||
return ReadResponseByte(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
if (!ex.Message.Contains("404"))
|
||||
{
|
||||
LogHelper.WriteWithTime(ex);
|
||||
if (httpParam.TryTimes > 0 && httpParam.ActualTryTimes < httpParam.TryTimes)
|
||||
{
|
||||
httpParam.ActualTryTimes++;
|
||||
PostByte(httpParam, throwException);
|
||||
}
|
||||
if (throwException)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
return default(byte[]);
|
||||
}
|
||||
|
||||
public static void SetPostData(HttpWebRequest request, string postData)
|
||||
{
|
||||
request.ServicePoint.Expect100Continue = false;
|
||||
byte[] postDataByte = Encoding.UTF8.GetBytes(postData);
|
||||
request.ContentLength = postDataByte.Length;
|
||||
request.AllowAutoRedirect = false;
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
{
|
||||
requestStream.Write(postDataByte, 0, postDataByte.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] ReadResponseByte(HttpWebRequest request)
|
||||
{
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(response.GetResponseStream()))
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
byte[] buffer = binaryReader.ReadBytes(1024);
|
||||
while (buffer.Length > 0)
|
||||
{
|
||||
ms.Write(buffer, 0, buffer.Length);
|
||||
buffer = binaryReader.ReadBytes(1024);
|
||||
}
|
||||
byte[] fileByte = new byte[ms.Length];
|
||||
ms.Position = 0;
|
||||
ms.Read(fileByte, 0, fileByte.Length);
|
||||
return fileByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static HttpWebRequest GetHttpWebRequest(AllBase.Helper.HttpParam param)
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(param.Url);
|
||||
if (param.Proxy != null)
|
||||
{
|
||||
request.Proxy = param.Proxy;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Proxy = NaiBaGlobalConfig.GetDevelopProxy();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(param.UserAgent))
|
||||
{
|
||||
request.UserAgent = param.UserAgent;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.UserAgent = "";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(param.Accept))
|
||||
{
|
||||
request.Accept = param.Accept;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
|
||||
}
|
||||
if (string.IsNullOrEmpty(param.AcceptLanguage))
|
||||
{
|
||||
request.Headers.Add("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8");
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Headers.Add("Accept-Language", param.AcceptLanguage);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(param.ContentType))
|
||||
{
|
||||
request.ContentType = param.ContentType;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(param.Referer))
|
||||
{
|
||||
request.Referer = param.Referer;
|
||||
}
|
||||
request.Headers.Remove("Cookie");
|
||||
if (!string.IsNullOrEmpty(param.Cookie))
|
||||
{
|
||||
request.Headers.Add("Cookie", param.Cookie);
|
||||
}
|
||||
if (param.Header != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> header in param.Header)
|
||||
{
|
||||
request.Headers.Add(header.Key, header.Value);
|
||||
}
|
||||
}
|
||||
if (param.Timeout > 0)
|
||||
{
|
||||
request.Timeout = param.Timeout * 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Timeout = 60 * 1000;
|
||||
}
|
||||
return request;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
using AllBase.Helper;
|
||||
using NaiBa.Util;
|
||||
using NaiBa.Util.Extension;
|
||||
using NaiBa.Util.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -28,6 +27,7 @@ namespace Work.CollectClass
|
||||
*/
|
||||
public class JingXiCollect
|
||||
{
|
||||
public static bool IsProxyOverdue = false;
|
||||
/// <summary>
|
||||
/// 已经下架的商品集合
|
||||
/// </summary>
|
||||
|
||||
@@ -26,12 +26,18 @@ namespace Work.CollectClass
|
||||
public static List<KeyValueBase> Mobiles = new List<KeyValueBase>();
|
||||
public string Name, TempHtml = "";
|
||||
public bool NoAdd = false, Cloud = false, OnSale = true;
|
||||
public bool IsOnSale { get { return OnSale; } set { OnSale = value; } }
|
||||
public int MainCatId = 0;
|
||||
public string message = "";
|
||||
public static Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
public static List<PinDuoDuoTokenInfo> PinDuoDuoTokenList = new List<PinDuoDuoTokenInfo>();
|
||||
public static bool isProxyAvailable = true;
|
||||
/// <summary>
|
||||
/// 是否用资源包
|
||||
/// </summary>
|
||||
public bool IsResourcePack = false;
|
||||
public bool IsUseProxy = true;
|
||||
public bool IsUseProxyIP { get { return IsUseProxy; } set { IsUseProxy = value; } }
|
||||
public static string proxymessage = "";
|
||||
public bool isUseCache = true;
|
||||
private static int count = 0;
|
||||
@@ -39,6 +45,23 @@ namespace Work.CollectClass
|
||||
public bool isSearchUp = false;
|
||||
public bool IsNoToken = false;
|
||||
public bool IsAdvance = false;
|
||||
/// <summary>
|
||||
/// 是否预售(小奶牛)
|
||||
/// </summary>
|
||||
public bool IsPresale { get { return IsAdvance; } set { IsAdvance = value; } }
|
||||
/// <summary>
|
||||
/// 是否售罄
|
||||
/// </summary>
|
||||
public bool IsSaleOut = false;
|
||||
/// <summary>
|
||||
/// 商品是否不存在
|
||||
/// </summary>
|
||||
public bool IsNotExist = false;
|
||||
public bool IsProxyOverdue = false;
|
||||
/// <summary>
|
||||
/// 通过代理获取商品是否失败
|
||||
/// </summary>
|
||||
public bool IsUseProxyIPGetProductFailure = false;
|
||||
private static Dictionary<string, bool> DicApiUid = new Dictionary<string, bool>();
|
||||
public PinduoduoProductCollect(string name, TaobaoProductBase product)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user