1微信用户采集店铺商品功能 2查询达人带货商品并联系达人功能
This commit is contained in:
1 parent
e1ee91dd03
commit
2759ff0f6d
33 files changed
+2464
-626
No files matched your search
@@ -31,8 +31,40 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
/// </summary>
|
||||
public event InfoReceivedHandler OnInfoReceived;
|
||||
|
||||
public string getProduct(string sProdId, string supplierId, bool isReGet = true)
|
||||
/// <summary>
|
||||
/// 商品回采/采集
|
||||
/// </summary>
|
||||
/// <param name="sProdId"></param>
|
||||
/// <param name="supplierId"></param>
|
||||
/// <param name="isReGet"></param>
|
||||
/// <returns></returns>
|
||||
public string getProduct(string sProdId, string supplierId, bool isReGet = true, bool isCollectAuthorityUser = false)
|
||||
{
|
||||
if (BaseClass.SaLevel == 0 && !BaseClass.UserAuthority.Contains("微信回采") && !BaseClass.UserAuthority.Contains("商品采集"))
|
||||
{
|
||||
MainForm.instance.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowError("用户没有采集权限!");
|
||||
}));
|
||||
return "failed";
|
||||
}
|
||||
if (BaseClass.SaLevel == 0 && !BaseClass.UserAuthority.Contains("微信回采") && isReGet == true)
|
||||
{
|
||||
MainForm.instance.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowError("用户没有微信回采权限!");
|
||||
}));
|
||||
return "failed";
|
||||
}
|
||||
if (BaseClass.SaLevel == 0 && !BaseClass.UserAuthority.Contains("商品采集") && isCollectAuthorityUser == true)
|
||||
{
|
||||
MainForm.instance.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowError("用户没有商品采集权限!");
|
||||
}));
|
||||
return "failed";
|
||||
}
|
||||
|
||||
var prodId = sProdId.ParseToLong();
|
||||
if (prodId <= 0)
|
||||
{
|
||||
@@ -58,10 +90,10 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
Task.Run(() =>
|
||||
{
|
||||
string msg = "";
|
||||
if (isReGet)
|
||||
if (isReGet) // 微信回采
|
||||
msg = ReGetProductWithWXFormat(shop, sProdId);
|
||||
else
|
||||
msg = GetWxProduct(shop, sProdId);
|
||||
else // 微信店铺商品采集
|
||||
msg = GetWxProduct(shop, sProdId, isCollectAuthorityUser);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
{
|
||||
if (!msg.StartsWith("success") && !msg.StartsWith("商品回采保存成功") && !msg.Contains("微信商品采集入库成功"))
|
||||
@@ -84,6 +116,12 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
return "success";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品详情回采
|
||||
/// </summary>
|
||||
/// <param name="shop"></param>
|
||||
/// <param name="prodId"></param>
|
||||
/// <returns></returns>
|
||||
public string ReGetProductWithWXFormat(ShopLoginInfo shop, string prodId)
|
||||
{
|
||||
//string getString = isReGet ? "商品回采" : "商品采集";
|
||||
@@ -202,13 +240,20 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWxProduct(ShopLoginInfo shop, string prodId)
|
||||
/// <summary>
|
||||
/// 店铺商品采集
|
||||
/// </summary>
|
||||
/// <param name="shop"></param>
|
||||
/// <param name="prodId"></param>
|
||||
/// <param name="isCollectAuthorityUser"></param>
|
||||
/// <returns></returns>
|
||||
public string GetWxProduct(ShopLoginInfo shop, string prodId, bool isCollectAuthorityUser = false)
|
||||
{
|
||||
WXGetEditProductInfoLite wxProdInfoLite = null;
|
||||
return GetWxProduct(shop, prodId, ref wxProdInfoLite);
|
||||
return GetWxProduct(shop, prodId, ref wxProdInfoLite, false, isCollectAuthorityUser);
|
||||
}
|
||||
|
||||
public string GetWxProduct(ShopLoginInfo shop, string prodId, ref WXGetEditProductInfoLite wxProdInfoLite, bool isNotSaveDB = false)
|
||||
public string GetWxProduct(ShopLoginInfo shop, string prodId, ref WXGetEditProductInfoLite wxProdInfoLite, bool isNotSaveDB = false, bool isCollectAuthorityUser = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -267,7 +312,8 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
if (isNotSaveDB)
|
||||
return "success";
|
||||
else
|
||||
return SaveWxProd(shop, prodId, wxProdInfoLite);
|
||||
return SaveWxProd(shop, prodId, wxProdInfoLite, isCollectAuthorityUser);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -290,12 +336,17 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
/// <param name="coid"></param>
|
||||
/// <param name="realCoid"></param>
|
||||
/// <returns></returns>
|
||||
public string SaveWxProd(ShopLoginInfo shop, string prodId, WXGetEditProductInfoLite wxEditProdInfoLite,
|
||||
public string SaveWxProd(ShopLoginInfo shop, string prodId, WXGetEditProductInfoLite wxEditProdInfoLite, bool isCollectAuthorityUser = false,
|
||||
string specialProdType = null, string coid = null, string realCoid = null, int? viewUv = null, string wx_safe_status = "安全商品")
|
||||
{
|
||||
// 商品采集权限用户采集的数据加上用户前缀(商品前缀显示给用户的时候隐藏)
|
||||
string collectAuthorityTag = "";
|
||||
if (isCollectAuthorityUser)
|
||||
collectAuthorityTag = "-" + BaseClass.UserName;
|
||||
|
||||
bool isExist = false;
|
||||
var existUrl = BaseClass.BuildPDDObjString("product/get_product_spu_id_list");
|
||||
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prodId;
|
||||
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prodId + collectAuthorityTag;
|
||||
//if (!string.IsNullOrEmpty(prod.dbProduct.real_spu_id))
|
||||
// existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.spuId + "," + prod.dbProduct.real_spu_id;
|
||||
string html = GetHtml.PostUtf8(existUrl, existData);
|
||||
@@ -319,7 +370,7 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
var data = Work.UserLogin.GetSignaturex() +
|
||||
"&from_shop_id=" + shop.ShopId +
|
||||
"&from_shop_name=" + shop.ShopAccount +
|
||||
"&spu_id=" + prodId;
|
||||
"&spu_id=" + prodId + collectAuthorityTag;
|
||||
if (specialProdType == "爆款数据")
|
||||
data += "&add_hot_version=v3";
|
||||
if (!string.IsNullOrWhiteSpace(coid))
|
||||
@@ -340,6 +391,11 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
"&main_img=" + HttpUtility.UrlEncode(wxEditProdInfoLite.product.info.headImg.FirstOrDefault(), Encoding.UTF8) +
|
||||
"&wx_safe_status=" + HttpUtility.UrlEncode(wx_safe_status, Encoding.UTF8) +
|
||||
"&product_get_type=" + HttpUtility.UrlEncode("微信店采", Encoding.UTF8);
|
||||
if (isCollectAuthorityUser)
|
||||
{
|
||||
data += "&add_user_name=" + BaseClass.UserName;
|
||||
data += "&group=用户" + BaseClass.UserName;
|
||||
}
|
||||
|
||||
if (wxEditProdInfoLite.product.info.category.Count > 0)
|
||||
{
|
||||
@@ -351,10 +407,14 @@ namespace TemuKJD.WXForms.ShopForms
|
||||
data += "&cat_id=" + wxEditProdInfoLite.product.info.category.LastOrDefault()?.catId;
|
||||
data += "&cat_name=" + HttpUtility.UrlEncode((wxEditProdInfoLite.product.info.category.LastOrDefault()?.name).ParseToString(), Encoding.UTF8);
|
||||
}
|
||||
//if (wxEditProdInfoLite.product.info.category.FirstOrDefault().name == "图书")
|
||||
//{
|
||||
// data += "&special_prod_type=" + HttpUtility.UrlEncode("书籍", Encoding.UTF8);
|
||||
//}
|
||||
if (wxEditProdInfoLite.product.info.category.Count > 1)
|
||||
{
|
||||
data += "&wx_cat_2=" + wxEditProdInfoLite.product.info.category[1].catId;
|
||||
}
|
||||
if (wxEditProdInfoLite.product.info.category.Count > 2)
|
||||
{
|
||||
data += "&wx_cat_3=" + wxEditProdInfoLite.product.info.category[2].catId;
|
||||
}
|
||||
if (specialProdType != null)
|
||||
{
|
||||
data += "&special_prod_type=" + HttpUtility.UrlEncode("爆款数据", Encoding.UTF8);
|
||||
|
||||
Reference in new issue
Block a user