Browse Source

修改cyt打单

zhuyiyi 1 month ago
parent
commit
d27c93e64a
1 changed files with 43 additions and 0 deletions
  1. 43 0
      SiteCore/taobao/apiCaiYingTong.cs

+ 43 - 0
SiteCore/taobao/apiCaiYingTong.cs

@@ -228,6 +228,49 @@ namespace SiteCore.Handler
             }
             if (entity != null)
             {
+                try
+                {
+                    string[] cpCodeList = cpCode.Split(',');
+                    if (cpCodeList.Length > 1)
+                    {
+                        string newCpCode = "";
+                        //拼多多
+                        if (entity.tid.Contains("-"))
+                        {
+                            if (cpCodeList[0].Contains("PDD") || cpCodeList[0].Contains("pdd"))
+                            {
+                                newCpCode = cpCodeList[0];
+                            }
+                            if (cpCodeList[1].Contains("PDD") || cpCodeList[1].Contains("pdd"))
+                            {
+                                newCpCode = cpCodeList[1];
+                            }
+                        }
+                        else
+                        {
+                            if (!cpCodeList[0].Contains("PDD") && !cpCodeList[0].Contains("pdd"))
+                            {
+                                newCpCode = cpCodeList[0];
+                            }
+                            if (!cpCodeList[1].Contains("PDD") && !cpCodeList[1].Contains("pdd"))
+                            {
+                                newCpCode = cpCodeList[1];
+                            }
+                        }
+                        if (string.IsNullOrEmpty(newCpCode))
+                        {
+                            returnErrorMsg("快递编码错误");
+                            return;
+                        }
+                        cpCode = newCpCode;
+                    }
+                }
+                catch (Exception e)
+                {
+                    XLog.SaveLog(0, "解析快递编码错误" + e);
+                    returnErrorMsg("解析快递编码错误");
+                    return;
+                }
                 CeErpTrade mainEn = CeErpTrade.Get(entity.tid);
                 string posCode = mainEn.posCode;