1产品数据库分组字段设置查询 2jit产品合规信息填写
This commit is contained in:
1 parent
20fb940fa7
commit
31d11c0341
14 files changed
+734
-266
No files matched your search
@@ -17,6 +17,7 @@ using TemuKJD.BLL;
|
||||
using TemuKJD.Extension;
|
||||
using TemuKJD.KJDForms.AdminForms;
|
||||
using TemuKJD.KJDForms.ShopForms;
|
||||
using TemuKJD.ToolForms;
|
||||
using Work;
|
||||
|
||||
namespace TemuKJD.KJDForms.ProductForms
|
||||
@@ -26,7 +27,14 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
SetJitConfig setJitConfig = null;
|
||||
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
||||
public List<ShopLoginInfo> lstAdminShopInfo { get; set; } = new List<ShopLoginInfo>();
|
||||
public List<TemuCheckPriceInfo> lstCheckPriceInfo = new List<TemuCheckPriceInfo>();
|
||||
/// <summary>
|
||||
/// 生命周期商品列表
|
||||
/// </summary>
|
||||
public List<TemuForChainProductInfo> lstChainProdInfo = new List<TemuForChainProductInfo>();
|
||||
/// <summary>
|
||||
/// 商品合规信息列表
|
||||
/// </summary>
|
||||
public List<complianceInfo> lstComplianceInfo = new List<complianceInfo>();
|
||||
|
||||
public TemuJitForm()
|
||||
{
|
||||
@@ -37,6 +45,7 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
{
|
||||
this.dgvShop.AddSelectorColumn("colSelect");
|
||||
this.dgvPriceCheck.AddSelectorColumn("colCheck");
|
||||
this.dgvPriceCheck.AddImgColumn("colProductSkcPic", "colImgUrl");
|
||||
|
||||
this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
|
||||
this.dtpStartTime.Value = DateTime.Now.Date.AddDays(-7);
|
||||
@@ -254,7 +263,8 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
}
|
||||
|
||||
this.dgvPriceCheck.Rows.Clear();
|
||||
this.lstCheckPriceInfo.Clear();
|
||||
this.lstChainProdInfo.Clear();
|
||||
this.lstComplianceInfo.Clear();
|
||||
this.pbLoading.Visible = true;
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
@@ -292,7 +302,7 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
}
|
||||
string searchSkcIds = txtSkcId.Text.Trim().Trim(',');
|
||||
string searchExtCodes = txtExtCode.Text.Trim().Trim(',');
|
||||
var searchRst = this.SearchForChainSupplier(shop, page, 100, searchSkcIds, searchExtCodes, type, startTime, endTime);
|
||||
var searchRst = this.SearchForChainSupplier(shop, page, 50, searchSkcIds, searchExtCodes, type, startTime, endTime);
|
||||
if (searchRst.Contains("登录过期") || searchRst.Contains("Invalid Login State"))
|
||||
{
|
||||
AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
@@ -314,17 +324,42 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
jArr = new JArray();
|
||||
|
||||
List<string> extCodeLst = new List<string>();
|
||||
List<TemuCheckPriceInfo> checkPriceInfoTmpLst = new List<TemuCheckPriceInfo>();
|
||||
List<TemuForChainProductInfo> checkPriceInfoTmpLst = new List<TemuForChainProductInfo>();
|
||||
foreach (var item in jArr)
|
||||
{
|
||||
var jStr = JsonHelper.SerializeObject(item);
|
||||
TemuCheckPriceInfo priceInfo = JsonHelper.DeserializeJsonToObject<TemuCheckPriceInfo>(jStr);
|
||||
lstCheckPriceInfo.Add(priceInfo);
|
||||
TemuForChainProductInfo priceInfo = JsonHelper.DeserializeJsonToObject<TemuForChainProductInfo>(jStr);
|
||||
lstChainProdInfo.Add(priceInfo);
|
||||
checkPriceInfoTmpLst.Add(priceInfo);
|
||||
extCodeLst.Add(priceInfo.skcList.FirstOrDefault()?.extCode);
|
||||
}
|
||||
|
||||
var spuIds = "";
|
||||
foreach (var priceInfo in checkPriceInfoTmpLst)
|
||||
{
|
||||
spuIds += priceInfo.productId + ",";
|
||||
}
|
||||
spuIds = "\"" + spuIds.Trim(',').Replace(",", "\",\"") + "\"";
|
||||
List<complianceInfo> complianceInfoTmpLst = null;
|
||||
if (spuIds.Length > 2)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(50, 100));
|
||||
var queryComplianceRst = this.QueryComplianceInfo(shop, 50, spuIds);
|
||||
queryComplianceRst = GetHtml.Unicode2String(queryComplianceRst);
|
||||
if (queryComplianceRst.Contains("\"success\":true"))
|
||||
{
|
||||
JObject complianceRstObj = JObject.Parse(queryComplianceRst);
|
||||
|
||||
string sData = JsonHelper.SerializeObject(complianceRstObj["result"]["data"]);
|
||||
complianceInfoTmpLst = JsonHelper.DeserializeJsonToList<complianceInfo>(sData);
|
||||
lstComplianceInfo.AddRange(complianceInfoTmpLst);
|
||||
}
|
||||
}
|
||||
|
||||
int num = 0;
|
||||
foreach (var priceInfo in checkPriceInfoTmpLst)
|
||||
{
|
||||
num++;
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
@@ -340,9 +375,6 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
if (imgUrl == null)
|
||||
imgUrl = "";
|
||||
imgUrl = imgUrl.Replace("https://", "http://").Replace("img.kwcdn.com", "img.cdnfe.com") + "?imageMogr2/thumbnail/60x";
|
||||
//string getImgError = "";
|
||||
//var img = GetHtml.GetUrlImg(imgUrl + "?imageMogr2/thumbnail/60x", out getImgError);
|
||||
|
||||
foreach (var reviewInfo in priceInfo.skcList.FirstOrDefault().supplierPriceReviewInfoList)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
@@ -365,27 +397,16 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
skuName += "\r\n";
|
||||
}
|
||||
}
|
||||
var suggestSupplyPrice = "-";
|
||||
//if (type == "待卖家确认")
|
||||
//{
|
||||
// var orderPriceRst = "店铺掉线";
|
||||
// if (shop.LoginStatus2 == "国际版在线")
|
||||
// orderPriceRst = GetCheckPrice(shop, reviewInfo.priceOrderId.ParseToString());
|
||||
// if (orderPriceRst.Contains("登录过期") || orderPriceRst.Contains("Invalid Login State"))
|
||||
// {
|
||||
// AdminShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
// }
|
||||
// reviewInfo.suggestSupplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "suggestSupplyPrice");
|
||||
// reviewInfo.supplyPrice = BaseRegex.GetIntJson(ref orderPriceRst, "supplyPrice");
|
||||
// suggestSupplyPrice = (reviewInfo.suggestSupplyPrice / 100.0).ToString();
|
||||
// if (suggestSupplyPrice == "0")
|
||||
// suggestSupplyPrice = "获取推荐价格失败,请重试" + orderPriceRst;
|
||||
// else
|
||||
// suggestSupplyPrice += "¥";
|
||||
//}
|
||||
var reviewExtCode = priceInfo.skcList.FirstOrDefault()?.extCode;
|
||||
Thread.Sleep(Randomx.GetId(20, 50));
|
||||
|
||||
var complianceInfo = complianceInfoTmpLst.FirstOrDefault(c => c.spu_id == priceInfo.productId);
|
||||
if (complianceInfo == null)
|
||||
complianceInfo = new complianceInfo();
|
||||
var complianceTaskNames = complianceInfo.wait_task_dtolist
|
||||
.Where(t => t.task_name == "欧盟负责人" || t.task_name == "制造商信息" || t.is_not_required == false)
|
||||
.Select(t => t.task_name).ToList();
|
||||
var complianceStr = string.Join("\r\n", complianceTaskNames);
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
int rowId = this.dgvPriceCheck.Rows.Add(
|
||||
@@ -401,14 +422,18 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
priceInfo.productName,
|
||||
skuName,
|
||||
reviewExtCode,
|
||||
"-", //货号价格,jit不需要
|
||||
//"-", //货号价格,jit不需要
|
||||
// sku不同价的会被分成多个review,priceInfo此时为价格范围
|
||||
reviewInfo.productSkuList.FirstOrDefault()?.supplierPrice, //priceInfo.supplierPrice
|
||||
BaseClass.StampToDateTime((priceInfo.skcList.FirstOrDefault()?.statusTime.createdTime.ParseToLong() / 1000).ParseToInt()).ToString("yy/MM/dd HH:mm:ss"),
|
||||
|
||||
complianceStr,
|
||||
""
|
||||
);
|
||||
dgvPriceCheck.Rows[rowId].Height = 60;
|
||||
if (num % 2 == 1)
|
||||
dgvPriceCheck.Rows[rowId].DefaultCellStyle.BackColor = Color.White;
|
||||
else
|
||||
dgvPriceCheck.Rows[rowId].DefaultCellStyle.BackColor = Color.WhiteSmoke;
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -434,7 +459,7 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
}
|
||||
|
||||
|
||||
private string SearchForChainSupplier(ShopLoginInfo shop, int page, int pageSize = 100, string prodSkcIds = null, string skcExtCode = null,
|
||||
private string SearchForChainSupplier(ShopLoginInfo shop, int page, int pageSize = 50, string prodSkcIds = null, string skcExtCode = null,
|
||||
string type = "待创建首单", long startTime = 0, long endTime = 0)
|
||||
{
|
||||
string url = "https://agentseller.temu.com/api/kiana/mms/robin/searchForChainSupplier";
|
||||
@@ -456,6 +481,99 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
string referer = "https://agentseller.temu.com/newon/product-select";
|
||||
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
|
||||
}
|
||||
|
||||
private string QueryComplianceInfo(ShopLoginInfo shop, int pageSize = 50, string prodSpuIds = null)
|
||||
{
|
||||
string url = "https://agentseller.temu.com/ms/bg-flux-ms/compliance_property/page_query";
|
||||
string body = "";
|
||||
body = @"{""page_num"":1,""page_size"":" + pageSize + @",""type"":2,""spu_id_list"":[" + prodSpuIds + "]}";
|
||||
string referer = "https://agentseller.temu.com/govern/information-supplementation";
|
||||
return HttpResponseBLL.PostResponse2(shop, url, body, referer);
|
||||
}
|
||||
|
||||
private void dgvPriceCheck_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvPriceCheck.Columns[e.ColumnIndex].HeaderText;
|
||||
string orderId = dgvPriceCheck.Rows[e.RowIndex].Cells["colOrderId"].Value.ParseToString();
|
||||
string prodId = dgvPriceCheck.Rows[e.RowIndex].Cells["colProductId"].Value.ParseToString();
|
||||
string accountId = dgvPriceCheck.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
|
||||
var shop = lstAdminShopInfo.FirstOrDefault(v => v.ShopId == accountId);
|
||||
|
||||
switch (headerText)
|
||||
{
|
||||
case "规格名称":
|
||||
{
|
||||
var PriceInfo = lstChainProdInfo.FirstOrDefault(p => p.productId.ParseToString() == prodId);
|
||||
if (PriceInfo != null)
|
||||
{
|
||||
this.pnlSpecDetail.Visible = true;
|
||||
|
||||
string skuName = "";
|
||||
var prodSkuList = PriceInfo.skcList.FirstOrDefault().skuList;
|
||||
if (prodSkuList != null)
|
||||
{
|
||||
foreach (var sku in prodSkuList)
|
||||
{
|
||||
foreach (var prop in sku.productPropertyList)
|
||||
{
|
||||
skuName += prop.value + ",";
|
||||
}
|
||||
skuName = skuName.TrimEnd(',') + ";";
|
||||
skuName += " ";
|
||||
skuName += " 长:" + sku.len.ParseToInt() * 0.1;
|
||||
skuName += " 宽:" + sku.width.ParseToInt() * 0.1;
|
||||
skuName += " 高:" + sku.height.ParseToInt() * 0.1;
|
||||
skuName += " 重:" + sku.weight.ParseToInt() * 0.001;
|
||||
skuName += "\r\n";
|
||||
}
|
||||
}
|
||||
this.textBox1.Text = skuName;
|
||||
}
|
||||
}
|
||||
break;
|
||||
//case "同意报价":
|
||||
// {
|
||||
// applyHighPrice(shop, orderId, dgvPriceCheck.Rows[e.RowIndex]);
|
||||
// }
|
||||
// break;
|
||||
//case "拒绝报价":
|
||||
// {
|
||||
// cancelLowPrice(shop, orderId, dgvPriceCheck.Rows[e.RowIndex]);
|
||||
// }
|
||||
// break;
|
||||
//case "作废待创建":
|
||||
// {
|
||||
// this.cancelTitleWrongPrice(shop, prodId);
|
||||
// }
|
||||
// break;
|
||||
case "合规":
|
||||
{
|
||||
//加州65号提案
|
||||
//欧盟负责人
|
||||
//制造商信息
|
||||
//其他合规信息 商品识别码
|
||||
}
|
||||
break;
|
||||
case "Skc图片":
|
||||
string url = dgvPriceCheck.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("img.kwcdn.com", "img.cdnfe.com");
|
||||
url = url.IndexOf("?") < 0 ? url : url.Substring(0, url.IndexOf("?"));
|
||||
ShowImgForm imgFrom = new ShowImgForm(url);
|
||||
imgFrom.ShowDialog();
|
||||
break;
|
||||
//case "":
|
||||
// dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvPriceCheck.Rows[e.RowIndex].Cells["colCheck"].Value;
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.pnlSpecDetail.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class SetJitConfig
|
||||
@@ -465,4 +583,37 @@ namespace TemuKJD.KJDForms.ProductForms
|
||||
public string SearchNotes { get; set; } = "";
|
||||
public bool SearchAllShop { get; set; } = true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 合规信息
|
||||
/// </summary>
|
||||
public class complianceInfo
|
||||
{
|
||||
public long? spu_id { get; set; } // 5230217458,
|
||||
public string spu_name { get; set; } // "XIXITIAO 女款韩式拖鞋 - 夏季休闲纯色 EVA 拖鞋,舒适防滑低跟沙滩凉鞋,室内/室外使用,夏季凉鞋,女式人字拖,夹趾凉鞋时尚女士轻质夏季一脚蹬沙滩人字拖凉鞋,女式人字拖夹趾凉鞋休闲凉鞋淋浴鞋沙滩拖鞋拖鞋凉鞋一脚蹬淌水鞋,百搭设计,适合日常穿着,女式平底凉鞋",
|
||||
public long? cat_id { get; set; } // 29186,
|
||||
public string cat_name { get; set; } // "女士人字拖",
|
||||
public long? goods_id { get; set; } // 601103852497488,
|
||||
public string goods_url { get; set; } // "https://img.kwcdn.com/product/fancy/0f52acc1-edfe-4f70-8032-012505ad0da5.jpg",
|
||||
public List<task_dto> wait_task_dtolist { get; set; }
|
||||
public List<task_dto> wait_task_show_dtolist { get; set; }
|
||||
public bool? on_sale { get; set; } // false
|
||||
}
|
||||
public class task_dto
|
||||
{
|
||||
public long? task_id { get; set; } // 101042759897649,
|
||||
public int? task_type { get; set; } // 25,
|
||||
public bool? is_not_required { get; set; } // true,
|
||||
public string task_name { get; set; } // "欧盟负责人",
|
||||
public int? status { get; set; } // 2,
|
||||
public long? punish_time { get; set; } // 0,
|
||||
public sale_effect_info sale_effect_info { get; set; }
|
||||
}
|
||||
public class sale_effect_info
|
||||
{
|
||||
public long? punish_time { get; set; } // 0,
|
||||
public bool? on_site { get; set; } // false,
|
||||
public List<int> region_list { get; set; } // [105, 106, 107, 108, 109, ...],
|
||||
public string content { get; set; } // "德国站、法国站、意大利站、荷兰站、西班牙站、葡萄牙站、波兰站、瑞典站、希腊站、爱尔兰站、塞浦路斯站、捷克站、匈牙利站、丹麦站、罗马尼亚站、保加利亚站、比利时站、奥地利站、芬兰站、斯洛伐克站、克罗地亚站、斯洛文尼亚站、立陶宛站、爱沙尼亚站、拉脱维亚站、马耳他站、卢森堡站"
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user