Merge remote-tracking branch 'origin/mark' into lcw
This commit is contained in:
@@ -87,7 +87,7 @@ func GetWeiXinUserInfo(code string, state string) (userInfo *UserInfoExt, err er
|
||||
SNSUserInfo: *wxUserinfo,
|
||||
TempPassword: utils.GetUUID(),
|
||||
}
|
||||
globals.SugarLogger.Debugf("GetUserInfo code:%s, pwd:%s", code, userInfo.TempPassword)
|
||||
globals.SugarLogger.Debugf("GetUserInfo code:%s, userInfo:%s", code, utils.Format4Output(userInfo, true))
|
||||
cacheSNSInfo(wxUserinfo, userInfo.TempPassword, DefTempPasswordDuration)
|
||||
user, err2 := dao.GetWeiXinUserByIDs(dao.GetDB(), "", wxUserinfo.UnionID, wxUserinfo.OpenID, "")
|
||||
if err = err2; err == nil {
|
||||
|
||||
@@ -346,6 +346,7 @@ func (c *OrderManager) updateOrderOtherInfo(order *model.GoodsOrder, db *dao.Dao
|
||||
}
|
||||
|
||||
func (c *OrderManager) addOrderStatus(orderStatus *model.OrderStatus, db *dao.DaoDB) (isDuplicated bool, order *model.GoodsOrder, err error) {
|
||||
globals.SugarLogger.Debugf("addOrderStatus refOrderID:%s, orderID:%s", orderStatus.RefVendorOrderID, orderStatus.VendorOrderID)
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
@@ -359,24 +360,30 @@ func (c *OrderManager) addOrderStatus(orderStatus *model.OrderStatus, db *dao.Da
|
||||
if (model.IsOrderLockStatus(orderStatus.Status) || model.IsOrderUnlockStatus(orderStatus.Status)) ||
|
||||
(model.IsOrderMainStatus(orderStatus.Status) && orderStatus.Status >= order.Status) { // todo 要求status不能回绕
|
||||
order.VendorStatus = orderStatus.VendorStatus
|
||||
order.StatusTime = orderStatus.StatusTime
|
||||
updateFields := []string{
|
||||
"VendorStatus", "StatusTime",
|
||||
"VendorStatus",
|
||||
}
|
||||
if model.IsOrderMainStatus(orderStatus.Status) {
|
||||
order.LockStatus = model.OrderStatusUnknown
|
||||
order.Status = orderStatus.Status
|
||||
updateFields = append(updateFields, "Status", "LockStatus")
|
||||
order.StatusTime = orderStatus.StatusTime
|
||||
updateFields = append(updateFields, "Status", "StatusTime")
|
||||
if order.LockStatus != model.OrderStatusUnknown {
|
||||
order.LockStatus = model.OrderStatusUnknown
|
||||
order.LockStatusTime = orderStatus.StatusTime
|
||||
updateFields = append(updateFields, "LockStatus", "LockStatusTime")
|
||||
}
|
||||
} else {
|
||||
if model.IsOrderUnlockStatus(orderStatus.Status) {
|
||||
order.LockStatus = model.OrderStatusUnknown
|
||||
updateFields = append(updateFields, "LockStatus")
|
||||
} else if model.IsOrderLockStatus(orderStatus.Status) {
|
||||
} else {
|
||||
if order.LockStatus != model.OrderStatusUnknown {
|
||||
globals.SugarLogger.Warnf("addOrderStatus refOrderID:%s, orderID:%s, order.LockStatus:%d, status.LockStatus:%d", orderStatus.RefVendorOrderID, orderStatus.VendorOrderID, order.LockStatus, orderStatus.Status)
|
||||
}
|
||||
order.LockStatus = orderStatus.Status
|
||||
updateFields = append(updateFields, "LockStatus")
|
||||
}
|
||||
order.LockStatusTime = orderStatus.StatusTime
|
||||
updateFields = append(updateFields, "LockStatus", "LockStatusTime")
|
||||
}
|
||||
// orderStatus.LockStatus = order.LockStatus
|
||||
if model.IsOrderFinalStatus(orderStatus.Status) {
|
||||
order.OrderFinishedAt = orderStatus.StatusTime
|
||||
updateFields = append(updateFields, "OrderFinishedAt")
|
||||
|
||||
@@ -133,6 +133,13 @@ func (c *BaseScheduler) AcceptOrRefuseFailedGetOrder(ctx *jxcontext.Context, ord
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).AcceptOrRefuseFailedGetOrder(ctx, order, isAcceptIt)
|
||||
}
|
||||
if err == nil {
|
||||
flag := int8(model.OrderFlagAgreeFailedGetGoods)
|
||||
if !isAcceptIt {
|
||||
flag = model.OrderFlagRefuseFailedGetGoods
|
||||
}
|
||||
dao.SetOrderFlag(dao.GetDB(), ctx.GetUserName(), order.VendorOrderID, order.VendorID, flag)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -140,6 +147,9 @@ func (c *BaseScheduler) CallPMCourier(ctx *jxcontext.Context, order *model.Goods
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).CallCourier(ctx, order)
|
||||
}
|
||||
if err == nil {
|
||||
dao.SetOrderFlag(dao.GetDB(), ctx.GetUserName(), order.VendorOrderID, order.VendorID, model.OrderFlagMaskCallPMCourier)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -147,6 +157,9 @@ func (c *BaseScheduler) ConfirmReceiveGoods(ctx *jxcontext.Context, order *model
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).ConfirmReceiveGoods(ctx, order)
|
||||
}
|
||||
if err == nil {
|
||||
dao.SetOrderFlag(dao.GetDB(), ctx.GetUserName(), order.VendorOrderID, order.VendorID, model.OrderFlagMaskFailedDeliver)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -154,5 +167,12 @@ func (c *BaseScheduler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model
|
||||
if c.IsReallyCallPlatformAPI {
|
||||
err = partner.GetPurchasePlatformFromVendorID(order.VendorID).AgreeOrRefuseCancel(ctx, order, isAcceptIt, reason)
|
||||
}
|
||||
if err == nil {
|
||||
flag := int8(model.OrderFlagAgreeUserApplyCancel)
|
||||
if !isAcceptIt {
|
||||
flag = model.OrderFlagRefuseUserApplyCancel
|
||||
}
|
||||
dao.SetOrderFlag(dao.GetDB(), ctx.GetUserName(), order.VendorOrderID, order.VendorID, flag)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -113,11 +113,12 @@ func (s *WatchOrderInfo) updateOrderStoreFeature(order *model.GoodsOrder) (err e
|
||||
}
|
||||
s.autoPickupTimeoutMinute = int(storeMap.AutoPickup)
|
||||
s.storeDeliveryType = FixedScheduler.GetStoreDeliveryType(order, storeMap)
|
||||
if s.storeDeliveryType == scheduler.StoreDeliveryTypeByStore && (order.DeliveryFlag&model.OrderDeliveryFlagMaskPurcahseDisabled) == 0 {
|
||||
order.DeliveryFlag |= model.OrderDeliveryFlagMaskPurcahseDisabled
|
||||
err = partner.CurOrderManager.UpdateOrderStatusAndFlag(order)
|
||||
}
|
||||
globals.SugarLogger.Debugf("updateOrderStoreFeature orderID:%s, s.storeDeliveryType:%d, order.DeliveryFlag:%d", order.VendorOrderID, s.storeDeliveryType, order.DeliveryFlag)
|
||||
globals.SugarLogger.Debugf("updateOrderStoreFeature orderID:%s, s.storeDeliveryType:%d", order.VendorOrderID, s.storeDeliveryType)
|
||||
// if s.storeDeliveryType == scheduler.StoreDeliveryTypeByStore && (order.DeliveryFlag&model.OrderDeliveryFlagMaskPurcahseDisabled) == 0 {
|
||||
// order.DeliveryFlag |= model.OrderDeliveryFlagMaskPurcahseDisabled
|
||||
// err = partner.CurOrderManager.UpdateOrderStatusAndFlag(order)
|
||||
// }
|
||||
// globals.SugarLogger.Debugf("updateOrderStoreFeature orderID:%s, s.storeDeliveryType:%d, order.DeliveryFlag:%d", order.VendorOrderID, s.storeDeliveryType, order.DeliveryFlag)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -409,20 +410,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
||||
// s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
|
||||
globals.SugarLogger.Infof("OnWaybillStatusChanged CourierArrived order(%d, %s) bill(%d, %s), bill:%v shouldn't get here", order.WaybillVendorID, order.VendorWaybillID, bill.WaybillVendorID, bill.VendorWaybillID, bill)
|
||||
}
|
||||
case model.WaybillStatusFailed: // todo WaybillStatusFailed理解成订单整个失败了,不需要再尝试创建运单了,注意这里应该加个zabbix日志的报警
|
||||
s.removeWaybillFromMap(savedOrderInfo, bill.WaybillVendorID)
|
||||
if s.isBillCandidate(order, bill) {
|
||||
s.resetTimer(savedOrderInfo, bill, isPending)
|
||||
if !isPending {
|
||||
globals.SugarLogger.Infof("OnWaybillStatusChanged WaybillStatusFailed, bill:%v", bill)
|
||||
bill.WaybillVendorID = model.VendorIDUnknown
|
||||
s.updateOrderByBill(order, bill, false)
|
||||
}
|
||||
} else {
|
||||
// 创建运单失败时,可能到这里来(比如:818874313000121)
|
||||
globals.SugarLogger.Infof("OnWaybillStatusChanged Failed bill:%v shouldn't got here, order details:%v", bill, order)
|
||||
}
|
||||
case model.WaybillStatusCanceled:
|
||||
case model.WaybillStatusCanceled, model.WaybillStatusFailed:
|
||||
s.removeWaybillFromMap(savedOrderInfo, bill.WaybillVendorID)
|
||||
if s.isBillCandidate(order, bill) || order.WaybillVendorID == model.VendorIDUnknown {
|
||||
s.resetTimer(savedOrderInfo, nil, isPending)
|
||||
|
||||
Reference in New Issue
Block a user