From 09ce608f62bc08ab53bf46e506d38af70f89df43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 4 Nov 2022 09:10:21 +0800 Subject: [PATCH] 1 --- .../jxcallback/scheduler/defsch/defsch_ext.go | 9 ++++++-- business/model/const.go | 4 ++-- business/partner/delivery/rider.go | 21 +++++++++++++++++-- .../partner/purchase/tiktok_store/order.go | 4 ++-- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index 101710a79..181bc0518 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -5,6 +5,7 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxstore/cms" "math" + "math/rand" "time" "git.rosy.net.cn/jx-callback/business/model/dao" @@ -80,8 +81,12 @@ func (s *DefScheduler) SelfDeliveringAndUpdateStatus(ctx *jxcontext.Context, ven // 上面是真的转自送,支持美团,饿百,京东,如果时抖店,抖店暂时全部是自送的!但是有骑手信息时,就是一个白嫖单子! if order.VendorID == model.VendorIDDD && courierName != "" && courierMobile != "" { timeNow := time.Now() - var randData = []int64{1, 2, 3, 4, 5} - randTime := time.Duration(randData[0]) * time.Minute + rand.Seed(timeNow.Unix()) + randNumber := rand.Int63n(481) + if randNumber < 60 { + randNumber += 60 + } + randTime := time.Duration(randNumber) * time.Second bill := &model.Waybill{ VendorWaybillID: order.VendorOrderID, VendorWaybillID2: "", diff --git a/business/model/const.go b/business/model/const.go index a02393011..e0463bae1 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -358,8 +358,8 @@ const ( ) const ( - BusinessTypeImmediate = 1 - BusinessTypeDingshida = 2 + BusinessTypeImmediate = 1 // 立即达 + BusinessTypeDingshida = 2 // 定时达 ) var ( diff --git a/business/partner/delivery/rider.go b/business/partner/delivery/rider.go index 3571b2cc6..a1f53e33c 100644 --- a/business/partner/delivery/rider.go +++ b/business/partner/delivery/rider.go @@ -154,6 +154,10 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) { case model.VendorIDWSC: // 微盟微商城 case model.VendorIDDD: // 抖店小时达 // 呼叫骑手的时候推送发货 + if riderInfo.CourierPhone == "18048531223" { + riderInfo.CourierPhone = "" + riderInfo.CourierPhone = "" + } // 抖店由于发配送时运单id已经固定了,我们系统在重新发货,或者运单号发生改变时去推送信息时.抖店只识别第一个运单号所以在这儿修改成发单时的第一个运单号! riderInfo.ThirdCarrierOrderId = riderInfo.OrderId paramsMap := utils.Struct2Map(riderInfo, "", true) @@ -252,6 +256,7 @@ func UpdateFakeWayBillToTiktok() { continue } + riderInfo.LogisticsContext += fmt.Sprintf("[%s:%s]", riderInfo.CourierName, riderInfo.CourierPhone) // 推送骑手信息 paramsMap := utils.Struct2Map(riderInfo, "", true) if handler := partner.GetPurchaseOrderHandlerFromVendorID(model.VendorIDDD); handler != nil { @@ -260,13 +265,25 @@ func UpdateFakeWayBillToTiktok() { } } - var randNum = []int64{1, 2, 3, 4, 5} - fakeWayBill[i].ModelTimeInfo.UpdatedAt = time.Now().Add(time.Duration(randNum[rand.Int63n(5)]) * time.Minute) + rand.Seed(time.Now().Unix()) + randNumber := rand.Int63n(481) + if randNumber < 60 { + randNumber += 60 + } + fakeWayBill[i].ModelTimeInfo.UpdatedAt = time.Now().Add(time.Duration(randNumber) * time.Second) // 更新假运单 if _, err := dao.UpdateEntity(dao.GetDB(), fakeWayBill[i], "Status", "VendorStatus", "UpdatedAt"); err != nil { globals.SugarLogger.Errorf("Update Fake Way Bill Err:%s--%s--%v", riderInfo.OrderId, riderInfo.ThirdCarrierOrderId, err) } + // 更新运单为完成状态 + if fakeWayBill[i].Status == model.WaybillStatusDelivered { + sql := `UPDATE goods_order g SET g.status = ? AND g.vendor_status = ? WHERE vendor_order_id = ?  ` + _, err := dao.ExecuteSQL(dao.GetDB(), sql, []interface{}{model.OrderStatusFinished, model.OrderStatusFinished, fakeWayBill[i].VendorOrderID}...) + if err != nil { + globals.SugarLogger.Debugf("UPDATA goods_order Err :%s", err.Error()) + } + } } } diff --git a/business/partner/purchase/tiktok_store/order.go b/business/partner/purchase/tiktok_store/order.go index 4a85c8b6e..88508932b 100644 --- a/business/partner/purchase/tiktok_store/order.go +++ b/business/partner/purchase/tiktok_store/order.go @@ -188,9 +188,9 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s h, m, _ := order.ExpectedDeliveredTime.Clock() if order.ExpectedDeliveredTime.Day() == time.Now().Day() && utils.Str2Int16(fmt.Sprintf("%d%d", h, m)) >= openTime && utils.Str2Int16(fmt.Sprintf("%d%d", h, m)) < closeTime && localStore.Status == model.StoreStatusOpened { - order.BusinessType = model.BusinessTypeDingshida - } else { order.BusinessType = model.BusinessTypeImmediate + } else { + order.BusinessType = model.BusinessTypeDingshida } // 用户保密信息脱敏