- 添加GoodsOrder.AdjustCount
This commit is contained in:
@@ -110,13 +110,28 @@ func (c *OrderManager) OnOrderAdjust(order *model.GoodsOrder, orderStatus *model
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = utils.CallFuncLogError(func() error {
|
||||
_, err = db.Db.Raw("DELETE FROM goods_order WHERE vendor_order_id = ? AND vendor_id = ?", order.VendorOrderID, order.VendorID).Exec()
|
||||
return err
|
||||
}, "OnAdjustOrder delete order_sku, orderID:%s", order.VendorOrderID)
|
||||
if err != nil {
|
||||
previousOrder := &model.GoodsOrder{
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
VendorID: order.VendorID,
|
||||
}
|
||||
if err = dao.GetEntity(db, previousOrder, model.FieldVendorOrderID, model.FieldVendorID); err != nil && !dao.IsNoRowsError(err) {
|
||||
globals.SugarLogger.Warnf("OnOrderAdjust, order:%s GetEntity failed with error:%v", order.VendorOrderID, err)
|
||||
return err
|
||||
}
|
||||
adjustCount := int8(0)
|
||||
if err == nil {
|
||||
adjustCount = previousOrder.AdjustCount
|
||||
if _, err = dao.DeleteEntity(db, previousOrder); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("OnOrderAdjust, but previous order:%s doesn't exist", order.VendorOrderID)
|
||||
}
|
||||
// err = utils.CallFuncLogError(func() error {
|
||||
// _, err = db.Db.Raw("DELETE FROM goods_order WHERE vendor_order_id = ? AND vendor_id = ?", order.VendorOrderID, order.VendorID).Exec()
|
||||
// return err
|
||||
// }, "OnAdjustOrder delete order_sku, orderID:%s", order.VendorOrderID)
|
||||
order.AdjustCount = adjustCount + 1
|
||||
isDuplicated, err = c.SaveOrder(order, true, db)
|
||||
}
|
||||
if err == nil {
|
||||
|
||||
@@ -56,6 +56,7 @@ type GoodsOrder struct {
|
||||
DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送
|
||||
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"`
|
||||
WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排
|
||||
AdjustCount int8 `json:"adjustCount"` // 调整单(次数)
|
||||
DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送
|
||||
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间)
|
||||
|
||||
Reference in New Issue
Block a user