瀏覽代碼

修改cyt接口打单

zhuyiyi 1 月之前
父節點
當前提交
2edeadb8f7
共有 1 個文件被更改,包括 44 次插入0 次删除
  1. 44 0
      SiteCore/taobao/apiCaiYingTong.cs

+ 44 - 0
SiteCore/taobao/apiCaiYingTong.cs

@@ -48,6 +48,7 @@ namespace SiteCore.Handler
                 }
                 catch (Exception ex)
                 {
+                    XLog.SaveLog(0, "彩印通接口错:" + ex);
                     conError("处理接口错误,服务器返回错误");
                 }
                 finally
@@ -339,6 +340,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;
+                }
                 bool isUseLastWayBillCode = true;
                 if ((entity.OrderState == 7 || entity.OrderState == 6))
                 {