diff --git a/business/jxcallback/auto_delivery/auto_delivery.go b/business/jxcallback/auto_delivery/auto_delivery.go index 2798b0c7f..a41cdd877 100644 --- a/business/jxcallback/auto_delivery/auto_delivery.go +++ b/business/jxcallback/auto_delivery/auto_delivery.go @@ -20,6 +20,9 @@ import ( var riderListInfo = make(map[string][]map[string]string, 0) func Init() { + if len(riderListInfo) != 0 { + return + } db := dao.GetDB() // 骑手列表 configRiderList, err := dao.QueryConfigs(db, "riderList", "Sys", "") @@ -78,7 +81,7 @@ func Init() { riderListInfo = list } -// AutoSettingFakeDelivery 抖音自动设置骑手(饿百), 推送假订单 +// AutoSettingFakeDelivery 抖音自动设置骑手, 推送假订单 func AutoSettingFakeDelivery() { db := dao.GetDB() diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 26314dd32..12cd02527 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -991,6 +991,7 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf if vendorID != model.NO { if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil { savedOrderInfo.retryCount++ + partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(vendorID), fmt.Sprintf("订单自动创建三方运单成功:%s", jxutils.GetVendorName(vendorID))) } else { partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(vendorID), fmt.Sprintf("发起自动创建三方运单,目标创建运单平台[%s],创建失败:%v", jxutils.GetVendorName(vendorID), err)) } diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index 0f1e7ec57..2bca80637 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -1,7 +1,6 @@ package cms import ( - "encoding/json" "fmt" "math" "reflect" @@ -631,19 +630,16 @@ func GetSToURidingDistance2(sLng, sLat, uLng, uLat float64, orderId string) (way if v.Status == model.WaybillStatusCanceled { continue } - //if v.Status >= model.WaybillStatusAccepted && v.Status <= model.WaybillStatusCanceled { // 获取骑行路线图 if v.OriginalData == "" { - //originalData, distance, durationTime, err := GetCyclingLine(origin, destination) originalData, distance, durationTime, err := GetCyclingLine(sLng, sLat, uLng, uLat) - if err == nil { + if err == nil && len(originalData) != model.NO { v.OriginalData = strings.Join(originalData, ";") v.Distance = distance v.DurationTime = durationTime } } - //} if vendorMaps[v.WaybillVendorID] == model.YES { // 如果是三方配送,更新骑手信息 @@ -738,18 +734,17 @@ func GetCyclingLine(sLng, sLat, uLng, uLat float64) (polyLineList []string, dist return nil, 0, 0, fmt.Errorf("获取骑行规划路线错误") } path := &baidunavi.RiderPath{} - if err := json.Unmarshal([]byte(data.(string)), path); err != nil { + if err := utils.Map2StructByJson(data, path, false); err != nil { return nil, 0, 0, err } - if path.Status != model.NO { - return nil, 0, 0, fmt.Errorf("%d,%s", path.Status, path.Message) - } - distance = int64(path.Result.Routes[0].Distance) // 距离 - duration = int64(path.Result.Routes[0].Duration) // 时间 - for _, v := range path.Result.Routes[0].Steps { - polyLineList = append(polyLineList, strings.Split(v.Path, ";")...) - } + if path != nil && len(path.Routes) != 0 { + distance = int64(path.Routes[0].Distance) // 距离 + duration = int64(path.Routes[0].Duration) // 时间 + for _, v := range path.Routes[0].Steps { + polyLineList = append(polyLineList, strings.Split(v.Path, ";")...) + } + } return } diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 26a550ec6..6a0a0743f 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -1099,7 +1099,6 @@ func GetOrders(db *DaoDB, ids []int64, isIncludeSku, isIncludeFake bool, fromDat if params["adjustCount"] != nil { sqlWhere += " AND t1.adjust_count >= ?" sqlParams = append(sqlParams, params["adjustCount"]) - //globals.SugarLogger.Debugf("sqlParams params[adjustCount]=========%d", params["adjustCount"]) } if mustInvoice, ok := params["mustInvoice"].(bool); ok && mustInvoice { sqlWhere += " AND t1.invoice_taxer_id <> ''" diff --git a/business/partner/purchase/tao_vegetable/callback.go b/business/partner/purchase/tao_vegetable/callback.go index 6beb0cc26..c2b1c5d52 100644 --- a/business/partner/purchase/tao_vegetable/callback.go +++ b/business/partner/purchase/tao_vegetable/callback.go @@ -17,7 +17,7 @@ func OnCallbackMsg(orderStatus, orderId string, msg interface{}) (response *tao_ response = CurPurchaseHandler.onOrderMsg(orderStatus, orderId, msg) }, jxutils.ComposeUniversalOrderID(orderId, model.VendorIDTaoVegetable)) } - return response + return tao_vegetable.CallBackResultInfo(nil) } func forwardOrderToGy(msg *mtwmapi.CallbackMsg, orderStatus string) { diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index 1d41291e6..180a37211 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -104,6 +104,10 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve multiSkuMap := make(map[int]int) if len(*orderDetail.SubOrderResponseList) > 0 { for _, extra := range *orderDetail.SubOrderResponseList { + // 这个是包装袋的价格,用户退款是包装袋未推送退款,导致本地订单退款状态无法更新,取消包装袋的记录 + if *extra.SkuCode == "6108080" { + continue + } sku := &model.OrderSku{ VendorOrderID: order.VendorOrderID, VendorSubOrderID: *extra.OutSubOrderId, diff --git a/controllers/taobao_vegetable.go b/controllers/taobao_vegetable.go index 809e586c2..4483cc91b 100644 --- a/controllers/taobao_vegetable.go +++ b/controllers/taobao_vegetable.go @@ -8,6 +8,7 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxstore/common" "git.rosy.net.cn/jx-callback/business/model" + "git.rosy.net.cn/jx-callback/business/partner" taoVegetable "git.rosy.net.cn/jx-callback/business/partner/purchase/tao_vegetable" "git.rosy.net.cn/jx-callback/globals/api" "github.com/astaxie/beego/server/web" @@ -225,8 +226,15 @@ func (c *TaoBaoVegetableController) CancelOnSaleRefundOrder() { default: //callbackResponse := taoVegetable.OnCallbackMsg(tao_vegetable.OrderStatusOnSaleCancel, utils.Int64ToStr(afsOrder.PartCancelRequest.BizOrderId), afsOrder) //c.Data["json"] = callbackResponse - c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(fmt.Errorf("不支持售中取消")) - c.ServeJSON() + order, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(afsOrder.PartCancelRequest.BizOrderId), model.VendorIDTaoVegetable) + if err != nil || order.Status > model.WaybillStatusCourierArrived { + c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(fmt.Errorf("不支持售中取消")) + c.ServeJSON() + } else { + c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(nil) + c.ServeJSON() + } + return } }