diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 6f7ecd66a..e6942ad1d 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -946,45 +946,46 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf if err == nil && err2 == nil { // 1.检查门店三方配送配置,达达>蜂鸟>美团>顺丰>uu // excludeVendorIDs 包括上面已经发送的平台id - //storeCourierList, err := dao.GetStoreCourierList2(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusOpened, []int{model.StoreAuditStatusOnline, model.StoreAuditStatusUpdated}) - //excludeVendorIDsMap := make(map[int]int, 0) // 被排除的配送 - //for _, v := range excludeVendorIDs { - // excludeVendorIDsMap[v] = model.YES - //} - // - //vendorID := 0 - //for _, v := range storeCourierList { - // if excludeVendorIDsMap[v.VendorID] == model.YES { - // continue - // } - // if v.VendorID == model.VendorIDDada { - // excludeVendorIDs = []int{model.VendorIDFengNiao, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS} - // vendorID = v.VendorID - // break - // } - // if v.VendorID == model.VendorIDFengNiao { - // excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS} - // vendorID = v.VendorID - // break - // } - // if v.VendorID == model.VendorIDMTPS { - // excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT, model.VendorIDSFPS} - // vendorID = v.VendorID - // break - // } - // if v.VendorID == model.VendorIDUUPT { - // excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDFengNiao, model.VendorIDSFPS} - // vendorID = v.VendorID - // break - // } - // if v.VendorID == model.VendorIDSFPS { - // excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDFengNiao} - // vendorID = v.VendorID - // break - // } - //} - // - //partner.CurOrderManager.OnOrderMsg(order, fmt.Sprintf("发起自动创建三方运单,目标创建运单平台[%s],排除平台[%s]", jxutils.GetVendorName(vendorID), utils.Format4Output(excludeVendorIDs, false)), err.Error()) + storeCourierList, err := dao.GetStoreCourierList2(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusOpened, []int{model.StoreAuditStatusOnline, model.StoreAuditStatusUpdated}) + excludeVendorIDsMap := make(map[int]int, 0) // 被排除的配送 + globals.SugarLogger.Debugf("excludeVendorIDs 1 ===========初始排除平台id列表 : %s", utils.Format4Output(excludeVendorIDs, false)) + for _, v := range excludeVendorIDs { + excludeVendorIDsMap[v] = model.YES + } + + vendorID := 0 + for _, v := range storeCourierList { + if excludeVendorIDsMap[v.VendorID] == model.YES { + continue + } + if v.VendorID == model.VendorIDDada { + excludeVendorIDs = []int{model.VendorIDFengNiao, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS} + vendorID = v.VendorID + break + } + if v.VendorID == model.VendorIDFengNiao { + excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDSFPS} + vendorID = v.VendorID + break + } + if v.VendorID == model.VendorIDMTPS { + excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT, model.VendorIDSFPS} + vendorID = v.VendorID + break + } + if v.VendorID == model.VendorIDUUPT { + excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDFengNiao, model.VendorIDSFPS} + vendorID = v.VendorID + break + } + if v.VendorID == model.VendorIDSFPS { + excludeVendorIDs = []int{model.VendorIDDada, model.VendorIDMTPS, model.VendorIDUUPT, model.VendorIDFengNiao} + vendorID = v.VendorID + break + } + } + globals.SugarLogger.Debugf("excludeVendorIDs 2 ===========初始排除平台id列表 : %s", utils.Format4Output(excludeVendorIDs, false)) + partner.CurOrderManager.OnOrderMsg(order, fmt.Sprintf("发起自动创建三方运单,目标创建运单平台[%s],排除平台[%s]", jxutils.GetVendorName(vendorID), utils.Format4Output(excludeVendorIDs, false)), "") if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil { savedOrderInfo.retryCount++ } diff --git a/controllers/kuaishou_callback.go b/controllers/kuaishou_callback.go index 608cecdf8..6416b59bc 100644 --- a/controllers/kuaishou_callback.go +++ b/controllers/kuaishou_callback.go @@ -2,9 +2,7 @@ package controllers import ( "git.rosy.net.cn/baseapi/platformapi/kuaishou_mini" - "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx" - "git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals/api" "github.com/astaxie/beego/server/web" ) @@ -16,10 +14,6 @@ type KuaiShouController struct { // KuaiShouCallBack 快手回调 func (c *KuaiShouController) KuaiShouCallback() { payOrder, refundOrder, payType, msgId, err := api.KuaiShouApi.KauiShouCallback(c.Ctx.Request) - globals.SugarLogger.Debugf("KuaiShouCallBack payOrder =: %s", utils.Format4Output(payOrder, false)) - globals.SugarLogger.Debugf("KuaiShouCallBack refundOrder=: %s", utils.Format4Output(refundOrder, false)) - globals.SugarLogger.Debugf("KuaiShouCallBack payType=: %s", payType) - globals.SugarLogger.Debugf("KuaiShouCallBack err=: %s", utils.Format4Output(err, false)) if err != nil { c.Data["json"] = CallBackFail(msgId) c.ServeJSON()