This commit is contained in:
邹宗楠
2022-11-04 09:10:21 +08:00
parent 43938b7a4e
commit 09ce608f62
4 changed files with 30 additions and 8 deletions

View File

@@ -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: "",

View File

@@ -358,8 +358,8 @@ const (
)
const (
BusinessTypeImmediate = 1
BusinessTypeDingshida = 2
BusinessTypeImmediate = 1 // 立即达
BusinessTypeDingshida = 2 // 定时达
)
var (

View File

@@ -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())
}
}
}
}

View File

@@ -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
}
// 用户保密信息脱敏