资质图上次传75% 手表上传

This commit is contained in:
wule committed 2026-08-11 02:19:09 +08:00
1 parent 35240505e3
commit a568c685ee
10 files changed
+307 -201

No files matched your search

@@ -2556,6 +2556,11 @@ namespace TemuKJD.WXForms.ProductForms
// 微信商品使用类目缓存
if (!dbProd.wx_cat_leaf.IsNullOrZero())
{
if (dbProd.wx_cat_3 == 7370)
dbProd.wx_cat_3 = 547591;
if (dbProd.wx_cat_leaf == 7370)
dbProd.wx_cat_leaf = 547591;
if (!dbProd.wx_cat_1.IsNullOrZero())
aiCateIdLst.Add(dbProd.wx_cat_1.ParseToLong());
if (!dbProd.wx_cat_2.IsNullOrZero())
@@ -2649,6 +2654,13 @@ namespace TemuKJD.WXForms.ProductForms
cell.Value = "正在生成类目模板";
}));
}
if (aiCateIdLst.LastOrDefault() == 7370)
{
aiCateIdLst.RemoveAt(aiCateIdLst.Count - 1);
aiCateIdLst.Add(547591);
}
string getCateRst = WXUpload.getCategoryOnShelf(shop, aiCateIdLst);
if (!getCateRst.Contains("\"code\":0"))
{
@@ -2675,8 +2687,11 @@ namespace TemuKJD.WXForms.ProductForms
}
// 获取叶子类目id
long leafCatId = (upProdParam.product.info.category.LastOrDefault()?.catId).ParseToLong(); //哲学经典著作
var bound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id == leafCatId);
if (leafCatId == 547591)
bound = GlobalConfig.WxCatBoundList.FirstOrDefault(b => b.leaf_id == 7370);
if (bound == null)
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"获取类目保证金失败\"}";
var maxBount = txtFilterBoundMax.Text.Trim().ParseToInt();
@@ -2684,97 +2699,111 @@ namespace TemuKJD.WXForms.ProductForms
if (bound.cat_bound < minBount || bound.cat_bound > maxBount )
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目保证金(" + bound.cat_bound + ")超过过滤限制(" + minBount + "-" + maxBount + ")\"}";
// 检测是否有类目上传权限
var cateUpCheckRst = WXUpload.batchCheckCategoryRelation(shop, leafCatId);
//"{\"code\":0,\"list\":[{\"category_id\":\"1427\",\"result\":0,\"no_auth_reason_type\":0}]}"
//"{\"code\":0,\"list\":[{\"category_id\":\"7486\",\"result\":0,\"no_auth_reason_type\":0}]}"
if (!cateUpCheckRst.Contains("\"code\":0") && !cateUpCheckRst.Contains("\"success\":true"))
var spBrandId = "";
if (leafCatId == 547591)
{
var error = BaseRegex.GetStringJson(ref cateUpCheckRst, "msg");
if (string.IsNullOrEmpty(error))
error = cateUpCheckRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目校验错误 " + error + "\"}";
var rst = WXUpload.getMixBrand(shop, leafCatId.ToString());
// 先写死
spBrandId = 10914219.ToString();
// 国表定向类目
upProdParam.product.info.brandId = spBrandId.ParseToLong();
}
if (!cateUpCheckRst.Contains("\"result\":1"))
else
{
if (aiCateIdLst.FirstOrDefault() == 10000215)
{
//@"{""categoryInfo"":{""categories"":[{""id"":10000215},{""id"":10000222},{""id"":7483}],""categoryDeposit"":""1000.00"",""isNewApplyCat"":true,""licenseGroupList"":[{""licenseGroupId"":""1"",""license"":{""licenseId"":""4"",""cosIdList"":[""1771897594802-oM5657FQAaKYlf2uP300NBgx9HYY-0581""],""licenseFieldList"":[{""key"":""audit_license_registration_no"",""value"":""YB23509020049441""},{""key"":""search_url"",""value"":""""}],""isReuse"":true}}],""ruleVersion"":5234,""certificate"":[]},""brandIdList"":[],""leafCategoryId"":7483,""reuse"":0,""applyType"":""normalApply""}";
var getCatDataRst = WXUpload.getSingleCategoryData(shop, leafCatId, aiCateIdLst);
if (!getCatDataRst.Contains("\"code\":0") && !getCatDataRst.Contains("\"success\":true"))
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 查询类目资质文件失败" + "\"}";
}
WXCateAuthParam wxCateAuthParam = new WXCateAuthParam();
wxCateAuthParam.leafCategoryId = leafCatId;
wxCateAuthParam.categoryInfo.categoryDeposit = bound.cat_bound.ToString("0.00");
wxCateAuthParam.categoryInfo.ruleVersion = BaseRegex.GetIntJson(ref getCatDataRst, "ruleVersion");
foreach (var cateId in aiCateIdLst)
{
wxCateAuthParam.categoryInfo.categories.Add(new WXCateId() { id = cateId });
}
try
{
if (!JsonHelper.JObjectParse(getCatDataRst)["reuseApplyData"].IsJTokenNullOrEmpty())
{
var jlicenseGroupList = JsonHelper.JObjectParse(getCatDataRst)["reuseApplyData"]["catInfo"]["licenseGroupList"];
var licenseGroupListStr = JsonHelper.SerializeObject(jlicenseGroupList);
wxCateAuthParam.categoryInfo.licenseGroupList = JsonHelper.DeserializeJsonToList<licenseGroup>(licenseGroupListStr);
}
else
{
var licenseGroup = new licenseGroup();
wxCateAuthParam.categoryInfo.licenseGroupList.Add(licenseGroup);
licenseGroup.license.licenseId = "4";
var cosIdList = "[" + BaseRegex.GetMatchRegexString(ref getCatDataRst, "\"cosIdList\":\\[([\\s\\S]*?)\\]") + "]";
licenseGroup.license.cosIdList = JsonHelper.DeserializeJsonToList<string>(cosIdList);
var licenseFieldList = "[" + BaseRegex.GetMatchRegexString(ref getCatDataRst, "\"licenseFieldList\":\\[([\\s\\S]*?)\\]") + "]";
licenseGroup.license.licenseFieldList = JsonHelper.DeserializeJsonToList<KeyValueParam>(licenseFieldList);
}
var authCateRst = WXUpload.wxCateAuth(shop, aiCateIdLst, wxCateAuthParam);
if (!authCateRst.Contains("\"code\":0") && !authCateRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref authCateRst, "msg");
if (string.IsNullOrEmpty(error))
error = BaseRegex.GetStringJson(ref authCateRst, "errmsg");
if (string.IsNullOrEmpty(error))
error = authCateRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 " + error + "\"}";
}
Thread.Sleep(Randomx.GetId(5000, 7000));
cateUpCheckRst = WXUpload.batchCheckCategoryRelation(shop, leafCatId);
if (!cateUpCheckRst.Contains("\"code\":0") && !cateUpCheckRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref cateUpCheckRst, "msg");
if (string.IsNullOrEmpty(error))
error = cateUpCheckRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请校验错误 " + error + "\"}";
}
if (!cateUpCheckRst.Contains("\"result\":1"))
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请审核中 请稍后再试\"}";
}
catch
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 复用资质文件失败,请重新提交资质文件" + "\"}";
}
//return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 请手动申请资质类目" + "\"}";
}
else
// 检测是否有类目上传权限
var cateUpCheckRst = WXUpload.batchCheckCategoryRelation(shop, leafCatId);
//"{\"code\":0,\"list\":[{\"category_id\":\"1427\",\"result\":0,\"no_auth_reason_type\":0}]}"
//"{\"code\":0,\"list\":[{\"category_id\":\"7486\",\"result\":0,\"no_auth_reason_type\":0}]}"
if (!cateUpCheckRst.Contains("\"code\":0") && !cateUpCheckRst.Contains("\"success\":true"))
{
Thread.Sleep(Randomx.GetId(1000, 2000));
var cateAuthorRst = WXUpload.addFinderCategoryV2(shop, leafCatId);
if (!cateAuthorRst.Contains("\"code\":0") && !cateAuthorRst.Contains("\"success\":true"))
var error = BaseRegex.GetStringJson(ref cateUpCheckRst, "msg");
if (string.IsNullOrEmpty(error))
error = cateUpCheckRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目校验错误 " + error + "\"}";
}
if (!cateUpCheckRst.Contains("\"result\":1"))
{
if (aiCateIdLst.FirstOrDefault() == 10000215)
{
var error = BaseRegex.GetStringJson(ref cateAuthorRst, "msg");
if (string.IsNullOrEmpty(error))
error = BaseRegex.GetStringJson(ref cateAuthorRst, "errmsg");
if (string.IsNullOrEmpty(error))
error = cateAuthorRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请错误 " + error + "\"}";
//@"{""categoryInfo"":{""categories"":[{""id"":10000215},{""id"":10000222},{""id"":7483}],""categoryDeposit"":""1000.00"",""isNewApplyCat"":true,""licenseGroupList"":[{""licenseGroupId"":""1"",""license"":{""licenseId"":""4"",""cosIdList"":[""1771897594802-oM5657FQAaKYlf2uP300NBgx9HYY-0581""],""licenseFieldList"":[{""key"":""audit_license_registration_no"",""value"":""YB23509020049441""},{""key"":""search_url"",""value"":""""}],""isReuse"":true}}],""ruleVersion"":5234,""certificate"":[]},""brandIdList"":[],""leafCategoryId"":7483,""reuse"":0,""applyType"":""normalApply""}";
var getCatDataRst = WXUpload.getSingleCategoryData(shop, leafCatId, aiCateIdLst);
if (!getCatDataRst.Contains("\"code\":0") && !getCatDataRst.Contains("\"success\":true"))
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 查询类目资质文件失败" + "\"}";
}
WXCateAuthParam wxCateAuthParam = new WXCateAuthParam();
wxCateAuthParam.leafCategoryId = leafCatId;
wxCateAuthParam.categoryInfo.categoryDeposit = bound.cat_bound.ToString("0.00");
wxCateAuthParam.categoryInfo.ruleVersion = BaseRegex.GetIntJson(ref getCatDataRst, "ruleVersion");
foreach (var cateId in aiCateIdLst)
{
wxCateAuthParam.categoryInfo.categories.Add(new WXCateId() { id = cateId });
}
try
{
if (!JsonHelper.JObjectParse(getCatDataRst)["reuseApplyData"].IsJTokenNullOrEmpty())
{
var jlicenseGroupList = JsonHelper.JObjectParse(getCatDataRst)["reuseApplyData"]["catInfo"]["licenseGroupList"];
var licenseGroupListStr = JsonHelper.SerializeObject(jlicenseGroupList);
wxCateAuthParam.categoryInfo.licenseGroupList = JsonHelper.DeserializeJsonToList<licenseGroup>(licenseGroupListStr);
}
else
{
var licenseGroup = new licenseGroup();
wxCateAuthParam.categoryInfo.licenseGroupList.Add(licenseGroup);
licenseGroup.license.licenseId = "4";
var cosIdList = "[" + BaseRegex.GetMatchRegexString(ref getCatDataRst, "\"cosIdList\":\\[([\\s\\S]*?)\\]") + "]";
licenseGroup.license.cosIdList = JsonHelper.DeserializeJsonToList<string>(cosIdList);
var licenseFieldList = "[" + BaseRegex.GetMatchRegexString(ref getCatDataRst, "\"licenseFieldList\":\\[([\\s\\S]*?)\\]") + "]";
licenseGroup.license.licenseFieldList = JsonHelper.DeserializeJsonToList<KeyValueParam>(licenseFieldList);
}
var authCateRst = WXUpload.wxCateAuth(shop, aiCateIdLst, wxCateAuthParam);
if (!authCateRst.Contains("\"code\":0") && !authCateRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref authCateRst, "msg");
if (string.IsNullOrEmpty(error))
error = BaseRegex.GetStringJson(ref authCateRst, "errmsg");
if (string.IsNullOrEmpty(error))
error = authCateRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 " + error + "\"}";
}
Thread.Sleep(Randomx.GetId(5000, 7000));
cateUpCheckRst = WXUpload.batchCheckCategoryRelation(shop, leafCatId);
if (!cateUpCheckRst.Contains("\"code\":0") && !cateUpCheckRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref cateUpCheckRst, "msg");
if (string.IsNullOrEmpty(error))
error = cateUpCheckRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请校验错误 " + error + "\"}";
}
if (!cateUpCheckRst.Contains("\"result\":1"))
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请审核中 请稍后再试\"}";
}
catch
{
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 复用资质文件失败,请重新提交资质文件" + "\"}";
}
//return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请失败 请手动申请资质类目" + "\"}";
}
else
{
Thread.Sleep(Randomx.GetId(1000, 2000));
var cateAuthorRst = WXUpload.addFinderCategoryV2(shop, leafCatId);
if (!cateAuthorRst.Contains("\"code\":0") && !cateAuthorRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref cateAuthorRst, "msg");
if (string.IsNullOrEmpty(error))
error = BaseRegex.GetStringJson(ref cateAuthorRst, "errmsg");
if (string.IsNullOrEmpty(error))
error = cateAuthorRst;
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"类目申请错误 " + error + "\"}";
}
}
}
}
#endregion
#region ai短标题 // ai获取短标题
@@ -4116,7 +4145,19 @@ namespace TemuKJD.WXForms.ProductForms
//// }
//// }
////}
//else
// 坚果炒货类,系统返回的试规格/净含量但是要求填规格
if ((upProdParam.product.info?.category?.FirstOrDefault()?.name == "食品饮料" || prodInfo.detail?.cats?.FirstOrDefault() == "食品饮料") &&
(upProdParam.product.info?.category?.LastOrDefault()?.name == "坚果炒货" || upProdParam.product.info?.category?.LastOrDefault()?.name == "果干"))
{
if (!prodInfo.detail.sku.FirstOrDefault().spec.Any(s => s.parent_name == "规格"))
{
foreach (var sku in prodInfo.detail.sku)
{
sku.spec.FirstOrDefault().parent_name = "规格";
}
}
}
else
{
var leafCat = upProdParam.product.info.category.LastOrDefault();
if (leafCat?.catInfo?.saleAttr?.attr != null)
@@ -4960,7 +5001,7 @@ namespace TemuKJD.WXForms.ProductForms
foreach (var propParam in upProdParam.product.info.param)
{
if (propParam.categorys[0].name.Contains("食品名称"))
if (propParam.categorys[0].name.Contains("食品名称") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装"))
foodName = "食品名称:" + propParam.categorys[1].name;
else if (propParam.categorys[0].name.Contains("生产企业名称") && !propParam.categorys[1].name.Contains("见包装") && !propParam.categorys[1].name.Contains("见外包装"))
companyName = "生产商名称:" + propParam.categorys[1].name;
@@ -7068,11 +7109,21 @@ Content-Type: image/jpeg
return result;
}
public static string getCategoryOnShelf(ShopLoginInfo shop, List<long> catIdLst)
public static string getCategoryOnShelf(ShopLoginInfo shop, List<long> catIdLst, string brandId = "2100000000")
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradecategory/cgi/product/getCategoryOnShelfV2?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry";
string body = @"{""catIdList"":[" + string.Join(",", catIdLst) + @"],""brandId"":2100000000}";
string body = @"{""catIdList"":[" + string.Join(",", catIdLst) + @"],""brandId"":" + brandId + "}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string getMixBrand(ShopLoginInfo shop, string catId = "547591")
{
//{"code":0,"brandRequire":1,"bizuinBrandList":[{"brandId":"10914219","chName":"名圣","enName":"","classificationNo":"14","tradeMarkSymbol":1,"registerDetails":{"registrant":"广州哇晓商贸有限责任公司","registerNo":"88879184","startTime":"1786254874","endTime":"2098915200","isPermanent":false},"applicationDetails":{},"grantType":2,"grantDetails":{"grantCertifications":["1786181562555-oRVwX2XGcQYT_YI7RbfnMdcXF3Cs-1512"],"grantLevel":"1","startTime":"0","endTime":"1820332800","isPermanent":false,"brandOwnerType":2},"status":3,"createTime":"1786254883","updateTime":"1786359925","auditInfo":{"auditId":"11736892187","auditStatus":3,"auditTimestamp":1786359925,"submitTimestamp":1786254882},"version":1,"outsideShopType":0,"outsideShopNikename":"","isNewApply":1,"specialQualification":["1786181592374-oRVwX2XGcQYT_YI7RbfnMdcXF3Cs-3202"],"innerBrand":{"id":"10914219","name":"名圣","cnName":"名圣","enName":"","group":0,"certificateNumber":"88879184","status":0,"disableScene":0,"brandStoreName":"","brandLevel":1,"remark":"","brandLevelAuditStatus":2,"brandLevelAuditId":"11839403256"}},{"brandId":"10796790","chName":"嘉飞","enName":"","classificationNo":"21","tradeMarkSymbol":1,"registerDetails":{"registrant":"佛山曜叶科技有限公司","registerNo":"32799300","startTime":"1786019090","endTime":"1870732800","isPermanent":false},"applicationDetails":{},"grantType":2,"grantDetails":{"grantCertifications":["1786010853000-oRVwX2XGcQYT_YI7RbfnMdcXF3Cs-6420"],"grantLevel":"10001","startTime":"0","endTime":"1798560000","isPermanent":false,"brandOwnerType":2},"status":3,"createTime":"1786010877","updateTime":"1786019115","auditInfo":{"auditId":"11582110870","auditStatus":3,"auditTimestamp":1786019115,"submitTimestamp":1786019104},"version":3,"outsideShopType":0,"outsideShopNikename":"","isNewApply":0,"specialQualification":["1786010862808-oRVwX2XGcQYT_YI7RbfnMdcXF3Cs-7538"],"innerBrand":{"id":"10796790","name":"嘉飞","cnName":"嘉飞","enName":"","group":0,"certificateNumber":"32799300","status":0,"disableScene":0,"brandStoreName":"","brandLevel":1,"remark":"","brandLevelAuditStatus":2,"brandLevelAuditId":"8194702850"}}],"mixBrandList":[{"brandId":"10914219","chName":"名圣","enName":"","classificationNo":"14","tradeMarkSymbol":1,"registerDetails":{"registrant":"广州哇晓商贸有限责任公司","registerNo":"88879184","startTime":"1786254874","endTime":"2098915200","isPermanent":false},"applicationDetails":{},"grantType":2,"grantDetails":{"grantCertifications":["1786181562555-oRVwX2XGcQYT_YI7RbfnMdcXF3Cs-1512"],"grantLevel":"1","startTime":"0","endTime":"1820332800","isPermanent":false,"brandOwnerType":2},"status":3,"createTime":"1786254883","updateTime":"1786359925","auditInfo":{"auditId":"11736892187","auditStatus":3,"auditTimestamp":1786359925,"submitTimestamp":1786254882},"version":1,"outsideShopType":0,"outsideShopNikename":"","isNewApply":1,"specialQualification":["1786181592374-oRVwX2XGcQYT_YI7RbfnMdcXF3Cs-3202"],"innerBrand":{"id":"10914219","name":"名圣","cnName":"名圣","enName":"","group":0,"certificateNumber":"88879184","status":0,"disableScene":0,"brandStoreName":"","brandLevel":1,"remark":"","brandLevelAuditStatus":2,"brandLevelAuditId":"11839403256"}}],"categoryType":1}
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradecategory/cgi/getMixBrand?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry";
string body = @"{""categoryId"":""" + catId + @"""}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}