This commit is contained in:
邹宗楠
2022-12-13 11:52:13 +08:00
parent 01987ae556
commit 57c2a9778a
3 changed files with 20 additions and 19 deletions

View File

@@ -42,7 +42,7 @@ func LoadingLogistics(paramLogistic []*model.UpdateMaterialLogistic) []error {
goodsOrderStatus := 0
for _, v := range logisticsList.Info[0].LogisticsTraceDetailList {
orderStatusToLocal := &model.OrderStatus{
VendorOrderID: logisticsList.OrderNo,
VendorOrderID: logisticsList.Info[0].MailNo,
VendorID: model.VendorIDTotalWl,
OrderType: model.OrderTypeWaybill,
RefVendorOrderID: logistics.OrderId,
@@ -108,20 +108,21 @@ func LoadingLogistics(paramLogistic []*model.UpdateMaterialLogistic) []error {
statusTime := orderStatus[len(orderStatus)-1].StatusTime
if len(wayBill) == 0 || wayBill == nil {
wayBillObj := &model.Waybill{
VendorWaybillID: logistics.LogisticId,
WaybillVendorID: model.VendorIDTotalWl,
VendorOrderID: logistics.OrderId,
OrderVendorID: model.VendorIDJX,
CourierName: logisticsList.Info[0].Courier,
CourierMobile: logisticsList.Info[0].CourierPhone,
Status: status,
VendorStatus: vendorStatus,
ActualFee: logistics.LogisticFee,
DesiredFee: logistics.LogisticFee,
DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled,
WaybillCreatedAt: time.Now(),
StatusTime: statusTime,
ModelTimeInfo: model.ModelTimeInfo{CreatedAt: time.Now(), UpdatedAt: time.Now()},
VendorWaybillID: logistics.LogisticId,
WaybillVendorID: model.VendorIDTotalWl,
VendorOrderID: logistics.OrderId,
OrderVendorID: model.VendorIDJX,
CourierName: logisticsList.Info[0].Courier,
CourierMobile: logisticsList.Info[0].CourierPhone,
Status: status,
VendorStatus: vendorStatus,
ActualFee: logistics.LogisticFee,
DesiredFee: logistics.LogisticFee,
DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled,
WaybillCreatedAt: time.Now(),
StatusTime: statusTime,
ModelTimeInfo: model.ModelTimeInfo{CreatedAt: time.Now(), UpdatedAt: time.Now()},
WaybillFinishedAt: time.Now(),
}
if err := dao.CreateEntity(db, wayBillObj); err != nil {
errList = append(errList, err)
@@ -132,6 +133,7 @@ func LoadingLogistics(paramLogistic []*model.UpdateMaterialLogistic) []error {
wayBill[0].Status = status
wayBill[0].VendorStatus = vendorStatus
wayBill[0].StatusTime = statusTime
wayBill[0].WaybillFinishedAt = time.Now()
if _, err := dao.UpdateEntity(db, wayBill[0], "Status", "UpdatedAt", "VendorStatus", "StatusTime"); err != nil {
errList = append(errList, err)
continue

View File

@@ -85,7 +85,6 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *mtpsapi.CallbackOrderExceptionMsg
func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *mtpsapi.CallbackResponse) {
order := c.callbackMsg2Waybill(msg)
globals.SugarLogger.Debugf("===========order 1 %s", utils.Format4Output(order, false))
switch msg.Status {
case mtpsapi.OrderStatusWaitingForSchedule:
data, err := api.MtpsAPI.QueryOrderStatus(msg.DeliveryID, msg.MtPeisongID)
@@ -115,7 +114,6 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
// order2, _ := dao.GetSimpleOrder(dao.GetDB(), order.VendorOrderID)
//查不到订单可能就是果园的订单
if order2 == nil {
globals.SugarLogger.Debugf("===========order 1 %s", utils.Format4Output(msg, false))
c.pushToGy(msg)
return mtpsapi.SuccessResponse
}
@@ -166,7 +164,6 @@ func pushMTPSToTiktok(msgStatus int, order *model.Waybill) {
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
globals.SugarLogger.Debugf("===========================mtps:%s", utils.Format4Output(result, false))
delivery.PullTiktokRiderInfo(result)
if result.LogisticsStatus == model.WaybillStatusCourierArrived {
result.LogisticsStatus = model.WaybillStatusDelivering
@@ -196,7 +193,6 @@ func (c *DeliveryHandler) pushToGy(msg *mtpsapi.CallbackOrderMsg) {
return
}
request.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
globals.SugarLogger.Debugf("============request %s", utils.Format4Output(request, false))
cl.Do(request)
}

View File

@@ -3,8 +3,10 @@ package tiktok_store
import (
"encoding/json"
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"net/http"
"strings"
@@ -12,6 +14,7 @@ import (
// OnOrderMsg 抖音
func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackResponse) {
globals.SugarLogger.Debugf("GetCallbackOrderId tiktok msg %s", utils.Format4Output(msg, false))
if CurPurchaseHandler != nil {
orderId, shopId, _ := api.TiktokStore.GetCallbackOrderId(msgId, msg)
if shopId != 0 {