云库数据上传
This commit is contained in:
1 parent
cd82a1ec15
commit
dc977c45d8
12 files changed
+274
-95
No files matched your search
@@ -86,6 +86,7 @@ namespace AllBase.Model.Result
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int product_get_type { get; set; }
|
public int product_get_type { get; set; }
|
||||||
public string product_get_type_text { get; set; }
|
public string product_get_type_text { get; set; }
|
||||||
|
public string db_type { get; set; }
|
||||||
public string head_words { get; set; }
|
public string head_words { get; set; }
|
||||||
public string end_words { get; set; }
|
public string end_words { get; set; }
|
||||||
public string fission_words { get; set; }
|
public string fission_words { get; set; }
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace AllBase.Model.Result
|
|||||||
public KJDDBProduct kjdDbProduct { get; set; } = null;
|
public KJDDBProduct kjdDbProduct { get; set; } = null;
|
||||||
public WXUploadProductParam wxDraftProduct { get; set; } = null;
|
public WXUploadProductParam wxDraftProduct { get; set; } = null;
|
||||||
public string product_get_type_text { get; set; }
|
public string product_get_type_text { get; set; }
|
||||||
|
public string db_type { get; set; } = "基础数据";
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using AllBase.Model.Result.PDDResult;
|
using AllBase.Model.Result.PDDResult;
|
||||||
|
using NaiBa.Util.Extension;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -38,5 +39,26 @@ namespace TemuKJD.BLL.ImportConverts
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static PDDFrontProductInfo5 SetContentConvert(string content)
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (IGoodsConverter item in _converters)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
item.SetContent(content.ParseToString());
|
||||||
|
if (item.IsMatch())
|
||||||
|
{
|
||||||
|
return item.Convert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -31,16 +31,21 @@ namespace TemuKJD.BLL.ImportConverters
|
|||||||
/// 支持的平台类型
|
/// 支持的平台类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PlatformType Platform { get; }
|
PlatformType Platform { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取内容
|
/// 读取内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filePath"></param>
|
/// <param name="filePath"></param>
|
||||||
void ReadContent(string filePath);
|
void ReadContent(string filePath);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 判断是否匹配当前转换器
|
/// 直接赋值内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>是否匹配</returns>
|
/// <param name="filePath"></param>
|
||||||
bool IsMatch();
|
void SetContent(string content);
|
||||||
|
/// <summary>
|
||||||
|
/// 判断是否匹配当前转换器
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>是否匹配</returns>
|
||||||
|
bool IsMatch();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 转换为标准商品模型
|
/// 转换为标准商品模型
|
||||||
@@ -56,11 +61,15 @@ namespace TemuKJD.BLL.ImportConverters
|
|||||||
public abstract string ConverterName { get; }
|
public abstract string ConverterName { get; }
|
||||||
public abstract PlatformType Platform { get; }
|
public abstract PlatformType Platform { get; }
|
||||||
|
|
||||||
void IGoodsConverter.ReadContent(string filePath)
|
void IGoodsConverter.ReadContent(string filePath)
|
||||||
{
|
{
|
||||||
ReadContent(filePath);
|
ReadContent(filePath);
|
||||||
}
|
}
|
||||||
protected virtual void ReadContent(string filePath)
|
void IGoodsConverter.SetContent(string content)
|
||||||
|
{
|
||||||
|
SetContent(content);
|
||||||
|
}
|
||||||
|
protected virtual void ReadContent(string filePath)
|
||||||
{
|
{
|
||||||
if (File.Exists(filePath) == false) throw new Exception("文件不存在");
|
if (File.Exists(filePath) == false) throw new Exception("文件不存在");
|
||||||
FilePath = filePath;
|
FilePath = filePath;
|
||||||
@@ -69,9 +78,12 @@ namespace TemuKJD.BLL.ImportConverters
|
|||||||
RawData = sr.ReadToEnd();
|
RawData = sr.ReadToEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected virtual void SetContent(string content)
|
||||||
|
{
|
||||||
|
RawData = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool IsMatch()
|
||||||
public virtual bool IsMatch()
|
|
||||||
{
|
{
|
||||||
_isMatch = true;
|
_isMatch = true;
|
||||||
return IsMatchProvider();
|
return IsMatchProvider();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TemuKJD.BLL.ImportConverts;
|
using TemuKJD.BLL.ImportConverts;
|
||||||
@@ -24,7 +25,7 @@ namespace TemuKJD.BLL
|
|||||||
/// <param name="UpdateOldData"></param>
|
/// <param name="UpdateOldData"></param>
|
||||||
/// <param name="specialProdType"></param>
|
/// <param name="specialProdType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string PddFrontToPddBackConvert(string outProdJson, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false)
|
public string PddFrontToPddBackConvert(string outProdJson, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false, bool isSaveDb = true)
|
||||||
{
|
{
|
||||||
PDDFrontProductInfo frontProdInfo = null;
|
PDDFrontProductInfo frontProdInfo = null;
|
||||||
try
|
try
|
||||||
@@ -328,8 +329,12 @@ namespace TemuKJD.BLL
|
|||||||
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
||||||
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
||||||
|
|
||||||
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
if (!isSaveDb)
|
||||||
string collectAuthorityTag = "";
|
return "success" + dbProd.product_json;
|
||||||
|
|
||||||
|
|
||||||
|
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
||||||
|
string collectAuthorityTag = "";
|
||||||
if (IsCollectAuthorityUser)
|
if (IsCollectAuthorityUser)
|
||||||
collectAuthorityTag = "-" + BaseClass.UserName;
|
collectAuthorityTag = "-" + BaseClass.UserName;
|
||||||
|
|
||||||
@@ -406,7 +411,7 @@ namespace TemuKJD.BLL
|
|||||||
/// <param name="UpdateOldData"></param>
|
/// <param name="UpdateOldData"></param>
|
||||||
/// <param name="specialProdType"></param>
|
/// <param name="specialProdType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string PddFrontToPddBackConvert2(string outProdJson, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false)
|
public string PddFrontToPddBackConvert2(string outProdJson, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false, bool isSaveDb = true)
|
||||||
{
|
{
|
||||||
PDDFrontProductInfo2 frontProdInfo = null;
|
PDDFrontProductInfo2 frontProdInfo = null;
|
||||||
try
|
try
|
||||||
@@ -800,8 +805,11 @@ namespace TemuKJD.BLL
|
|||||||
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
||||||
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
||||||
|
|
||||||
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
if (!isSaveDb)
|
||||||
string collectAuthorityTag = "";
|
return "success" + dbProd.product_json;
|
||||||
|
|
||||||
|
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
||||||
|
string collectAuthorityTag = "";
|
||||||
if (IsCollectAuthorityUser)
|
if (IsCollectAuthorityUser)
|
||||||
collectAuthorityTag = "-" + BaseClass.UserName;
|
collectAuthorityTag = "-" + BaseClass.UserName;
|
||||||
|
|
||||||
@@ -880,7 +888,7 @@ namespace TemuKJD.BLL
|
|||||||
/// <param name="specialProdType"></param>
|
/// <param name="specialProdType"></param>
|
||||||
/// <param name="IsCollectAuthorityUser"></param>
|
/// <param name="IsCollectAuthorityUser"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string PddFrontToPddBackConvert3(string outProdJson3, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false)
|
public string PddFrontToPddBackConvert3(string outProdJson3, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false, bool isSaveDb = true)
|
||||||
{
|
{
|
||||||
initDataObjInfo frontProdInfo = null;
|
initDataObjInfo frontProdInfo = null;
|
||||||
try
|
try
|
||||||
@@ -1201,8 +1209,11 @@ namespace TemuKJD.BLL
|
|||||||
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
||||||
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
||||||
|
|
||||||
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
if (!isSaveDb)
|
||||||
string collectAuthorityTag = "";
|
return "success" + dbProd.product_json;
|
||||||
|
|
||||||
|
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
||||||
|
string collectAuthorityTag = "";
|
||||||
if (IsCollectAuthorityUser)
|
if (IsCollectAuthorityUser)
|
||||||
collectAuthorityTag = "-" + BaseClass.UserName;
|
collectAuthorityTag = "-" + BaseClass.UserName;
|
||||||
|
|
||||||
@@ -1282,7 +1293,7 @@ namespace TemuKJD.BLL
|
|||||||
/// <param name="specialProdType"></param>
|
/// <param name="specialProdType"></param>
|
||||||
/// <param name="IsCollectAuthorityUser"></param>
|
/// <param name="IsCollectAuthorityUser"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string PddFrontToPddBackConvertV4(string outProdJson, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false)
|
public string PddFrontToPddBackConvertV4(string outProdJson, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false, bool isSaveDb = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -1603,8 +1614,11 @@ namespace TemuKJD.BLL
|
|||||||
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
||||||
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
||||||
|
|
||||||
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
if (!isSaveDb)
|
||||||
string collectAuthorityTag = "";
|
return "success" + dbProd.product_json;
|
||||||
|
|
||||||
|
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
||||||
|
string collectAuthorityTag = "";
|
||||||
if (IsCollectAuthorityUser)
|
if (IsCollectAuthorityUser)
|
||||||
collectAuthorityTag = "-" + BaseClass.UserName;
|
collectAuthorityTag = "-" + BaseClass.UserName;
|
||||||
|
|
||||||
@@ -1675,20 +1689,23 @@ namespace TemuKJD.BLL
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 外来格式V5
|
/// 外来格式V5
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="outProdJson"></param>
|
/// <param name="outProdJson"></param>
|
||||||
/// <param name="UpdateOldData"></param>
|
/// <param name="UpdateOldData"></param>
|
||||||
/// <param name="specialProdType"></param>
|
/// <param name="specialProdType"></param>
|
||||||
/// <param name="IsCollectAuthorityUser"></param>
|
/// <param name="IsCollectAuthorityUser"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string PddFrontToPddBackConvertFactory(string filePath, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false)
|
public string PddFrontToPddBackConvertFactory(string filePath, bool UpdateOldData = true, string specialProdType = null, bool IsCollectAuthorityUser = false, bool isSaveDb = true, string content = null)
|
||||||
{
|
{
|
||||||
PDDFrontProductInfo5 frontProdInfo = null;
|
PDDFrontProductInfo5 frontProdInfo = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
frontProdInfo = ConverterToPddFactory.Convert(filePath);
|
if (!content.IsNullOrEmpty())
|
||||||
|
frontProdInfo = ConverterToPddFactory.SetContentConvert(content);
|
||||||
|
else
|
||||||
|
frontProdInfo = ConverterToPddFactory.Convert(filePath);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -1992,8 +2009,11 @@ namespace TemuKJD.BLL
|
|||||||
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url;
|
||||||
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
dbProd.product_json = JsonHelper.SerializeObject(prodInfo);
|
||||||
|
|
||||||
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
if (!isSaveDb)
|
||||||
string collectAuthorityTag = "";
|
return "success" + dbProd.product_json;
|
||||||
|
|
||||||
|
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
||||||
|
string collectAuthorityTag = "";
|
||||||
if (IsCollectAuthorityUser)
|
if (IsCollectAuthorityUser)
|
||||||
collectAuthorityTag = "-" + BaseClass.UserName;
|
collectAuthorityTag = "-" + BaseClass.UserName;
|
||||||
|
|
||||||
|
|||||||
+41
-38
@@ -1,53 +1,54 @@
|
|||||||
using System;
|
using AllBase;
|
||||||
|
using AllBase.Helper;
|
||||||
|
using AllBase.Model.Param.ProductManage;
|
||||||
|
using AllBase.Model.Result;
|
||||||
|
using AllBase.Model.Result.PDDResult;
|
||||||
|
using AllBase.Model.Result.WXResult;
|
||||||
|
using CefSharp;
|
||||||
|
using CefSharp.WinForms;
|
||||||
|
using DevComponents.DotNetBar;
|
||||||
|
using NaiBa.CefHelper;
|
||||||
|
using NaiBa.CefHelper.Handler;
|
||||||
|
using NaiBa.Util;
|
||||||
|
using NaiBa.Util.Extension;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using CefSharp.WinForms;
|
|
||||||
using DevComponents.DotNetBar;
|
|
||||||
using AllBase;
|
|
||||||
using Work;
|
|
||||||
using TemuKJD.UserForm;
|
|
||||||
using TemuKJD.BaseForms;
|
using TemuKJD.BaseForms;
|
||||||
using TemuKJD.KJDForms.ToolForms;
|
using TemuKJD.Helper;
|
||||||
using System.Reflection;
|
|
||||||
using System.Net;
|
|
||||||
using System.Collections;
|
|
||||||
using TemuKJD.KJDForms.AdminForms;
|
using TemuKJD.KJDForms.AdminForms;
|
||||||
using TemuKJD.KJDForms.ShopForms;
|
|
||||||
using TemuKJD.KJDForms.ProductForms;
|
|
||||||
using TemuKJD.KJDForms.OrderForms;
|
|
||||||
using TemuKJD.KJDForms.SystemForms;
|
|
||||||
using Work.CollectClass;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
|
||||||
using CefSharp;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using AllBase.Helper;
|
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using NaiBa.CefHelper;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using AllBase.Model.Result;
|
|
||||||
using NaiBa.Util.Extension;
|
|
||||||
using NaiBa.Util;
|
|
||||||
using AllBase.Model.Param.ProductManage;
|
|
||||||
using TemuKJD.KJDForms.SalesCenterForms;
|
|
||||||
using NaiBa.CefHelper.Handler;
|
|
||||||
using TemuKJD.PDDForms.AdminForms;
|
|
||||||
using TemuKJD.PDDForms.ShopForms;
|
|
||||||
using TemuKJD.PDDForms.ProductForms;
|
|
||||||
using TemuKJD.KJDForms.JITForms;
|
using TemuKJD.KJDForms.JITForms;
|
||||||
using TemuKJD.WXForms.ShopForms;
|
using TemuKJD.KJDForms.OrderForms;
|
||||||
|
using TemuKJD.KJDForms.ProductForms;
|
||||||
|
using TemuKJD.KJDForms.SalesCenterForms;
|
||||||
|
using TemuKJD.KJDForms.ShopForms;
|
||||||
|
using TemuKJD.KJDForms.SystemForms;
|
||||||
|
using TemuKJD.KJDForms.ToolForms;
|
||||||
|
using TemuKJD.PDDForms.AdminForms;
|
||||||
|
using TemuKJD.PDDForms.ProductForms;
|
||||||
|
using TemuKJD.PDDForms.ShopForms;
|
||||||
|
using TemuKJD.UserForm;
|
||||||
using TemuKJD.WXForms.AdminForms;
|
using TemuKJD.WXForms.AdminForms;
|
||||||
using TemuKJD.WXForms.ProductForms;
|
using TemuKJD.WXForms.ProductForms;
|
||||||
using AllBase.Model.Result.WXResult;
|
using TemuKJD.WXForms.ShopForms;
|
||||||
using AllBase.Model.Result.PDDResult;
|
using Work;
|
||||||
|
using Work.CollectClass;
|
||||||
|
|
||||||
namespace TemuKJD
|
namespace TemuKJD
|
||||||
{
|
{
|
||||||
@@ -208,7 +209,9 @@ namespace TemuKJD
|
|||||||
var pName = Process.GetCurrentProcess().ProcessName;
|
var pName = Process.GetCurrentProcess().ProcessName;
|
||||||
ProcessCount = Process.GetProcesses().Count(p => p.ProcessName == pName);
|
ProcessCount = Process.GetProcesses().Count(p => p.ProcessName == pName);
|
||||||
//138版cef自己不会分缓存,会因占用导致报错,手动分缓存
|
//138版cef自己不会分缓存,会因占用导致报错,手动分缓存
|
||||||
settings.CachePath = Path.Combine(Environment.CurrentDirectory, "Cache\\" + ProcessCount);
|
//settings.CachePath = Path.Combine(Environment.CurrentDirectory, "Cache\\" + ProcessCount);
|
||||||
|
settings.RootCachePath = Path.Combine(Environment.CurrentDirectory, "Cache");
|
||||||
|
//settings.CachePath = Path.Combine(settings.RootCachePath, ProcessCount.ParseToString());
|
||||||
//settings.CachePath = null; //禁止缓存
|
//settings.CachePath = null; //禁止缓存
|
||||||
//settings.CefCommandLineArgs.Add("enable-javascript", "1");
|
//settings.CefCommandLineArgs.Add("enable-javascript", "1");
|
||||||
//settings.CefCommandLineArgs.Add("disable-features", "NetworkService,NetworkServiceInProcess");
|
//settings.CefCommandLineArgs.Add("disable-features", "NetworkService,NetworkServiceInProcess");
|
||||||
|
|||||||
@@ -418,11 +418,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
|||||||
}
|
}
|
||||||
WXDBProdUploadForm.Instance.lstTemuDBProductSelect.Add(new TemuDBProductSelect
|
WXDBProdUploadForm.Instance.lstTemuDBProductSelect.Add(new TemuDBProductSelect
|
||||||
{
|
{
|
||||||
out_product_Id = item.GoodsId.ToString(),
|
//out_product_Id = item.GoodsId.ToString(),
|
||||||
spu_id = item.GoodsId.ToString(),
|
spu_id = item.GoodsId.ToString(),
|
||||||
main_img = item.ThumbUrl,
|
main_img = item.ThumbUrl,
|
||||||
product_name = item.Title,
|
product_name = item.Title,
|
||||||
cat_name = catName,
|
cat_name = catName,
|
||||||
|
product_get_type_text = item.Platform == 1 ? ("多多") : item.Platform == 2 ? ("微信") : ("未知"),
|
||||||
|
db_type = "云端数据",
|
||||||
});
|
});
|
||||||
succ++;
|
succ++;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -40,6 +40,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
|||||||
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||||
this.colId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.colId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.colGetType = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.colGetType = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.colDbType = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
|
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||||
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn();
|
this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn();
|
||||||
@@ -145,6 +146,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
|||||||
this.colCheck,
|
this.colCheck,
|
||||||
this.colId,
|
this.colId,
|
||||||
this.colGetType,
|
this.colGetType,
|
||||||
|
this.colDbType,
|
||||||
this.colSpuId,
|
this.colSpuId,
|
||||||
this.colImgUrl,
|
this.colImgUrl,
|
||||||
this.colProductSkcPic,
|
this.colProductSkcPic,
|
||||||
@@ -188,6 +190,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
|||||||
this.colGetType.ReadOnly = true;
|
this.colGetType.ReadOnly = true;
|
||||||
this.colGetType.Visible = false;
|
this.colGetType.Visible = false;
|
||||||
//
|
//
|
||||||
|
// colDbType
|
||||||
|
//
|
||||||
|
this.colDbType.HeaderText = "商品库";
|
||||||
|
this.colDbType.Name = "colDbType";
|
||||||
|
this.colDbType.ReadOnly = true;
|
||||||
|
this.colDbType.Visible = false;
|
||||||
|
//
|
||||||
// colSpuId
|
// colSpuId
|
||||||
//
|
//
|
||||||
this.colSpuId.HeaderText = "商品ID";
|
this.colSpuId.HeaderText = "商品ID";
|
||||||
@@ -287,6 +296,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
|||||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
|
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn colId;
|
private System.Windows.Forms.DataGridViewTextBoxColumn colId;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn colGetType;
|
private System.Windows.Forms.DataGridViewTextBoxColumn colGetType;
|
||||||
|
private System.Windows.Forms.DataGridViewTextBoxColumn colDbType;
|
||||||
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
|
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
|
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
|
||||||
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
|
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
|||||||
if (BaseClass.UserName == "15288888888")
|
if (BaseClass.UserName == "15288888888")
|
||||||
{
|
{
|
||||||
dgvSelectProduct.Columns["colGetType"].Visible = true;
|
dgvSelectProduct.Columns["colGetType"].Visible = true;
|
||||||
|
dgvSelectProduct.Columns["colDbType"].Visible = true;
|
||||||
}
|
}
|
||||||
if (BaseClass.MainPath == "29pdd")
|
if (BaseClass.MainPath == "29pdd")
|
||||||
{
|
{
|
||||||
@@ -50,6 +51,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
|||||||
false,
|
false,
|
||||||
prodSelect.id,
|
prodSelect.id,
|
||||||
prodSelect.product_get_type_text,
|
prodSelect.product_get_type_text,
|
||||||
|
prodSelect.db_type,
|
||||||
BaseClass.SaLevel > 0 ? prodSelect.spu_id : prodSelect.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
|
BaseClass.SaLevel > 0 ? prodSelect.spu_id : prodSelect.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
|
||||||
prodSelect.main_img,
|
prodSelect.main_img,
|
||||||
DataGridViewExtension.defaultBitmap,
|
DataGridViewExtension.defaultBitmap,
|
||||||
|
|||||||
@@ -126,6 +126,9 @@
|
|||||||
<metadata name="colGetType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="colGetType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="colDbType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="colSpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="colSpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -34,6 +35,7 @@ using TemuKJD.UserControls;
|
|||||||
using TemuKJD.WXForms.ShopForms;
|
using TemuKJD.WXForms.ShopForms;
|
||||||
using Work;
|
using Work;
|
||||||
using Work.BLL.Tools;
|
using Work.BLL.Tools;
|
||||||
|
using Work.Services;
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
namespace TemuKJD.WXForms.ProductForms
|
namespace TemuKJD.WXForms.ProductForms
|
||||||
@@ -609,8 +611,9 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
RefreshShopLogin();
|
RefreshShopLogin();
|
||||||
updateAuthor();
|
updateAuthor();
|
||||||
RefreshDbProdGroupAndCate();
|
RefreshDbProdGroupAndCate();
|
||||||
|
lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
|
||||||
|
|
||||||
if (!isInit)
|
if (!isInit)
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -1252,7 +1255,13 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
KJDDBProduct kjdDbProd = selectProd.kjdDbProduct;
|
KJDDBProduct kjdDbProd = selectProd.kjdDbProduct;
|
||||||
string errStr = "";
|
string errStr = "";
|
||||||
if (kjdDbProd == null)
|
if (kjdDbProd == null)
|
||||||
kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString(), out errStr, true, true);
|
{
|
||||||
|
if (selectProd.db_type == "云端数据")
|
||||||
|
kjdDbProd = GetCloudProductDetail(selectProd, out errStr, true, true);
|
||||||
|
else
|
||||||
|
kjdDbProd = GetProductDetail(selectProd.out_product_Id.ToString(), out errStr, true, true);
|
||||||
|
kjdDbProd.db_type = selectProd.db_type;
|
||||||
|
}
|
||||||
if (kjdDbProd == null || kjdDbProd.id == 0)
|
if (kjdDbProd == null || kjdDbProd.id == 0)
|
||||||
{
|
{
|
||||||
if (kjdDbProd?.id == 0)
|
if (kjdDbProd?.id == 0)
|
||||||
@@ -1492,7 +1501,39 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WXGetEditProductInfoLite GetProductWXComplate(string secret_spu_id, out string errMsg)
|
public static KJDDBProduct GetCloudProductDetail(TemuDBProductSelect selectProd, out string errMsg, bool noViolationProduct = false, bool noBanWx = false)
|
||||||
|
{
|
||||||
|
errMsg = "";
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(selectProd?.spu_id))
|
||||||
|
{
|
||||||
|
errMsg = "产品编号为空";
|
||||||
|
return new KJDDBProduct();
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = CloudGoodsService.GetGoodsDetail(selectProd.spu_id.ParseToLong());
|
||||||
|
if (string.IsNullOrEmpty(html) || html.Length < 100)
|
||||||
|
html = CloudGoodsService.GetGoodsDetail(selectProd.spu_id.ParseToLong());
|
||||||
|
if (string.IsNullOrEmpty(html) || html.Length < 100)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
KJDDBProduct item = JsonHelper.DeserializeJsonToObject<KJDDBProduct>(JsonHelper.SerializeObject(selectProd));
|
||||||
|
item.product_json = html;
|
||||||
|
item.id = 29;
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WXGetEditProductInfoLite GetProductWXComplate(string secret_spu_id, out string errMsg)
|
||||||
{
|
{
|
||||||
errMsg = "";
|
errMsg = "";
|
||||||
|
|
||||||
@@ -1643,8 +1684,15 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var searchExtCode = dbProd.ext_code;
|
var searchExtCode = dbProd.ext_code;
|
||||||
if (searchExtCode.ParseToString().Length < 10)
|
if (dbProd.db_type == "云端数据")
|
||||||
searchExtCode = GetEC1ExtCode(dbProd.spu_id);
|
{
|
||||||
|
dbProd.ext_code = searchExtCode = GetNewExtCode(dbProd.spu_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (searchExtCode.ParseToString().Length < 10)
|
||||||
|
searchExtCode = GetEC1ExtCode(dbProd.spu_id);
|
||||||
|
}
|
||||||
if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId"))
|
if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId"))
|
||||||
{
|
{
|
||||||
var sku_secret_json = dbProd.sku_secret_json;
|
var sku_secret_json = dbProd.sku_secret_json;
|
||||||
@@ -1840,10 +1888,54 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
if (!string.IsNullOrEmpty(convertRst))
|
if (!string.IsNullOrEmpty(convertRst))
|
||||||
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品查询错误 " + convertRst + "\"}";
|
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品查询错误 " + convertRst + "\"}";
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 将产品数据初始化成微信小店支持的参数
|
#region 云端数据格式转换
|
||||||
JObject prodJObj = new JObject();
|
if (dbProd.db_type == "云端数据" && dbProd.product_get_type_text == "多多")
|
||||||
|
{
|
||||||
|
string convertRst = "";
|
||||||
|
|
||||||
|
var content = dbProd.product_json;
|
||||||
|
if (content.Contains("\"spec_keys\"") && content.Contains("\"spec_values\"") && content.Contains("\"is_sku_pre_sale\""))
|
||||||
|
{
|
||||||
|
convertRst = new PDDProdFormConverter().PddFrontToPddBackConvert(content, true, null, true, false);
|
||||||
|
}
|
||||||
|
else if (content.Contains("\"goods_id\"") && content.Contains("\"goods_name\"") && content.Contains("\"gallery\"") &&
|
||||||
|
content.Contains("\"priority\"") && content.Contains("\"enable_share\"") && content.Contains("\"goods_property\"") &&
|
||||||
|
(content.Contains("\"ref_pid\"") || content.Contains("\"goods_property\":[]")) && content.Contains("\"sku_id\"") && content.Contains("\"quantity\"") &&
|
||||||
|
content.Contains("\"specs\"") && content.Contains("\"spec_key\"") && content.Contains("\"spec_value\"") &&
|
||||||
|
content.Contains("\"group_price\"") && content.Contains("img.pddpic.com"))
|
||||||
|
{
|
||||||
|
convertRst = new PDDProdFormConverter().PddFrontToPddBackConvert2(content, true, null, true, false);
|
||||||
|
}
|
||||||
|
else if (content.Contains("\"mallId\"") && content.Contains("\"mallName\"") && content.Contains("\"goodsId\"") && content.Contains("\"goodsName\"") &&
|
||||||
|
content.Contains("\"catID\"") && content.Contains("\"catID4\"") && content.Contains("\"topGallery\"") && content.Contains("\"detailGallery\"") &&
|
||||||
|
content.Contains("\"shareDesc\"") && content.Contains("\"maxOnSaleGroupPriceInCent\"") && content.Contains("\"shareDesc\"") &&
|
||||||
|
content.Contains("\"specs\"") && content.Contains("\"spec_key\"") && content.Contains("\"spec_value\"") &&
|
||||||
|
content.Contains("\"groupPrice\"") && content.Contains("img.pddpic.com"))
|
||||||
|
{
|
||||||
|
convertRst = new PDDProdFormConverter().PddFrontToPddBackConvert3(content, true, null, true, false);
|
||||||
|
}
|
||||||
|
else if (content.Contains("\"商品编号\"") && content.Contains("\"商品链接\"") && content.Contains("\"标题\""))
|
||||||
|
{
|
||||||
|
convertRst = new PDDProdFormConverter().PddFrontToPddBackConvertV4(content, true, null, true, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
convertRst = new PDDProdFormConverter().PddFrontToPddBackConvertFactory("", true, null, true, false, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(convertRst) && !convertRst.StartsWith("success"))
|
||||||
|
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品查询错误 " + convertRst + "\"}";
|
||||||
|
|
||||||
|
if (convertRst.StartsWith("success"))
|
||||||
|
convertRst = convertRst.Substring("success".Length);
|
||||||
|
dbProd.product_json = convertRst;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 将产品数据初始化成微信小店支持的参数
|
||||||
|
JObject prodJObj = new JObject();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
prodJObj = JObject.Parse(dbProd.product_json);
|
prodJObj = JObject.Parse(dbProd.product_json);
|
||||||
@@ -2190,7 +2282,17 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
var prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
|
var prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
|
||||||
|
|
||||||
// 如果没有货号或有相同货号无法区分sku,自定义货号
|
// 如果没有货号或有相同货号无法区分sku,自定义货号
|
||||||
if (dbProd.product_get_type_text != "厂商直采")
|
if (dbProd.db_type == "云端数据")
|
||||||
|
{
|
||||||
|
foreach (var sku in prodInfo.detail.sku)
|
||||||
|
{
|
||||||
|
var skuId = sku.sku_id;
|
||||||
|
if (skuId.IsNullOrZero())
|
||||||
|
skuId = BaseClass.GetLong(string.Join(";", sku.spec.Select(s => s.spec_name)));
|
||||||
|
sku.out_sku_sn = GetNewExtCode(skuId.ParseToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dbProd.product_get_type_text != "厂商直采")
|
||||||
{
|
{
|
||||||
if (prodInfo.detail.sku.Any(s => s.out_sku_sn.IsNullOrEmpty()) ||
|
if (prodInfo.detail.sku.Any(s => s.out_sku_sn.IsNullOrEmpty()) ||
|
||||||
prodInfo.detail.sku.Select(s => s.out_sku_sn).ToList().Count > prodInfo.detail.sku.Select(s => s.out_sku_sn).Distinct().ToList().Count)
|
prodInfo.detail.sku.Select(s => s.out_sku_sn).ToList().Count > prodInfo.detail.sku.Select(s => s.out_sku_sn).Distinct().ToList().Count)
|
||||||
@@ -2605,7 +2707,7 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 保存缓存盗链图片
|
#region 保存缓存盗链图片
|
||||||
if (isChangeImgDic)
|
if (isChangeImgDic && dbProd.db_type != "云端数据")
|
||||||
{
|
{
|
||||||
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
||||||
var data = "";
|
var data = "";
|
||||||
@@ -3482,8 +3584,8 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 保存缓存盗链图片
|
#region 保存缓存盗链图片
|
||||||
if (isChangeImgDic)
|
if (isChangeImgDic && dbProd.db_type != "云端数据")
|
||||||
{
|
{
|
||||||
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
||||||
var data = "";
|
var data = "";
|
||||||
Invoke(new Action(() =>
|
Invoke(new Action(() =>
|
||||||
@@ -4556,7 +4658,7 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 保存缓存盗链图片
|
#region 保存缓存盗链图片
|
||||||
if (isChangeImgDic)
|
if (isChangeImgDic && dbProd.db_type != "云端数据")
|
||||||
{
|
{
|
||||||
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
||||||
var data = "";
|
var data = "";
|
||||||
@@ -5696,7 +5798,7 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region 保存缓存盗链图片
|
#region 保存缓存盗链图片
|
||||||
if (isChangeImgDic)
|
if (isChangeImgDic && dbProd.db_type != "云端数据")
|
||||||
{
|
{
|
||||||
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
|
||||||
var data = "";
|
var data = "";
|
||||||
|
|||||||
@@ -1101,6 +1101,7 @@ namespace TemuKJD.WXForms.ProductForms
|
|||||||
{
|
{
|
||||||
var selectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(prod));
|
var selectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(prod));
|
||||||
selectProd.product_name = productName;
|
selectProd.product_name = productName;
|
||||||
|
selectProd.db_type = "我的商品库";
|
||||||
if (chkFissionProduct.Checked)
|
if (chkFissionProduct.Checked)
|
||||||
selectProd.is_fission_title = true;
|
selectProd.is_fission_title = true;
|
||||||
selectProd.out_product_Id = prod.id.ToString();
|
selectProd.out_product_Id = prod.id.ToString();
|
||||||
|
|||||||
Reference in new issue
Block a user